Open Gpower2 opened 11 years ago
I have done the parsing code. What do you mean when you say “writing” and “fixing”?
If I want to use the spoiler tag. it need to input at the correct place [spoiler]...[\spoiler]
Push the BBcode class that you've written so far and we'll see about the rest ;)
I have 3 php files: text.php (textarea box), class.php (bbcode) and index.php (show the result).
Do you want me to push all of them?
Yes, just make a separate folder in order to have a clean file structure.
Ok, I pushed them.
P.S.: Sorry for the delay, but I found some errors in the script and I fixed them.
I made some changes to the directory structure and the names of the classes. You should pull the changes locally and see them carefully.
Also, the bbcode transformations that you used don't match the ones we currently use. I guess you found them and used them as they were. I uploaded a test file in order to use it as a reference for the correct output.
I didn't use them as they were, I selected the names of the tags. I will change them to match with the ones we use now.;)
Also, with the “bbcodeTest01.txt” that you uploaded, I found error in the quote code. When it is quote within quote it doesn’t work (I didn’t think to testing that). I will try to fix it and I will edit the code.
Made a few more changes, so please pull once again to have the latest version, thanks.
I finished with the changes. I'll check the script again tomorrow and I will push it. ;)
I have pushed the files. I uploaded and a new bbcodeTest02.txt. I think now we are ok, but test it yourself.;)
Better, but it still has a lot of issues:
And a simple use case to help you:
[quote] This is a quote: [quote=Gpower2] This is a named quote: [quote=tolias63] This is a simple list: [list] [] This is a malformed list: [list=] [] This is an ordered list: [list=1] [*] This is a code statement: [code] Testing simple code. [/code] This is a nested code statement: [code] First level: [code] Second level It contains a quote: [quote] That it contains a code: [code] Code inside a quote [/code] [/quote] [/code] [/code] [/list] [/list] [/list] [/quote] [/quote] [/quote]
When you say "style classes" you mean something like this, right?
php file: (div class="centerbox")(/div) (div class="centerbox2")(p class="announcetitle" )Hallo(/p)(/div)
css file: div.centerbox {background-color: white; margin-left: 450px;} div.centerbox2 {position: relative; margin-left: 300px; margin-top: 100px;} p.announcetitle {color: black; font-weight: bold; font-size:36px;}
Yes, exactly like this. ;)
Ok, i will do the changes. :D
I have fixed the style classes, the youtube, and the javascript for spoiler.
I have also done the “code”, but when there is [code][code]...text...[/code][/code] doing parsing the first [code] with the first [/code], not the first [code] with the latest [/code].
I will try to fix it and I will push it.
I pushed the files. I hope they are ok now.;)
Btw, I have started to making and the buttons with javascript.;)
There are still some issues, I will make some changes and push them, in order to understand what I mean. ;)
Do I have a lot of wrongs?
No, you will see and you will understand. ;)
OK. Can I continue with the buttons?
I don't quite understand what you mean by "buttons". This issue is only about back end core code, not front end design. So you shouldn't concern yourself with the CSS and javascript for the time being. These are issues for later. ;)
I mean, for example, when I press the "B" to add [b][/b] in the text.
No, that's entirely another issue and it is definitely for later. You can work on it, but don't push it yet. ;)
Ah, ok! I will wait to see the changes.;)
Ok, I saw the changes and I have some questions.
Ok. I read about unobtrusive javascript and I will fix the spoiler. I will delete the lines for < pre >. That I don't quite understand is what I must do for size, color and font. For example, I must make something like this:
php file '/(?<!\)[color(?::\w+)?=red[\/color(?::\w+)?]/si' => "(span class="red">\1(/span)", '/(?<!\)[color(?::\w+)?=green[\/color(?::\w+)?]/si' => "(span class="green">\1(/span), . '/(?<!\)[font(?::\w+)?=Arial[\/font(?::\w+)?]/si' => "(span class="arial">\1(/span)", '/(?<!\)[font(?::\w+)?=Georgia[\/font(?::\w+)?]/si' => "(span class="georgia">\1(/span)", . '/(?<!\)[size(?::\w+)?=15[\/size(?::\w+)?]/si' => "(span class="size_15">\1(/span)", '/(?<!\)[size(?::\w+)?=20[\/size(?::\w+)?]/si' => "(span class="size_20">\1(/span)",
css file span.red {color:red;} span.green {color:green;} . span.arial {font-family:Arial;} span.georgia {font-family:Georgia;} . span.size_15 {font-size:15px;} span.size_22 {font-size:20px;}
You don't need to delete any lines, better leave them there for future reference. The color and font names are ok, about the size, you should use tiny, small, normal, medium, large, huge. And then we can decide with css which size to use. ;)
I also made a few more cosmetic changes to the code, so please first take the latest version.
Ok, man! I will make the changes. ;)
Are they ok now?
issues to check: -replace funny utf8 characters -replace <> characters with its htmml entities
i write them here in order not to forget them, please ignore them for the time being...
Made a few changes and created the prototype for a checking function, in order for you to write it. ;) I accidentally linked the commit with the database issue...
Ok, I saw the example and I understood what I must do. I will write it.;)
I'm not sure if they are correct...
I was thinking, what would you say if we include and spell checking?
It is far too soon to think about such features, and apart from that, spell checking is a feature that modern browsers support by default. So no, you shouldn't waste your time with spell checking.
I am still waiting on that regex bug though...
Oh, I forgot about that bug... :oops:
I will fix it...;)
A class that will contain the functionality needed for BBcodes:
It should make heavy use of regular expressions in order to be as fast as possible.