It is currently Thu Nov 21, 2024 2:22 pm

Forum BBCode Parser Changed

For game and non-game related chatter, links, and other goodies, go here.

Forum BBCode Parser Changed

Postby Zancarius » Thu Aug 16, 2007 6:54 am

This probably isn't a hugely important change but it's significant enough to warrant a bit of a notice. In short, the built-in parser for BBCode (the formatting that lets you create bold text, link pictures, etc) has been replaced with a parser I wrote for an on going CMS project. The new parser is called "[url="http://piki.destrealm.org]Piki[/url]" (a pun on the word "wiki") and has a number of new features and improvements over the default BBCode parser that comes with phpBB (this forum).

Improvements

The most notable improvements are scrollable code and image blocks. If images go beyond a certain width or height, the container div tag holding them transforms into a scrollable block. This has the advantage that REALLY BIG pictures no longer cause you to have to scroll horizontally (or vertically) all that much in order to read the thread. Since this is dedicated to a game forum, it makes sense to have this feature as screenshots are likely to be large, require a LOT of scrolling, and can significantly reduce the usability of the forum in such a thread. (I believe Jakob Neilsen, a fairly well-known usability expert, wrote a piece on this. I'm not too sure.) The same applies to [ignore]
Code: Select all
[/ignore] tags; if the code consists of line widths that are wide enough to "overflow" the block, they'll become scrollable, too, though that's not as much of an issue for this forum since we're not discussing source code.

Note: Scrolling behavior doesn't really work correctly in Internet Explorer due to its really crappy support of CSS2. Right now, I'm using the next best possible workaround. If anyone has a better idea of handling scrolling divs in CSS, I'd be happy to implement it.

Another significant change over the default phpBB parser is with regards to URL handling. By default, when you'd copy and paste a URI into the text field, it would be linked without question. Rather lengthy URLs would pose the same problem as wide images. After posting a lengthy URL, horizontal scrolling would render the thread almost unreadable. Piki solves this problem by breaking apart the URL into a leading and trailing section, joining the two with an ellipsis (that's the "..." character group you sometimes see in writing). It has another mode for URL splitting that's used on Slashdot wherein a space (" ") is inserted every X characters. I don't have this mode enabled since I think it can be aesthetically disruptive.

URI handling is also improved in that any links will be appended with the "real" domain name of the link. For instance, you might see something like the follow: [ignore]http://example.com/ [example.com][/ignore]. The domain name in brackets is the "real" domain name of the link. That prohibits someone from linking to a resource in order to disguise it, such as: [ignore]http://somebankingsite.dom[/ignore]. In this particular example, the "real" domain would be appended in brackets, rendering the link to look something like: [ignore]http://somebankingsite.dom [evildomain.com][/ignore]. As you can see, the visual indicator that the link points to an unexpected domain can be rather helpful. This should also reduce the likelihood that someone could link to, for example, a purported "fluffy bunny" only to wind up pointing to something that might be better left unseen.

There's also an "inline code" feature for use whenever you might need to put a [icode]monospace font[/icode] inside of a block of text. I don't really see much utility for this feature here.

Other improvements are mostly limited to the behavioral pattern of various formatting tags. [ignore]
Code: Select all
[/ignore] tags now support limited styles within, meaning that you can perform something like syntax highlighting, bold, or italicize text within the containing code block. Additionally, ALL formatting tags that accept an argument (url, quote, color, size, etc) can now have that argument encapsulated in quotations--or not. In the phpBB default parser, [ignore][url="http://example.com"]example[/url][/ignore] would be illegal, as quotation marks are not allowed around the URI. In Piki, both quotation marks--and no quotation marks--are supported. This makes things a little bit easier if you can't remember exactly how to format something since BBCode is rather haphazard and has little or no consistency.

Additions

There are several new things that have been added to Piki, including the ability to ignore formatting blocks, anchor tags, captions, and the like. Piki also supports wiki-style formatting something like MediaWiki, though with minor changes. The following is a fairly complete list of syntax structures that are now legal:

Piki supports Wiki-style formatting for links, rendering, etc. The formatting style is somewhat like Mediawiki of Wikipedia fame. Here's an example:

