-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expand classes #4
Comments
It should also work for tags that are currently stripped, like
|
The major hurdle I see is that the converter does not seem to be aware of pairs of tag, so it wouldn't know where to add the closing bbcode tag for the HTML element with a given class. Implementing what I propose would require the converter to be DOM aware. I am aware that it would require a major refactor of the current code.... :-/ |
Hi, I have written this library to convert over 20.000 articles originally written using HTML and BBCode and I'm aware that HTML parsing shouldn't be done using regex, but I didn't want to write a parser from scratch and the articles I had to convert are not HTML document, they are just text files using some HTML tags. And yep, the library did the job. To achieve the goals you have in mind the library should use the pattern Command and maybe implement the Decorator pattern as well. It's not a big work to refactor it, but sincerely I don't have time, neither I'm interested to do that. I have too much things going on. But feel free to fork the project. |
Thanks for this little converter. It's simple and does the job.
It'd be nice to have a programmable support for HTML classes.
Suppose I have HTML which includes classes:
<strong class="notice">Important information</strong>
We could have a framework where we could program instances of classes, and how to render them in BBCode.
For example, class="notice" could be wrapped in red colour:
[b][color=#FF0000]Important information[/color][/b]
The library could thus be made class aware. The user could register a class and tell the library how to render it. When the converter finds a class, it looks up if it is among registered classes, and handles it appropriately.
The text was updated successfully, but these errors were encountered: