A couple proposed GTX0 parser changes
Posted: Posted November 5th, 2017Edited November 5th, 2017 by Xhin
GTX0 will be able to support multiple parsers:
The current parser, which will become "the old parser"
The new parser, which I'm planning the syntax of here
Anything else depending on which platform we're advertising to.
Parser support will be on a per-post basis. Anything before GTX0 on the new parser launch date will be tied to the old parser. Imported posts from other platforms will use whatever their parser is.
Users can set their parser preference. However only the new GTX0 parser will be actively worked on, aside from fixing bugs in other parsers.
Syntax of the new parser
Symbol-initial syntax (!!=blue, =, >, *=, ``, etc) is unusually useful and will be kept.
Tags will be case-insensitive.. for example you can use [img] or [IMG], or [Img] even. Should make mobile rendering easier.
Tags can have options in any order.. these are known as "Arguments". The [table] tag already makes use of this:
[table top left]
[table left top]
Arguments are also case-insensitive, though their arguments are not.
Arguments can have their own options, in which case they're known as "Subtags" and "Subarguments". for example:
would make the same image scale up to 500px or 80% of the screen respectively. The arguments for the first one are "width:500". "width" is a subtag, and "500" is a subargument.
If subarguments have a space in them, you can surround them in quotes:
[quote user:"I killed Mufasa"]
Some subtags are universal. width for example should work with *any* tag.
Tags should be recursive.. like you can have a [quote] inside of a [quote]. This might take some time to set up though.
Tags can occasionally have a "quickcode" for common subtags. This allows you to put subarguments one after another without the actual subtags. These subarguments are separated by colons. The [doc] tag is already like this:
This is a shorthand for either:
[doc format:ru delim:()]
[doc delim:() format:ru]
if that tag was on the new system.
All tags with multiple subtags should have a quickcode of some kind for faster use.
The [font] tag
The [font] tag replaces [b], [i], [ha] etc, color tags like [e], [ru], etc, and also allows you more flexibility with fonts and colors. If this seems unnecessarily inconvenient, read the next two sections.
Here are some subtags of the font tag though:
bg:X -- changes the background color
color:X -- changes the foreground color
font:X -- changes the font family
size:X -- changes the font size
bold -- makes it bold
italic -- makes it italic
underline -- makes it underlined
So for example, [font family:Comic-sans bold color:050 bg:222] would make a green verdana-fonted bold block of text with a gray background.
Again, read the next two sections if this seems like it's making things harder.
The GTX0 parser will be able to support parser plugins, which is where you get to keep tags like [b], [ha], [e], etc. The ones that come from the old parser will be turned on by default, though there might be a reason you would want to disable them.
There might be other parser plugins introduced which would probably be off by default.
This allows you to set your own shortcuts for tags. For example, you could set [a] to mean [font font:Comic-sans bg:222 color:050 bold].
Then for you and only you you would be able to use [a][/a] to make sections formatted that way.
This is why you might want to disable existing codes like [b], they kind of take up a lot of room.
These quicktags actually get saved in the database as the full tag, but you can edit the post and they'll look like the quicktag. So other users won't see your quicktags if they try to edit your post.
Quicktags work with the [doc] tag.. so you could do [doc:a:()] and then be able to surround pieces of text with parentheses to give them that unique formatting.
New tags, new arguments
When this parser launches I'll be able to add a bunch more tags and arguments to the system that you guys haven't seen previously, like the [quote user:X] thing I pointed out above.
There are 2 Replies