'''Bold''': [ignore]**Bold**[/ignore]
'''Code/monospace block''': [ignore]@@Code block@@[/ignore]
'''Colored Text''': [ignore]#red#Colored Text##[/ignore]
'''Colored Text 2''': [ignore]##800000#Colored Text 2##[/ignore]
'''Custom Heading''': [ignore]=1=Custom Heading==[/ignore]
'''Default Heading''': [ignore]==Default Heading==[/ignore]
'''Emphasis''': [ignore]""Emphasis""[/ignore]
'''Horizontal Rule''': [ignore]----[/ignore]
'''Italics''': [ignore]''Italics''[/ignore]
'''Link to Local Resource (requires callback)''': [ignore][[local:some/local/url Sensible, descriptive name]][/ignore]
'''Preformatted text block''': [ignore]{{{ preformatted text }}}[/ignore]
'''Strike-through''': [ignore]---Strike-through---[/ignore]
'''Strong''': [ignore]'''Strong'''[/ignore]
'''Subscript''': [ignore],,Subscript,,[/ignore]
'''Superscript''': [ignore]^^Superscript^^[/ignore]
'''URL linking''': [ignore][[http://example.com Sensible, descriptive name]][/ignore]
'''Underline''': [ignore]__Underline__[/ignore]

Piki also supports standard phpBB-style BBCode tags, including a few new ones that might be of interest:

Acronyms (syntax is REVERSE that of HTML): [ignore][acronym="LOL"]Laughing Out Loud[/acronym][/ignore]
Anchor: [ignore][anchor="Name"]Create Anchor "Name"[/anchor][/ignore]
Bold: [ignore]Bold[/ignore]
Caption: [ignore][caption="Caption Text"]Object to caption[/caption][/ignore]
Cite (citation of a work): [ignore][cite]Cite[/cite][/ignore]
Colored Text: [ignore][color="red"]Colored Text[/color][/ignore]
Emphasis: [ignore][em]Emphasis[/em][/ignore]
Header sizes 1-6: [ignore][header="2"]Header Size 2[/header][/ignore]
Horizontal Rule: [ignore][hr][/ignore]
Inline code (may have a different prevailing style than [monospace]): [ignore][icode]Example code.[/icode][/ignore]
Italics: [ignore]Italics[/ignore]
Multi-line code: [ignore]
Code: Select all
In-line code
[/ignore]
Pre-formatted text: [ignore][pre]Pre-formatted text[/pre][/ignore]
Resize Text: [ignore][size="10"]Resize Text[/size][/ignore]
Resize Text (manual): [ignore][size="10pt"]Resize Text[/size][/ignore]
Strike-through: [ignore][strike]Strike-through[/strike][/ignore]
Strong: [ignore][strong]Strong[/strong][/ignore]
Subscript: [ignore][sub]Subscript[/sub][/ignore]
Superscript: [ignore][sup]Superscript[/sup][/ignore]
URL linking: [ignore][url="http://example.com"]Sensible URL name[/url][/ignore]
Underline: [ignore]Underline[/ignore]

You can also disable processing of formatting tags by using {ignore}[ignore][/ignore]{/ignore} tags. For example: [ignore]Ignored http://example.com/ formatting.[/ignore]. Perhaps some of the more useful ones are [ignore][strike][/ignore] and so forth. There are some other improvements and additions made that the examples (above) don't fully describe. But, for the purpose of the 'goon forums, I think this is a relatively complete list that should cover some of the new additions.

I'll be updating the editor with a few new buttons, too, to make things a bit easier. This might be helpful to Turus on our policy page as well.

HTML Stripping

By default, all HTML is stripped. Right now, only a few tags are allowed (specifically the list-string is "b,code,i,u,pre,a,img,sub,sup,span,strike,hr"). I might alter this slightly, though, since I think all the useful tags are probably already covered here. HTML tags are also sanitized, meaning that attempts to override styles, add JavaScript calls, and so forth are removed. As will all release candidate software, this feature might not be perfect. But... it does a pretty respectable job.

Bugs

Piki is still in the release candidate phase for version 0.1. This means that there are bound to be bugs, and the best way to work them out is to use it. Most bugs will probably be due to browser quirks or my rather poor understanding of CSS, but in the case it's due to a Piki behavior, let me know.
I gave that lich a phylactery shard. Liches love phylactery shards.
User avatar
Zancarius
Site Admin
 
Posts: 3907
Joined: Wed Jul 05, 2006 3:06 pm
Location: New Mexico
Gender: Male

Postby Snobal » Thu Aug 16, 2007 7:21 am

Dude, Thal... as a guild, to you people over in destrealm we owe you so much... thanks a ton for this.



OMG DOW IS DOWN.... later that day...
OMG DOW IS UP OMG OMG OMG AHHHHHH
*calls stock man*


-_- darn old people and their stocks...
Image
Image
User avatar
Snobal
Officer
 
Posts: 1171
Joined: Wed Jul 05, 2006 7:48 pm
Location: This hell hole, Georgia
Gender: Not specified

Postby Zancarius » Thu Aug 16, 2007 9:58 am

Snobal wrote:Dude, Thal... as a guild, to you people over in destrealm we owe you so much... thanks a ton for this.


Lol! Thanks, Sno! Really, it isn't a marked improvement but it does make dealing with big screenshots a bit easier. If you haven't seen what I mean by this yet, take a look at your post to Carrix and you'll see a pretty good illustration of this feature at work. It doesn't work well in MSIE, though. It does work correctly in Firefox and Opera.
I gave that lich a phylactery shard. Liches love phylactery shards.
User avatar
Zancarius
Site Admin
 
Posts: 3907
Joined: Wed Jul 05, 2006 3:06 pm
Location: New Mexico
Gender: Male

Postby Snobal » Thu Aug 16, 2007 11:26 am

Pfft who needs IE anyways?
[Guild][Snobal]: <<< hates Microsoft... I know I know, bite me.
Image
Image
User avatar
Snobal
Officer
 
Posts: 1171
Joined: Wed Jul 05, 2006 7:48 pm
Location: This hell hole, Georgia
Gender: Not specified

Postby Grimblast » Fri Aug 17, 2007 4:47 am

Awesome job Thal!
Guild Wars 2 Characters
Turalia Gearspark - Asuran Engineer ----------- Turus Gearspark - Asuran Guardian
Thelena Turusian - Norn Warrior ---------------- Jake Turusian - Human Thief
Dililah Turusian - Norn Necromancer ------------ Rahl Braincrusher - Char Mesmer
Star Earthbreaker - Sylvari Elementalist -------- Rylo Preystalker - Char Ranger
User avatar
Grimblast
Site Admin
 
Posts: 2513
Joined: Wed Jul 05, 2006 3:21 pm
Location: Alamogordo, New Mexico
Gender: Male

Postby Zancarius » Fri Aug 17, 2007 5:29 am

Piki > phpBB'c BBCode parser.

Actually, the next revision will probably have a means of aligning pictures to the left or right (such that they float) so you can wrap text around them. A good example of this would be to take a peak at the layout of images on Wikipedia.
I gave that lich a phylactery shard. Liches love phylactery shards.
User avatar
Zancarius
Site Admin
 
Posts: 3907
Joined: Wed Jul 05, 2006 3:06 pm
Location: New Mexico
Gender: Male

Postby Zancarius » Mon Aug 20, 2007 3:27 pm

Well, as promised, the parser on the forums has been updated to allow for aligning pictures with BBCode-style syntax. This would appear something like the following:

[img float=left options=nowrap]http://forums.blackravendragoons.com/images/avatars/19233921644f64e1837990.jpg[/img] Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
[clear]

The code to generate this is:

Code: Select all
[b][color=red] [ignore][img float=left options=nowrap][/ignore][/color][/b]http://forums.blackravendragoons.com/images/avatars/19233921644f64e1837990.jpg[/img]
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
[clear][/ignore]


([icode]float[/icode] instructs the image to "float" to the left so that the text can settle next to it. [icode]options=nowrap[/icode] removes the image wrapper that provides a link to "view image," enable scrolling if the image is too large, and removes the outer border. [ignore][clear][/ignore] instructs the processor that any text below that point should be on its own line, "clearing" the floating image.)

(Also, in case you're curious, I found a fascinating article on the "Lorem Ipsum" text.)

If you're interested in reading about Piki's latest feature set, you can read the user's guide here.
I gave that lich a phylactery shard. Liches love phylactery shards.
User avatar
Zancarius
Site Admin
 
Posts: 3907
Joined: Wed Jul 05, 2006 3:06 pm
Location: New Mexico
Gender: Male

Postby Zancarius » Fri Nov 09, 2007 12:01 am

Bumping this because there were some bugs introduced when I altered the phpBB source. Preview now works in private messages (it was broken--oops!). The topic review shown at the bottom of each posting page no longer includes extra line breaks. I've also changed the font for the editor slightly; editing under X11 previously looked a bit weird due to differing font sizes.
I gave that lich a phylactery shard. Liches love phylactery shards.
User avatar
Zancarius
Site Admin
 
Posts: 3907
Joined: Wed Jul 05, 2006 3:06 pm
Location: New Mexico
Gender: Male

Postby Snobal » Fri Nov 09, 2007 6:40 am

Cool Thal, I suppose the preview issue with the private messages is simmilar to the preview problem I was having ages ago with regular posts. I haven't had that problem lately so I suppose it has been fixed. Thanks for the update :)
Image
Image
User avatar
Snobal
Officer
 
Posts: 1171
Joined: Wed Jul 05, 2006 7:48 pm
Location: This hell hole, Georgia
Gender: Not specified

Postby Zancarius » Fri Nov 09, 2007 11:00 am

I was actually never able to recreate the message preview posting problem you described with ordinary messages, so that issue is still outstanding and unexplained.
I gave that lich a phylactery shard. Liches love phylactery shards.
User avatar
Zancarius
Site Admin
 
Posts: 3907
Joined: Wed Jul 05, 2006 3:06 pm
Location: New Mexico
Gender: Male

Postby Snobal » Fri Nov 09, 2007 5:01 pm

When posting ghosties attack!
Image
Image
User avatar
Snobal
Officer
 
Posts: 1171
Joined: Wed Jul 05, 2006 7:48 pm
Location: This hell hole, Georgia
Gender: Not specified


Return to General Chat

Who is online

Users browsing this forum: No registered users and 10 guests

cron