Author

Topic: BBC++ (Read 3210 times)

legendary
Activity: 1246
Merit: 1077
July 23, 2013, 09:25:28 PM
#1
BBC++

Table of Contents

Description
I'm currently working on a compiler to simplify writing long posts on these forums. The goal is to take often-used idioms in BitcoinTalk bbcode and simplify them by introducing new tags and syntax.

Features
Preprocessor directives
The compiled code can be commented with the [!!] pseudo-tag, which is actually a preprocessor directive. This is currently the only preprocessor directive, though some tags such as [nobbc], [code], and [icode] are handled by the preprocessor.

Postprocessor directives
There are also some postprocessor directives. [!break] tags are useful for long posts. They can separate a single post into multiple posts, which can then be posted in a row to circumvent the SMF character limit. [!include=X] tags should not be written by the user; they are generated automatically by the preprocessor. [!ls] and [!rs] tags are escaped forms of the [ and ] tags. Direct usage of these is not recommended because it may look ugly; instead, the [nobbc] tag should be used. [!tag=X] is just a shortcut syntax for [icode][X][/icode]. It simplifies writing about BBC++ or regular BBC, and this description makes judicious use of it.

Tags
So far, I've added a few tags I deem useful. There are still tags that I hope to add in the future (easier-to-use tables, etc.).

[#] is a convenient tag to link to an anchor. Simply use [#=top]Back to Top[/#], for example, to go to the anchor “top”. Try it!

[bgcolor] is a shortcut for using the [glow] tag. Because the syntax for glow is odd, this tag will make things easier (its syntax is identical to that of [color]).

[h1], [h2], [h3], [h4] tags have been added. These tags can take an optional parameter, which adds an anchor. This can be seen with the first heading on this page, which this link should lead to. Note that these tags are not “real headings”, so they will not appear on the page outline.

[icode] tags are easier ways to include code inside a line. The default [code] tags do not do this job well because they force line-breaks, and the default [tt] tags do not escape BBCode tags.

The [latex] tag makes including mathematics in BitcoinTalk posts a million times easier. Just using [latex]{1+2} \over 4[/latex], for example, produces .

[mxbt] tags are an extension to the forum's default [btc] syntax. They offer ease of use with the [mxbt=xxx] syntax. For example, [mxbt=100] produces 100 mBTC. Note that the compiler automatically inserts a non-breaking narrow space to increase aesthetics of your price labels.

The [nb] tag is just a convenient way to include important notices. It will automatically style the notice and add “NB:” for you.

[now] tags have no end tag and simply display the date of posting in the reader's timezone. [now] produces July 29, 2013, 09:21:50 PM. What purpose does this serve? Well, it allows a “Last updated: July 29, 2013, 09:21:50 PM” header, which would automatically update upon edit.

[q] tags are just an easier way to type out “smart” quotation marks. [q]Hello[/q] produces, as you would expect, “Hello”.

[ref] and [^ref] tags[1] can be used as a flexible[2] referencing system[3], allowing citations to be created inline[4] and also allowing usage of the same source[1] more than once[3]. The syntax is quite flexible. The general form is as follows:
Code:
[ref]XXX[/ref]: just a plain reference.
[ref=XXX]XXX[/ref]: a url reference.
[ref=^XXX]XXX[/ref]: a plain, named reference.
[ref=XXX^XXX]XXX[/ref]: a named url reference.
[^ref=XXX]: include a named reference.

[refs] tags include the list of references. Like this:

[toc] tags create a table of contents based on your heading structure. The format of these tables is extremely basic at the moment; better aesthetics will be added later. It is possible to specify which heading level to start at with the [toc=X] syntax (the default level, 1, means that all headings over level 1 will be displayed). Usage of such is not recommended, as it is very confusing and will potentially create multiple lists.

[toc_entry] tags allow one to create fake headings that have table of content entries, but no heading style. Use of these tags is strongly discouraged, as they may be confusing to the post reader. The syntax is [toc_entry=X]name[/toc_entry], where X represents the heading level and name the name to be used in the table of contents.

[topic] tags are easier ways to link to other BitcoinTalk topics. [topic=10000]Topic #10000[/topic] will link to topic #10000.

[utc] tags take a UTC datetime and display it as a date in the reader's timezone. For example, [utc]2013-01-01T05:00:20[/utc] displays as January 01, 2013, 05:00:20 AM.

[xbt] tags are similar to the aforementioned [mxbt] tag, but are provided for the holdouts who insist on using a currency unit worth more than the world's top 10 combined.

Call for comments
The compiler, although useful enough to write this post in, is far from done. I would like to make a better [table] tag, as the current SMF one is nigh impossible to use.

Eventually, I hope to port the compiler (currently written in Javascript) to Greasemonkey's user-script system. This will allow users to compile code as they post, with the "preview" and "post" buttons automatically compiling before the post is sent. In addition, the user-script should save raw BBC++ for the user's post, so editing can be done with BBC++.

But before I do any of this, I want to make sure upgrading to BBC++ is worthwhile. Therefore, I am asking for the comments of fellow BitcoinTalk users. What do you find most excruciating about SMF's BBCode? What feature would convince you to get the user-script?
Jump to: