BoltWire is a content management system developed by Dan Vis.

Welcome Tour
Mailing List

Popular Posts

Version 5.11 Released
May 26, 2016

Big Changes Coming Soon...
April 28, 2016

Catching Up
April 6, 2016

Other Sites

Here's some other sites by Dan Vis:

Alexa Echoes
Join my adventures developing for Amazons exciting new voice platform.

Firefly Spot
Personal rambling about new gadgets, technology news, and space travel.

FAST Missions
My ministry hub, with news and updates about our online school.

You can follow him at www.danvis.info.


Documentation > Concepts > Markups

Each time BoltWire loads, it creates a markup table which determines the markups to look for and the order they are processed. This markup table can be modified however you want. Here's how it works.

Defining the Table

The markup rules used in BoltWire are all defined in the top portion of markups.php. Each line looks like the following:

MarkUp('vars', 'member', '/\{\~([^{}+=* ]+)\}/e', "BOLTMmemberVar('$1')");

The markup function (found in library.php) assigns each an "order" (vars), a specific "rule" (member), a pattern to match (the regular expression), and the output. In this case, {~field} is sent to the memberVar function to retrieve a members data value.

Note: If you are not familiar with regular expressions, there are many fine tutorials online. However, it is not an easy topic.

When markup is processed, it runs through the markup table in the order it was generated, completing all the rules within an order before moving on to the next order.

The basic order of the markups in BoltWire is as follows:

PRE escapes, comments, boxes
VARS all kinds of vars
FUNC math expression, var and regular functions
IF conditionals
FORM conditional functions and form inputs
SYMBOLS   html entities, spaces, indents, hr, etc
LINKS all kinds, including images and citations
BULLETS ordered and unordered lists
STYLE fonts, colors, alignments, etc, and some HTML
BLOCK headers, tables, and nolines

For a peek at the full markup table, scroll down to the bottom of this page.

Changing the Markups

You can add a new markup rule by simply defining it using the syntax above and placing it in config.php. Make sure you assign it to the order you want and choose a unique rule name. The processing order is very important and you may have to experiment a bit to get just the right spot in the markup table.

Normally when you add a new rule, it is appended to the end of the order you specify. You can assign it a more exact position by specifying the markup rule it should precede. So setting a new rule's order to 'pre' and the rule to '<boxes', inserts it just after comments and just before boxes. If you use a new order, your rule will be added to the very end of the markup table.

To disable a rule you do not want, simply put this line in config.php or a plugin:

Markup('order', 'rule', '');

To modify an existing rule, say to change the syntax of some markup or point the markup to a custom function, just redefine it...

Markup('order', 'rule', '/new pattern/', 'new output');

Skins and Markups

When BoltWire loads a skin it processes markup in the following order:

1) Code zones like <<css>> are inserted.

2) Inline markup is processed in the skin, ie: =={somevar}==

3) Each zone is retrieved one at a time and run through the entire markup table. That is, the header zone is completely processed before the footer zone begins.

4) Skin settings are processed next (vars like {slogan} found in code.settings).

5) Next, [messages] are output.

6) Finally, any values in the replacetable, are processed.

Special Considerations

Several markups call the markup table directly:

Content within <box> ... </box> is run through the entire markup table and then escaped. If you want to limit processing within the box to certain rules, set a rules parameter to a csv list of the orders and/or specific rules you want to process.

The include function run the content it retrieves through the markup table before it is returned to the page. You can set the base page for this content to the page it is drawn from by setting baselinks=true.

When a list or search function defines a parameter, each page runs the template through the entire markup table and then returns it escaped. Fmt's simply return the output to the page and allows any markup in it to be processed along with the rest of the page. This makes fmts faster, but templates more versatile.

Markup Table

Here's a look at the default markup table in BoltWire.

Here is the BoltWire code for the markup table:

MarkUp('pre', 'escape', '/\`(.){1}/se', "BOLTescape('$1')");  // `escape char
MarkUp('pre', 'nomarkup', '/\/\=(.*?)\=\//se', "BOLTcharEncode(BOLTstripSlashes('$1'))");  // /=no markup=/
MarkUp('pre', 'comments', '/(?<=[^\/]|^)\/\*[^\*](.*?)[^\*]\*\/(?=[^\/]|$)/s', '');  // / *comments* /
MarkUp('pre', 'boxes', '/(<|&lt;)(box|html|code|markup|debug)( .*?)?>(.*?)(<|&lt;)\/\2>/sie', "BOLTMbox('$3', '$4', '$2')");  // <box,html,code,markup rules='', lines=false>

MarkUp('vars', 'request', '/\{\?([.-_a-zA-Z0-9]+)\}/e', "BOLTMrequest('$1')");  // {?var}
MarkUp('vars', 'var', '/\{([^~{}()+=*:$ ]+)\}/e', "BOLTvars('$1')");  // {var}
MarkUp('vars', 'var2', '/\{([^~{}()+=*$ ]+)\}/e', "BOLTvars('$1')");  // {page:var}
MarkUp('vars', 'var3', '/\{([^~{}()+=$ ]+)\}/e', "BOLTvars('$1')");  // {page:var}
MarkUp('vars', 'member',  '/\{\~([^{}+=*$ ]+)\}/e', "BOLTMmemberVar('$1')");  // {~var}

MarkUp('func', 'vars', '/\{\((.*?)\)\}/e', "BOLTMfunc('$1')");  // {(func params)}
MarkUp('func', 'math', '/\{ ([\-\+\*\/\.0-9\(\)]+) \}/e', "BOLTMfunc('math $1')");  // { 1+1 }
MarkUp('func', 'func', '/\[\((.*?)\)\]/e', "BOLTMfunc('$1')");  // [(func params)]

