TracWiki =
TracWiki is a TracWiki-to-HTML converter for Trac wiki, trac.edgewall.org/wiki/WikiFormatting.
Project page on github:
INSTALLATION ==
gem install trac-wiki
SYNOPSIS ==
require 'trac-wiki'
html = TracWiki.render('== TracWiki text ==')
# or
html = TracWiki.render('== TracWiki text ==', )
parser = TracWiki.parser()
parser.to_html(text1)
parser.to_html(text2)
Options ==
-
allowed_schemesAllowed url schemes Examples: http https ftp ftps -
basebase URL (or URI), for link and images -
no_escapeDisable url escaping for local links Escaping: [[/Test]] --> %2FTest No escaping: [[/Test]] --> Test -
no_linkDisable url escaping for local links `[[whatwerver]]` stays `[[whatwerver]]` -
mathmath syntax extension: $e^x$ for inline math, $$ e^x $$ for display math -
allow_htmlallow some <b> <form> <html> html will be sanitized -
edit_headingadd '<a class='editheading' href="?edit=N>edit</a>' to each heading -
mergeunderstand merge tags (see diff3(1)) >>>>>>> mine ||||||| orig ======= <<<<<<< yours convert to <div class="merge merge-mine">mine</div> -
id_from_headingevery heading had id, generated from heading text -
id_translitwhen `id_from_heading`, non ascii char are transliterated to ascii (Těžiště -> Teziste) -
template_handlertemplate_handler(macroname) -> template_text when macros enabled and {{myCoolMacro}} ocured, result fo `template_handler('myCoolMacro') inserted -
macrosenable macros|templates (in mediawiki style). macros are in form `{{macro_name | arg1 | arg2 }}` -
macro_commandslike template but more powerfull do no use.
Other parser attributes and functions ==
-
parser.headingsstructure where headings are stored (after parse) list of hasheses with `level` and `title`, `sline` [ { leven: 1, # <h1> sline: 3, # line where head starts eline: 4, # line before next heading starts aname: 'anchor-to-this-heading', title: 'heading title' }, ... ] -
parser.was_math?if math (inline or dispayed) was parsed. -
parser.make_toc_htmlcreate html toc from previously parsed text -
‘parser.add_macro_command(name, &block)`
-
‘parser.env.(env|at(key))`
access to env values after parse
Macros ==
-
‘{template}`
-
‘{$variable}`
* can be set by {{!set variable|value}} * `$1`, `$2` parameters send to template {{template ONE|TWO}} * parameters send to template can be named {{template ahoj=test|hi=west}} * `$0` all parameters (without named) * `$00` all parameters (with named) -
‘par1}` is expanded to `unknown_macro|par1}`,
you have to specify `uknmacro` macro. If not, error strig `UNKNOWN-MACRO(unkmacro)` is generated. -
‘{!command}`
BUGS ==
If you found a bug, please report it at the TracWiki project’s tracker on GitHub:
github.com/vitstradal/trac-wiki/issues
AUTHORS ==
-
Vitas Stradal
LICENSE ==
GPL