Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Towards a better BBCode

Name: !Xarn.JCoew 2010-05-24 20:28

cairnarvon@feynman:~$ cat hello.txt
Hello {spoiler /prog/}.

What do you think of my {sup new} syntax for {i {sup B}{sub B}code} based on S-expressions? It supports {b.i.u function composition} and {sup*2 iteration {sub*3 (and nesting, obviously)}}. It uses curly braces {m \{\}} rather than the traditional {b (}parentheses{b )} because that will require less escaping.

{aa No more unmatched or misnested tags!}

I've written a {spoiler.i terrible} FIOC {i.m SexpCode-to-BBCode} translator, which you can find here: http://sprunge.us/KPWB?py
cairnarvon@feynman:~$ python sexpcode.py < hello.txt
Hello [spoiler]/prog/[/spoiler].

What do you think of my [sup]new[/sup] syntax for [i][sup]B[/sup][sub]B[/sub]code[/i] based on S-expressions? It supports [b][i][u]function composition[/u][/i][/b] and [sup][sup]iteration [sub][sub][sub](and nesting, obviously)[/sub][/sub][/sub][/sup][/sup]. It uses curly braces [m]{}[/m] rather than the traditional [b]([/b]parentheses[b])[/b] because that will require less escaping.

[aa]No more unmatched or misnested tags![/aa]

I've written a [spoiler][i]terrible[/i][/spoiler] FIOC [i][m]SexpCode-to-BBCode[/m][/i] translator, which you can find here: http://sprunge.us/KPWB?py


Hello /prog/.

What do you think of my new syntax for BBcode based on S-expressions? It supports function composition and iteration (and nesting, obviously). It uses curly braces {} rather than the traditional (parentheses) because that will require less escaping.

No more unmatched or misnested tags!

I've written a terrible FIOC SexpCode-to-BBCode translator, which you can find here: http://sprunge.us/KPWB?py

Name: Anonymous 2010-05-24 21:46

>>13
it's the fact that explicit closing tags make it far more error-prone.

So you want a universal close tag that closes any open BBCode tag?

BBCode parsers can already be coded to not allow broken BBCode to be parsed. But I see what you are saying.

I'm thinking about this in my head right now, and it seems like would be harder to make a BBCode parser that uses a universal close tag. Or maybe not. I'm not sure, I'd need to think it through.

Name: Anonymous 2010-05-24 21:48

>>12
No, the submit function should sanitize the HTML properly, just like a well-written text processor would do with any markup.

I should point out that shitchan doesn't bother sanitizing anything, and that's why we get garbage like the entire board being rendered in italics. You can have problems with any markup format if you're a piss-poor programmer who doesn't bother doing things properly.

As for the close-tag redundancy: I don't see anything inherently error-prone or disadvantageous with it, personally. Yes, it's a bit more verbose, and that's annoying, but any decent editor could easily support auto-completing closing tags (say, by filling in the most recently opened tag when typing </), and the redundancy is occasionally extremely useful for catching accidentally mis-nested tags and identifying why some block of text is showing up in the middle of nowhere at the bottom of the page.

I think it's unfortunate that the shorter SGML syntax (the <b/something/ style) has faded into obscurity; it would be nice to have something like that for the simple cases when nested tags and other such complexity isn't necessary.

>>14
Markdown is generally not very useful, in the same way that every attempt to make writing HTML "simpler" also usually turns out badly. Just write the damn HTML and get it over with.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List