MarkUp('if', 'if', '/\[(if|else)(.*?)\]/se', "BOLTMif('$1', '$2')");  // [if]
MarkUp('if', 'true', '/\^true([0-9]{1}) (.*?)\^(.*?)\^true\1\^/se', "BOLTMifnest('$2', '$3')");

MarkUp('form', 'func', '/(&lt;|<)\((.*?)\)(&gt;|>)/e', "BOLTMfunc('$2')");  // <(func params)>
MarkUp('form', 'inputs', '/(\n?)\[(form|command|text|check|radio|password|hidden|select|option|optgroup|box|file|button|submit|reset|image)(( {1,2}([-_a-z0-9]+=)?([-_a-z0-9]+\[\]|\"[^\"]*\"|\'[^\']*\'|[^\] ]+))*)? ?\]/ie', "BOLTMinputs('$2', '$3', '$1')");  // form and all inputs

MarkUp('symbols', 'symbol', '/\((\w{1,2})\)/e', "BOLTMsymbol('$1')");
MarkUp('symbols', 'entities', '/&amp;([a-z0-9]+|#\\d+|#[x][a-f0-9]+);/i', '&$2;');
MarkUp('symbols', 'spaces', '/([ ]{3,}|[\t]+|[\n]{3,})/e', "BOLTMspacing('$1')");  // spaces, tabs, and linebreaks
MarkUp('symbols', 'indent1', '/\-\>/', "<blockquote>"); // -> <- indent (blockquote)
MarkUp('symbols', 'indent2', '/(&lt;|<)\-/', "</blockquote>"); // -> <- indent (blockquote)
MarkUp('symbols', 'hr', '/^\-\-\-\-$/m', "\n<hr />\n"); // ---- horizontal line
MarkUp('symbols', 'translate', '/\+\+(.+?)\+\+/me', "BOLTtranslate('$1', '')"); // ++translated text++

MarkUp('links', 'uploads', '/\[\^(.*?)\^\]/e', "BOLTMuploads('$1')"); // [^ ^] upload
MarkUp('links', 'image', '/(img|link)\:(([-_a-zA-Z0-9\/\:\.]+)\.('.$uploadImgTypes.'))/e', "BOLTMuploads('$2')");  // img:file.gif
MarkUp('links', 'files', '/(file|link)\:(([-_a-zA-Z0-9\/\:\.]+)\.('.$uploadFileTypes.'))/e', "BOLTMuploads('$2')");  // file:file.pdf
MarkUp('links', 'links', '/\[\[(.*?)\]\]/e', "BOLTMlinks('$1')");  // [[ ]]
MarkUp('links', 'urls', '/\:\/\/([a-z0-9]+)/ei', "BOLTescape('://$1')");  //used to so links not italicized

MarkUp('bullets', 'bullets', '/(^|\n)((([*#=]+ )(.*?)(\n|$))+)/e', "BOLTMbullets('$2')"); // list block

// shouldn't need box, p, a. Probably not  ul ol or li...  Just have div and span
MarkUp('style', 'style', '/&lt;(\/)?(div|p|span|a|ul|ol|li|blockquote)( .*?)?\>/ie', "BOLTMstyles('$2', '$3', '$1')");
MarkUp('style', 'fonts', '/((\*|\/|\_|\||@|#)(\2+))(.+?)(\1|$)/me', "BOLTMfontstyles('$1', '$4')");  // Misc shortcuts *Bo/It_Un|Hi@Sp#Bx...
MarkUp('style', 'color', '/&lt;(color|highlight)\=[\'"]?([a-zA-Z0-9\#]{3,25})[\'"]?>(.*?)&lt;\/\1>/sie', "BOLTMspandivs('$1', '$2', '$3')"); // <color=red> or <highlight=green>
MarkUp('style', 'size', '/&lt;size\=[\'"]?([a-zA-Z0-9\%]{1,9})[\'"]?>(.*?)&lt;\/size>/sie', "BOLTMspandivs('size', '$1', '$2')"); // <size=125%>
MarkUp('style', 'align', '/&lt;(left|right|center|justify)>(.*?)&lt;\/\1>/sie', "BOLTMspandivs('align', '$1', '$2')");; // left, right, center
MarkUp('style', 'text', '/(&lt;|<)text ([^>]+)?>(.+?)(&lt;|<)\/text>/se', "BOLTMtexttools('$2', '$3')"); // <text substring=1,2> etc
MarkUp('style', 'html', '/&lt;([\/]?)([a-z0-9]+)( ?\/)?>/ie', "BOLTMhtml('$1', '$2', '$3')");  // allowed html
MarkUp('style', 'tags', '/([^\#\[\'\"\=\:]\#([a-z]{1}[a-z0-9]*))\b/ei', "BOLTMtags('$1')");

MarkUp('block', 'headers', '/^(!{1,3})(.*)/me', "BOLTMheaders('$1', '$2')");
MarkUp('block', 'table', '/\[([trch])([1-9]?)( .*?)?\]/ie', "BOLTMtables('$1', '$3', '$2')");  // [t] [r] [c]
MarkUp('block', 'nolines', '/(&lt;|<)nolines(&gt;|>)(.*)\1\/nolines\2/Use', "BOLTnolines('$3')");  // <nolines>

//MarkUp('debug', 'debug', '/~~DEBUG~~/ei', 'die()');

To leave a comment, please login using your Facebook account: