PageRenderTime 71ms CodeModel.GetById 28ms RepoModel.GetById 1ms app.codeStats 1ms

/markup/txt2tags.py

https://bitbucket.org/fgallaire/tornablog
Python | 5678 lines | 5118 code | 218 blank | 342 comment | 221 complexity | 48a2e3351921a057493fab5baa96a4a5 MD5 | raw file
Possible License(s): AGPL-3.0

Large files files are truncated, but you can click here to view the full file

  1. #!/usr/bin/env python
  2. # txt2tags - generic text conversion tool
  3. # http://txt2tags.sf.net
  4. #
  5. # Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Aurelio Jargas
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, version 2.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You have received a copy of the GNU General Public License along
  17. # with this program, on the COPYING file.
  18. #
  19. ########################################################################
  20. #
  21. # BORING CODE EXPLANATION AHEAD
  22. #
  23. # Just read it if you wish to understand how the txt2tags code works.
  24. #
  25. ########################################################################
  26. #
  27. # The code that [1] parses the marked text is separated from the
  28. # code that [2] insert the target tags.
  29. #
  30. # [1] made by: def convert()
  31. # [2] made by: class BlockMaster
  32. #
  33. # The structures of the marked text are identified and its contents are
  34. # extracted into a data holder (Python lists and dictionaries).
  35. #
  36. # When parsing the source file, the blocks (para, lists, quote, table)
  37. # are opened with BlockMaster, right when found. Then its contents,
  38. # which spans on several lines, are feeded into a special holder on the
  39. # BlockMaster instance. Just when the block is closed, the target tags
  40. # are inserted for the full block as a whole, in one pass. This way, we
  41. # have a better control on blocks. Much better than the previous line by
  42. # line approach.
  43. #
  44. # In other words, whenever inside a block, the parser *holds* the tag
  45. # insertion process, waiting until the full block is read. That was
  46. # needed primary to close paragraphs for the XHTML target, but
  47. # proved to be a very good adding, improving many other processing.
  48. #
  49. # -------------------------------------------------------------------
  50. #
  51. # These important classes are all documented:
  52. # CommandLine, SourceDocument, ConfigMaster, ConfigLines.
  53. #
  54. # There is a RAW Config format and all kind of configuration is first
  55. # converted to this format. Then a generic method parses it.
  56. #
  57. # These functions get information about the input file(s) and take
  58. # care of the init processing:
  59. # get_infiles_config(), process_source_file() and convert_this_files()
  60. #
  61. ########################################################################
  62. #XXX Python coding warning
  63. # Avoid common mistakes:
  64. # - do NOT use newlist=list instead newlist=list[:]
  65. # - do NOT use newdic=dic instead newdic=dic.copy()
  66. # - do NOT use dic[key] instead dic.get(key)
  67. # - do NOT use del dic[key] without has_key() before
  68. #XXX Smart Image Align don't work if the image is a link
  69. # Can't fix that because the image is expanded together with the
  70. # link, at the linkbank filling moment. Only the image is passed
  71. # to parse_images(), not the full line, so it is always 'middle'.
  72. #XXX Paragraph separation not valid inside Quote
  73. # Quote will not have <p></p> inside, instead will close and open
  74. # again the <blockquote>. This really sux in CSS, when defining a
  75. # different background color. Still don't know how to fix it.
  76. #XXX TODO (maybe)
  77. # New mark or macro which expands to an anchor full title.
  78. # It is necessary to parse the full document in this order:
  79. # DONE 1st scan: HEAD: get all settings, including %!includeconf
  80. # DONE 2nd scan: BODY: expand includes & apply %!preproc
  81. # 3rd scan: BODY: read titles and compose TOC info
  82. # 4th scan: BODY: full parsing, expanding [#anchor] 1st
  83. # Steps 2 and 3 can be made together, with no tag adding.
  84. # Two complete body scans will be *slow*, don't know if it worths.
  85. # One solution may be add the titles as postproc rules
  86. ##############################################################################
  87. # User config (1=ON, 0=OFF)
  88. USE_I18N = 1 # use gettext for i18ned messages? (default is 1)
  89. COLOR_DEBUG = 1 # show debug messages in colors? (default is 1)
  90. BG_LIGHT = 0 # your terminal background color is light (default is 0)
  91. HTML_LOWER = 0 # use lowercased HTML tags instead upper? (default is 0)
  92. ##############################################################################
  93. # These are all the core Python modules used by txt2tags (KISS!)
  94. import re, os, sys, time, getopt
  95. # Program information
  96. my_url = 'http://txt2tags.sf.net'
  97. my_name = 'txt2tags'
  98. my_email = 'verde@aurelio.net'
  99. my_version = '2.6b'
  100. # i18n - just use if available
  101. if USE_I18N:
  102. try:
  103. import gettext
  104. # If your locale dir is different, change it here
  105. cat = gettext.Catalog('txt2tags',localedir='/usr/share/locale/')
  106. _ = cat.gettext
  107. except:
  108. _ = lambda x:x
  109. else:
  110. _ = lambda x:x
  111. # FLAGS : the conversion related flags , may be used in %!options
  112. # OPTIONS : the conversion related options, may be used in %!options
  113. # ACTIONS : the other behavior modifiers, valid on command line only
  114. # MACROS : the valid macros with their default values for formatting
  115. # SETTINGS: global miscellaneous settings, valid on RC file only
  116. # NO_TARGET: actions that don't require a target specification
  117. # NO_MULTI_INPUT: actions that don't accept more than one input file
  118. # CONFIG_KEYWORDS: the valid %!key:val keywords
  119. #
  120. # FLAGS and OPTIONS are configs that affect the converted document.
  121. # They usually have also a --no-<option> to turn them OFF.
  122. #
  123. # ACTIONS are needed because when doing multiple input files, strange
  124. # behavior would be found, as use command line interface for the
  125. # first file and gui for the second. There is no --no-<action>.
  126. # --version and --help inside %!options are also odd
  127. #
  128. TARGETS = 'html xhtml sgml dbk tex lout man mgp wiki gwiki doku pmw moin pm6 txt art adoc'.split()
  129. FLAGS = {'headers' :1 , 'enum-title' :0 , 'mask-email' :0 ,
  130. 'toc-only' :0 , 'toc' :0 , 'rc' :1 ,
  131. 'css-sugar' :0 , 'css-suggar' :0 , 'css-inside' :0 ,
  132. 'quiet' :0 }
  133. OPTIONS = {'target' :'', 'toc-level' :3 , 'style' :'',
  134. 'infile' :'', 'outfile' :'', 'encoding' :'',
  135. 'config-file':'', 'split' :0 , 'lang' :'',
  136. 'show-config-value':'', 'ascii-art' :''}
  137. ACTIONS = {'help' :0 , 'version' :0 , 'gui' :0 ,
  138. 'verbose' :0 , 'debug' :0 , 'dump-config':0 ,
  139. 'dump-source':0 }
  140. MACROS = {'date' : '%Y%m%d', 'infile': '%f',
  141. 'mtime': '%Y%m%d', 'outfile': '%f'}
  142. SETTINGS = {} # for future use
  143. NO_TARGET = ['help', 'version', 'gui', 'toc-only', 'dump-config', 'dump-source']
  144. NO_MULTI_INPUT = ['gui','dump-config','dump-source']
  145. CONFIG_KEYWORDS = [
  146. 'target', 'encoding', 'style', 'options', 'preproc','postproc',
  147. 'guicolors']
  148. TARGET_NAMES = {
  149. 'html' : _('HTML page'),
  150. 'xhtml': _('XHTML page'),
  151. 'sgml' : _('SGML document'),
  152. 'dbk' : _('DocBook document'),
  153. 'tex' : _('LaTeX document'),
  154. 'lout' : _('Lout document'),
  155. 'man' : _('UNIX Manual page'),
  156. 'mgp' : _('MagicPoint presentation'),
  157. 'wiki' : _('Wikipedia page'),
  158. 'gwiki': _('Google Wiki page'),
  159. 'doku' : _('DokuWiki page'),
  160. 'pmw' : _('pmWiki page'),
  161. 'moin' : _('MoinMoin page'),
  162. 'pm6' : _('PageMaker document'),
  163. 'txt' : _('Plain Text'),
  164. 'art' : _('Ascii Art'),
  165. 'adoc' : _('AsciiDoc'),
  166. }
  167. DEBUG = 0 # do not edit here, please use --debug
  168. VERBOSE = 0 # do not edit here, please use -v, -vv or -vvv
  169. QUIET = 0 # do not edit here, please use --quiet
  170. GUI = 0 # do not edit here, please use --gui
  171. AUTOTOC = 1 # do not edit here, please use --no-toc or %%toc
  172. AA_LCHARS = ['coin','line','border','bar1','bar2','level2','level3','level4','level5']
  173. AA_CHARS = dict(zip(AA_LCHARS,'+-|-==-^"')) # do not edit here, please use --ascii-art or -a
  174. RC_RAW = []
  175. CMDLINE_RAW = []
  176. CONF = {}
  177. BLOCK = None
  178. regex = {}
  179. TAGS = {}
  180. rules = {}
  181. lang = 'english'
  182. TARGET = ''
  183. STDIN = STDOUT = '-'
  184. MODULEIN = MODULEOUT = '-module-'
  185. ESCCHAR = '\x00'
  186. SEPARATOR = '\x01'
  187. LISTNAMES = {'-':'list', '+':'numlist', ':':'deflist'}
  188. LINEBREAK = {'default':'\n', 'win':'\r\n', 'mac':'\r'}
  189. # Platform specific settings
  190. LB = LINEBREAK.get(sys.platform[:3]) or LINEBREAK['default']
  191. VERSIONSTR = _("%s version %s <%s>")%(my_name,my_version,my_url)
  192. USAGE = '\n'.join([
  193. '',
  194. _("Usage: %s [OPTIONS] [infile.t2t ...]") % my_name,
  195. '',
  196. _(" -t, --target=TYPE set target document type. currently supported:"),
  197. ' %s,' % ', '.join(TARGETS[:8]),
  198. ' %s' % ', '.join(TARGETS[8:]),
  199. _(" -i, --infile=FILE set FILE as the input file name ('-' for STDIN)"),
  200. _(" -o, --outfile=FILE set FILE as the output file name ('-' for STDOUT)"),
  201. _(" -H, --no-headers suppress header, title and footer contents"),
  202. _(" --headers show header, title and footer contents (default ON)"),
  203. _(" --encoding=ENC set target file encoding (utf-8, iso-8859-1, etc)"),
  204. _(" --style=FILE use FILE as the document style (like HTML CSS)"),
  205. _(" --css-sugar insert CSS-friendly tags for HTML and XHTML targets"),
  206. _(" --css-inside insert CSS file contents inside HTML/XHTML headers"),
  207. _(" --mask-email hide email from spam robots. x@y.z turns <x (a) y z>"),
  208. _(" --toc add TOC (Table of Contents) to target document"),
  209. _(" --toc-only print document TOC and exit"),
  210. _(" --toc-level=N set maximum TOC level (depth) to N"),
  211. _(" -n, --enum-title enumerate all titles as 1, 1.1, 1.1.1, etc"),
  212. _(" -a, --ascii-art=S set the ascii art chars with the string S. in the order:"),
  213. ' %s' % ', '.join(AA_LCHARS),
  214. _(" -C, --config-file=F read config from file F"),
  215. _(" --rc read user config file ~/.txt2tagsrc (default ON)"),
  216. _(" --gui invoke Graphical Tk Interface"),
  217. _(" -q, --quiet quiet mode, suppress all output (except errors)"),
  218. _(" -v, --verbose print informative messages during conversion"),
  219. _(" -h, --help print this help information and exit"),
  220. _(" -V, --version print program version and exit"),
  221. _(" --dump-config print all the config found and exit"),
  222. _(" --dump-source print the document source, with includes expanded"),
  223. '',
  224. _("Turn OFF options:"),
  225. " --no-outfile, --no-infile, --no-style, --no-encoding, --no-headers",
  226. " --no-toc, --no-toc-only, --no-mask-email, --no-enum-title, --no-rc",
  227. " --no-css-sugar, --no-css-inside, --no-quiet, --no-dump-config",
  228. " --no-dump-source",
  229. '',
  230. _("Example:\n %s -t html --toc myfile.t2t") % my_name,
  231. '',
  232. _("By default, converted output is saved to 'infile.<target>'."),
  233. _("Use --outfile to force an output file name."),
  234. _("If input file is '-', reads from STDIN."),
  235. _("If output file is '-', dumps output to STDOUT."),
  236. '',
  237. 'http://txt2tags.sourceforge.net',
  238. ''
  239. ])
  240. ##############################################################################
  241. # Here is all the target's templates
  242. # You may edit them to fit your needs
  243. # - the %(HEADERn)s strings represent the Header lines
  244. # - the %(STYLE)s string is changed by --style contents
  245. # - the %(ENCODING)s string is changed by --encoding contents
  246. # - if any of the above is empty, the full line is removed
  247. # - use %% to represent a literal %
  248. #
  249. HEADER_TEMPLATE = {
  250. 'art':"""
  251. Fake template to respect the general process.
  252. """,
  253. 'txt': """\
  254. %(HEADER1)s
  255. %(HEADER2)s
  256. %(HEADER3)s
  257. """,
  258. 'sgml': """\
  259. <!doctype linuxdoc system>
  260. <article>
  261. <title>%(HEADER1)s
  262. <author>%(HEADER2)s
  263. <date>%(HEADER3)s
  264. """,
  265. 'html': """\
  266. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  267. <HTML>
  268. <HEAD>
  269. <META NAME="generator" CONTENT="http://txt2tags.sf.net">
  270. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=%(ENCODING)s">
  271. <LINK REL="stylesheet" TYPE="text/css" HREF="%(STYLE)s">
  272. <TITLE>%(HEADER1)s</TITLE>
  273. </HEAD><BODY BGCOLOR="white" TEXT="black">
  274. <CENTER>
  275. <H1>%(HEADER1)s</H1>
  276. <FONT SIZE="4"><I>%(HEADER2)s</I></FONT><BR>
  277. <FONT SIZE="4">%(HEADER3)s</FONT>
  278. </CENTER>
  279. """,
  280. 'htmlcss': """\
  281. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  282. <HTML>
  283. <HEAD>
  284. <META NAME="generator" CONTENT="http://txt2tags.sf.net">
  285. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=%(ENCODING)s">
  286. <LINK REL="stylesheet" TYPE="text/css" HREF="%(STYLE)s">
  287. <TITLE>%(HEADER1)s</TITLE>
  288. </HEAD>
  289. <BODY>
  290. <DIV CLASS="header" ID="header">
  291. <H1>%(HEADER1)s</H1>
  292. <H2>%(HEADER2)s</H2>
  293. <H3>%(HEADER3)s</H3>
  294. </DIV>
  295. """,
  296. 'xhtml': """\
  297. <?xml version="1.0"
  298. encoding="%(ENCODING)s"
  299. ?>
  300. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\
  301. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  302. <html xmlns="http://www.w3.org/1999/xhtml">
  303. <head>
  304. <title>%(HEADER1)s</title>
  305. <meta name="generator" content="http://txt2tags.sf.net" />
  306. <link rel="stylesheet" type="text/css" href="%(STYLE)s" />
  307. </head>
  308. <body bgcolor="white" text="black">
  309. <div align="center">
  310. <h1>%(HEADER1)s</h1>
  311. <h2>%(HEADER2)s</h2>
  312. <h3>%(HEADER3)s</h3>
  313. </div>
  314. """,
  315. 'xhtmlcss': """\
  316. <?xml version="1.0"
  317. encoding="%(ENCODING)s"
  318. ?>
  319. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\
  320. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  321. <html xmlns="http://www.w3.org/1999/xhtml">
  322. <head>
  323. <title>%(HEADER1)s</title>
  324. <meta name="generator" content="http://txt2tags.sf.net" />
  325. <link rel="stylesheet" type="text/css" href="%(STYLE)s" />
  326. </head>
  327. <body>
  328. <div class="header" id="header">
  329. <h1>%(HEADER1)s</h1>
  330. <h2>%(HEADER2)s</h2>
  331. <h3>%(HEADER3)s</h3>
  332. </div>
  333. """,
  334. 'dbk': """\
  335. <?xml version="1.0"
  336. encoding="%(ENCODING)s"
  337. ?>
  338. <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"\
  339. "docbook/dtd/xml/4.5/docbookx.dtd">
  340. <article lang="en">
  341. <articleinfo>
  342. <title>%(HEADER1)s</title>
  343. <authorgroup>
  344. <author><othername>%(HEADER2)s</othername></author>
  345. </authorgroup>
  346. <date>%(HEADER3)s</date>
  347. </articleinfo>
  348. """,
  349. 'man': """\
  350. .TH "%(HEADER1)s" 1 "%(HEADER3)s" "%(HEADER2)s"
  351. """,
  352. # TODO style to <HR>
  353. 'pm6': """\
  354. <PMTags1.0 win><C-COLORTABLE ("Preto" 1 0 0 0)
  355. ><@Normal=
  356. <FONT "Times New Roman"><CCOLOR "Preto"><SIZE 11>
  357. <HORIZONTAL 100><LETTERSPACE 0><CTRACK 127><CSSIZE 70><C+SIZE 58.3>
  358. <C-POSITION 33.3><C+POSITION 33.3><P><CBASELINE 0><CNOBREAK 0><CLEADING -0.05>
  359. <GGRID 0><GLEFT 7.2><GRIGHT 0><GFIRST 0><G+BEFORE 7.2><G+AFTER 0>
  360. <GALIGNMENT "justify"><GMETHOD "proportional"><G& "ENGLISH">
  361. <GPAIRS 12><G%% 120><GKNEXT 0><GKWIDOW 0><GKORPHAN 0><GTABS $>
  362. <GHYPHENATION 2 34 0><GWORDSPACE 75 100 150><GSPACE -5 0 25>
  363. ><@Bullet=<@-PARENT "Normal"><FONT "Abadi MT Condensed Light">
  364. <GLEFT 14.4><G+BEFORE 2.15><G%% 110><GTABS(25.2 l "")>
  365. ><@PreFormat=<@-PARENT "Normal"><FONT "Lucida Console"><SIZE 8><CTRACK 0>
  366. <GLEFT 0><G+BEFORE 0><GALIGNMENT "left"><GWORDSPACE 100 100 100><GSPACE 0 0 0>
  367. ><@Title1=<@-PARENT "Normal"><FONT "Arial"><SIZE 14><B>
  368. <GCONTENTS><GLEFT 0><G+BEFORE 0><GALIGNMENT "left">
  369. ><@Title2=<@-PARENT "Title1"><SIZE 12><G+BEFORE 3.6>
  370. ><@Title3=<@-PARENT "Title1"><SIZE 10><GLEFT 7.2><G+BEFORE 7.2>
  371. ><@Title4=<@-PARENT "Title3">
  372. ><@Title5=<@-PARENT "Title3">
  373. ><@Quote=<@-PARENT "Normal"><SIZE 10><I>>
  374. %(HEADER1)s
  375. %(HEADER2)s
  376. %(HEADER3)s
  377. """,
  378. 'mgp': """\
  379. #!/usr/X11R6/bin/mgp -t 90
  380. %%deffont "normal" xfont "utopia-medium-r", charset "iso8859-1"
  381. %%deffont "normal-i" xfont "utopia-medium-i", charset "iso8859-1"
  382. %%deffont "normal-b" xfont "utopia-bold-r" , charset "iso8859-1"
  383. %%deffont "normal-bi" xfont "utopia-bold-i" , charset "iso8859-1"
  384. %%deffont "mono" xfont "courier-medium-r", charset "iso8859-1"
  385. %%default 1 size 5
  386. %%default 2 size 8, fore "yellow", font "normal-b", center
  387. %%default 3 size 5, fore "white", font "normal", left, prefix " "
  388. %%tab 1 size 4, vgap 30, prefix " ", icon arc "red" 40, leftfill
  389. %%tab 2 prefix " ", icon arc "orange" 40, leftfill
  390. %%tab 3 prefix " ", icon arc "brown" 40, leftfill
  391. %%tab 4 prefix " ", icon arc "darkmagenta" 40, leftfill
  392. %%tab 5 prefix " ", icon arc "magenta" 40, leftfill
  393. %%%%------------------------- end of headers -----------------------------
  394. %%page
  395. %%size 10, center, fore "yellow"
  396. %(HEADER1)s
  397. %%font "normal-i", size 6, fore "white", center
  398. %(HEADER2)s
  399. %%font "mono", size 7, center
  400. %(HEADER3)s
  401. """,
  402. 'moin': """\
  403. '''%(HEADER1)s'''
  404. ''%(HEADER2)s''
  405. %(HEADER3)s
  406. """,
  407. 'gwiki': """\
  408. *%(HEADER1)s*
  409. %(HEADER2)s
  410. _%(HEADER3)s_
  411. """,
  412. 'adoc': """\
  413. %(HEADER1)s
  414. %(HEADER2)s
  415. %(HEADER3)s
  416. """,
  417. 'doku': """\
  418. ===== %(HEADER1)s =====
  419. **//%(HEADER2)s//**
  420. //%(HEADER3)s//
  421. """,
  422. 'pmw': """\
  423. (:Title %(HEADER1)s:)
  424. (:Description %(HEADER2)s:)
  425. (:Summary %(HEADER3)s:)
  426. """,
  427. 'wiki': """\
  428. '''%(HEADER1)s'''
  429. %(HEADER2)s
  430. ''%(HEADER3)s''
  431. """,
  432. 'tex': \
  433. r"""\documentclass{article}
  434. \usepackage{graphicx}
  435. \usepackage{paralist} %% needed for compact lists
  436. \usepackage[normalem]{ulem} %% needed by strike
  437. \usepackage[urlcolor=blue,colorlinks=true]{hyperref}
  438. \usepackage[%(ENCODING)s]{inputenc} %% char encoding
  439. \usepackage{%(STYLE)s} %% user defined
  440. \title{%(HEADER1)s}
  441. \author{%(HEADER2)s}
  442. \begin{document}
  443. \date{%(HEADER3)s}
  444. \maketitle
  445. \clearpage
  446. """,
  447. 'lout': """\
  448. @SysInclude { doc }
  449. @Document
  450. @InitialFont { Times Base 12p } # Times, Courier, Helvetica, ...
  451. @PageOrientation { Portrait } # Portrait, Landscape
  452. @ColumnNumber { 1 } # Number of columns (2, 3, ...)
  453. @PageHeaders { Simple } # None, Simple, Titles, NoTitles
  454. @InitialLanguage { English } # German, French, Portuguese, ...
  455. @OptimizePages { Yes } # Yes/No smart page break feature
  456. //
  457. @Text @Begin
  458. @Display @Heading { %(HEADER1)s }
  459. @Display @I { %(HEADER2)s }
  460. @Display { %(HEADER3)s }
  461. #@NP # Break page after Headers
  462. """
  463. # @SysInclude { tbl } # Tables support
  464. # setup: @MakeContents { Yes } # show TOC
  465. # setup: @SectionGap # break page at each section
  466. }
  467. ##############################################################################
  468. def getTags(config):
  469. "Returns all the known tags for the specified target"
  470. keys = """
  471. title1 numtitle1
  472. title2 numtitle2
  473. title3 numtitle3
  474. title4 numtitle4
  475. title5 numtitle5
  476. title1Open title1Close
  477. title2Open title2Close
  478. title3Open title3Close
  479. title4Open title4Close
  480. title5Open title5Close
  481. blocktitle1Open blocktitle1Close
  482. blocktitle2Open blocktitle2Close
  483. blocktitle3Open blocktitle3Close
  484. paragraphOpen paragraphClose
  485. blockVerbOpen blockVerbClose
  486. blockQuoteOpen blockQuoteClose blockQuoteLine
  487. blockCommentOpen blockCommentClose
  488. fontMonoOpen fontMonoClose
  489. fontBoldOpen fontBoldClose
  490. fontItalicOpen fontItalicClose
  491. fontUnderlineOpen fontUnderlineClose
  492. fontStrikeOpen fontStrikeClose
  493. listOpen listClose
  494. listOpenCompact listCloseCompact
  495. listItemOpen listItemClose listItemLine
  496. numlistOpen numlistClose
  497. numlistOpenCompact numlistCloseCompact
  498. numlistItemOpen numlistItemClose numlistItemLine
  499. deflistOpen deflistClose
  500. deflistOpenCompact deflistCloseCompact
  501. deflistItem1Open deflistItem1Close
  502. deflistItem2Open deflistItem2Close deflistItem2LinePrefix
  503. bar1 bar2
  504. url urlMark
  505. email emailMark
  506. img imgAlignLeft imgAlignRight imgAlignCenter
  507. _imgAlignLeft _imgAlignRight _imgAlignCenter
  508. tableOpen tableClose
  509. _tableBorder _tableAlignLeft _tableAlignCenter
  510. tableRowOpen tableRowClose tableRowSep
  511. tableTitleRowOpen tableTitleRowClose
  512. tableCellOpen tableCellClose tableCellSep
  513. tableTitleCellOpen tableTitleCellClose tableTitleCellSep
  514. _tableColAlignLeft _tableColAlignRight _tableColAlignCenter
  515. _tableCellAlignLeft _tableCellAlignRight _tableCellAlignCenter
  516. _tableCellColSpan tableColAlignSep
  517. _tableCellMulticolOpen
  518. _tableCellMulticolClose
  519. bodyOpen bodyClose
  520. cssOpen cssClose
  521. tocOpen tocClose TOC
  522. anchor
  523. comment
  524. pageBreak
  525. EOD
  526. """.split()
  527. # TIP: \a represents the current text on the mark
  528. # TIP: ~A~, ~B~ and ~C~ are expanded to other tags parts
  529. alltags = {
  530. 'art': {
  531. 'title1' : '\a' ,
  532. 'title2' : '\a' ,
  533. 'title3' : '\a' ,
  534. 'title4' : '\a' ,
  535. 'title5' : '\a' ,
  536. 'blockQuoteLine' : '\t' ,
  537. 'listItemOpen' : '- ' ,
  538. 'numlistItemOpen' : '\a. ' ,
  539. 'bar1' : aa_line(AA_CHARS['bar1']),
  540. 'bar2' : aa_line(AA_CHARS['bar2']),
  541. 'url' : '\a' ,
  542. 'urlMark' : '\a (\a)' ,
  543. 'email' : '\a' ,
  544. 'emailMark' : '\a (\a)' ,
  545. 'img' : '[\a]' ,
  546. },
  547. 'txt': {
  548. 'title1' : ' \a' ,
  549. 'title2' : '\t\a' ,
  550. 'title3' : '\t\t\a' ,
  551. 'title4' : '\t\t\t\a' ,
  552. 'title5' : '\t\t\t\t\a',
  553. 'blockQuoteLine' : '\t' ,
  554. 'listItemOpen' : '- ' ,
  555. 'numlistItemOpen' : '\a. ' ,
  556. 'bar1' : '\a' ,
  557. 'url' : '\a' ,
  558. 'urlMark' : '\a (\a)' ,
  559. 'email' : '\a' ,
  560. 'emailMark' : '\a (\a)' ,
  561. 'img' : '[\a]' ,
  562. },
  563. 'html': {
  564. 'paragraphOpen' : '<P>' ,
  565. 'paragraphClose' : '</P>' ,
  566. 'title1' : '~A~<H1>\a</H1>' ,
  567. 'title2' : '~A~<H2>\a</H2>' ,
  568. 'title3' : '~A~<H3>\a</H3>' ,
  569. 'title4' : '~A~<H4>\a</H4>' ,
  570. 'title5' : '~A~<H5>\a</H5>' ,
  571. 'anchor' : '<A NAME="\a"></A>\n',
  572. 'blockVerbOpen' : '<PRE>' ,
  573. 'blockVerbClose' : '</PRE>' ,
  574. 'blockQuoteOpen' : '<BLOCKQUOTE>' ,
  575. 'blockQuoteClose' : '</BLOCKQUOTE>' ,
  576. 'fontMonoOpen' : '<CODE>' ,
  577. 'fontMonoClose' : '</CODE>' ,
  578. 'fontBoldOpen' : '<B>' ,
  579. 'fontBoldClose' : '</B>' ,
  580. 'fontItalicOpen' : '<I>' ,
  581. 'fontItalicClose' : '</I>' ,
  582. 'fontUnderlineOpen' : '<U>' ,
  583. 'fontUnderlineClose' : '</U>' ,
  584. 'fontStrikeOpen' : '<S>' ,
  585. 'fontStrikeClose' : '</S>' ,
  586. 'listOpen' : '<UL>' ,
  587. 'listClose' : '</UL>' ,
  588. 'listItemOpen' : '<LI>' ,
  589. 'numlistOpen' : '<OL>' ,
  590. 'numlistClose' : '</OL>' ,
  591. 'numlistItemOpen' : '<LI>' ,
  592. 'deflistOpen' : '<DL>' ,
  593. 'deflistClose' : '</DL>' ,
  594. 'deflistItem1Open' : '<DT>' ,
  595. 'deflistItem1Close' : '</DT>' ,
  596. 'deflistItem2Open' : '<DD>' ,
  597. 'bar1' : '<HR NOSHADE SIZE=1>' ,
  598. 'bar2' : '<HR NOSHADE SIZE=5>' ,
  599. 'url' : '<A HREF="\a">\a</A>' ,
  600. 'urlMark' : '<A HREF="\a">\a</A>' ,
  601. 'email' : '<A HREF="mailto:\a">\a</A>' ,
  602. 'emailMark' : '<A HREF="mailto:\a">\a</A>' ,
  603. 'img' : '<IMG~A~ SRC="\a" BORDER="0" ALT="">',
  604. '_imgAlignLeft' : ' ALIGN="left"' ,
  605. '_imgAlignCenter' : ' ALIGN="middle"',
  606. '_imgAlignRight' : ' ALIGN="right"' ,
  607. 'tableOpen' : '<TABLE~A~~B~ CELLPADDING="4">',
  608. 'tableClose' : '</TABLE>' ,
  609. 'tableRowOpen' : '<TR>' ,
  610. 'tableRowClose' : '</TR>' ,
  611. 'tableCellOpen' : '<TD~A~~S~>' ,
  612. 'tableCellClose' : '</TD>' ,
  613. 'tableTitleCellOpen' : '<TH~S~>' ,
  614. 'tableTitleCellClose' : '</TH>' ,
  615. '_tableBorder' : ' BORDER="1"' ,
  616. '_tableAlignCenter' : ' ALIGN="center"',
  617. '_tableCellAlignRight' : ' ALIGN="right"' ,
  618. '_tableCellAlignCenter': ' ALIGN="center"',
  619. '_tableCellColSpan' : ' COLSPAN="\a"' ,
  620. 'cssOpen' : '<STYLE TYPE="text/css">',
  621. 'cssClose' : '</STYLE>' ,
  622. 'comment' : '<!-- \a -->' ,
  623. 'EOD' : '</BODY></HTML>'
  624. },
  625. #TIP xhtml inherits all HTML definitions (lowercased)
  626. #TIP http://www.w3.org/TR/xhtml1/#guidelines
  627. #TIP http://www.htmlref.com/samples/Chapt17/17_08.htm
  628. 'xhtml': {
  629. 'listItemClose' : '</li>' ,
  630. 'numlistItemClose' : '</li>' ,
  631. 'deflistItem2Close' : '</dd>' ,
  632. 'bar1' : '<hr class="light" />',
  633. 'bar2' : '<hr class="heavy" />',
  634. 'anchor' : '<a id="\a" name="\a"></a>\n',
  635. 'img' : '<img~A~ src="\a" border="0" alt=""/>',
  636. },
  637. 'sgml': {
  638. 'paragraphOpen' : '<p>' ,
  639. 'title1' : '<sect>\a~A~<p>' ,
  640. 'title2' : '<sect1>\a~A~<p>' ,
  641. 'title3' : '<sect2>\a~A~<p>' ,
  642. 'title4' : '<sect3>\a~A~<p>' ,
  643. 'title5' : '<sect4>\a~A~<p>' ,
  644. 'anchor' : '<label id="\a">' ,
  645. 'blockVerbOpen' : '<tscreen><verb>' ,
  646. 'blockVerbClose' : '</verb></tscreen>' ,
  647. 'blockQuoteOpen' : '<quote>' ,
  648. 'blockQuoteClose' : '</quote>' ,
  649. 'fontMonoOpen' : '<tt>' ,
  650. 'fontMonoClose' : '</tt>' ,
  651. 'fontBoldOpen' : '<bf>' ,
  652. 'fontBoldClose' : '</bf>' ,
  653. 'fontItalicOpen' : '<em>' ,
  654. 'fontItalicClose' : '</em>' ,
  655. 'fontUnderlineOpen' : '<bf><em>' ,
  656. 'fontUnderlineClose' : '</em></bf>' ,
  657. 'listOpen' : '<itemize>' ,
  658. 'listClose' : '</itemize>' ,
  659. 'listItemOpen' : '<item>' ,
  660. 'numlistOpen' : '<enum>' ,
  661. 'numlistClose' : '</enum>' ,
  662. 'numlistItemOpen' : '<item>' ,
  663. 'deflistOpen' : '<descrip>' ,
  664. 'deflistClose' : '</descrip>' ,
  665. 'deflistItem1Open' : '<tag>' ,
  666. 'deflistItem1Close' : '</tag>' ,
  667. 'bar1' : '<!-- \a -->' ,
  668. 'url' : '<htmlurl url="\a" name="\a">' ,
  669. 'urlMark' : '<htmlurl url="\a" name="\a">' ,
  670. 'email' : '<htmlurl url="mailto:\a" name="\a">' ,
  671. 'emailMark' : '<htmlurl url="mailto:\a" name="\a">' ,
  672. 'img' : '<figure><ph vspace=""><img src="\a"></figure>',
  673. 'tableOpen' : '<table><tabular ca="~C~">' ,
  674. 'tableClose' : '</tabular></table>' ,
  675. 'tableRowSep' : '<rowsep>' ,
  676. 'tableCellSep' : '<colsep>' ,
  677. '_tableColAlignLeft' : 'l' ,
  678. '_tableColAlignRight' : 'r' ,
  679. '_tableColAlignCenter' : 'c' ,
  680. 'comment' : '<!-- \a -->' ,
  681. 'TOC' : '<toc>' ,
  682. 'EOD' : '</article>'
  683. },
  684. 'dbk': {
  685. 'paragraphOpen' : '<para>' ,
  686. 'paragraphClose' : '</para>' ,
  687. 'title1Open' : '~A~<sect1><title>\a</title>' ,
  688. 'title1Close' : '</sect1>' ,
  689. 'title2Open' : '~A~ <sect2><title>\a</title>' ,
  690. 'title2Close' : ' </sect2>' ,
  691. 'title3Open' : '~A~ <sect3><title>\a</title>' ,
  692. 'title3Close' : ' </sect3>' ,
  693. 'title4Open' : '~A~ <sect4><title>\a</title>' ,
  694. 'title4Close' : ' </sect4>' ,
  695. 'title5Open' : '~A~ <sect5><title>\a</title>',
  696. 'title5Close' : ' </sect5>' ,
  697. 'anchor' : '<anchor id="\a"/>\n' ,
  698. 'blockVerbOpen' : '<programlisting>' ,
  699. 'blockVerbClose' : '</programlisting>' ,
  700. 'blockQuoteOpen' : '<blockquote><para>' ,
  701. 'blockQuoteClose' : '</para></blockquote>' ,
  702. 'fontMonoOpen' : '<code>' ,
  703. 'fontMonoClose' : '</code>' ,
  704. 'fontBoldOpen' : '<emphasis role="bold">' ,
  705. 'fontBoldClose' : '</emphasis>' ,
  706. 'fontItalicOpen' : '<emphasis>' ,
  707. 'fontItalicClose' : '</emphasis>' ,
  708. 'fontUnderlineOpen' : '<emphasis role="underline">' ,
  709. 'fontUnderlineClose' : '</emphasis>' ,
  710. # 'fontStrikeOpen' : '<emphasis role="strikethrough">' , # Don't know
  711. # 'fontStrikeClose' : '</emphasis>' ,
  712. 'listOpen' : '<itemizedlist>' ,
  713. 'listClose' : '</itemizedlist>' ,
  714. 'listItemOpen' : '<listitem><para>' ,
  715. 'listItemClose' : '</para></listitem>' ,
  716. 'numlistOpen' : '<orderedlist numeration="arabic">' ,
  717. 'numlistClose' : '</orderedlist>' ,
  718. 'numlistItemOpen' : '<listitem><para>' ,
  719. 'numlistItemClose' : '</para></listitem>' ,
  720. 'deflistOpen' : '<variablelist>' ,
  721. 'deflistClose' : '</variablelist>' ,
  722. 'deflistItem1Open' : '<varlistentry><term>' ,
  723. 'deflistItem1Close' : '</term>' ,
  724. 'deflistItem2Open' : '<listitem><para>' ,
  725. 'deflistItem2Close' : '</para></listitem></varlistentry>' ,
  726. # 'bar1' : '<>' , # Don't know
  727. # 'bar2' : '<>' , # Don't know
  728. 'url' : '<ulink url="\a">\a</ulink>' ,
  729. 'urlMark' : '<ulink url="\a">\a</ulink>' ,
  730. 'email' : '<email>\a</email>' ,
  731. 'emailMark' : '<email>\a</email>' ,
  732. 'img' : '<mediaobject><imageobject><imagedata fileref="\a"/></imageobject></mediaobject>',
  733. # '_imgAlignLeft' : '' , # Don't know
  734. # '_imgAlignCenter' : '' , # Don't know
  735. # '_imgAlignRight' : '' , # Don't know
  736. 'tableOpen' : '<para>', # just to have something...
  737. 'tableClose' : '</para>',
  738. # 'tableOpen' : '<informaltable><tgroup cols=""><tbody>', # Don't work, need to know number of cols
  739. # 'tableClose' : '</tbody></tgroup></informaltable>' ,
  740. # 'tableRowOpen' : '<row>' ,
  741. # 'tableRowClose' : '</row>' ,
  742. # 'tableCellOpen' : '<entry>' ,
  743. # 'tableCellClose' : '</entry>' ,
  744. # 'tableTitleRowOpen' : '<thead>' ,
  745. # 'tableTitleRowClose' : '</thead>' ,
  746. # '_tableBorder' : ' frame="all"' ,
  747. # '_tableAlignCenter' : ' align="center"' ,
  748. # '_tableCellAlignRight' : ' align="right"' ,
  749. # '_tableCellAlignCenter': ' align="center"' ,
  750. # '_tableCellColSpan' : ' COLSPAN="\a"' ,
  751. 'TOC' : '</index>' ,
  752. 'comment' : '<!-- \a -->' ,
  753. 'EOD' : '</article>'
  754. },
  755. 'tex': {
  756. 'title1' : '~A~\section*{\a}' ,
  757. 'title2' : '~A~\\subsection*{\a}' ,
  758. 'title3' : '~A~\\subsubsection*{\a}',
  759. # title 4/5: DIRTY: para+BF+\\+\n
  760. 'title4' : '~A~\\paragraph{}\\textbf{\a}\\\\\n',
  761. 'title5' : '~A~\\paragraph{}\\textbf{\a}\\\\\n',
  762. 'numtitle1' : '\n~A~\section{\a}' ,
  763. 'numtitle2' : '~A~\\subsection{\a}' ,
  764. 'numtitle3' : '~A~\\subsubsection{\a}' ,
  765. 'anchor' : '\\hypertarget{\a}{}\n' ,
  766. 'blockVerbOpen' : '\\begin{verbatim}' ,
  767. 'blockVerbClose' : '\\end{verbatim}' ,
  768. 'blockQuoteOpen' : '\\begin{quotation}' ,
  769. 'blockQuoteClose' : '\\end{quotation}' ,
  770. 'fontMonoOpen' : '\\texttt{' ,
  771. 'fontMonoClose' : '}' ,
  772. 'fontBoldOpen' : '\\textbf{' ,
  773. 'fontBoldClose' : '}' ,
  774. 'fontItalicOpen' : '\\textit{' ,
  775. 'fontItalicClose' : '}' ,
  776. 'fontUnderlineOpen' : '\\underline{' ,
  777. 'fontUnderlineClose' : '}' ,
  778. 'fontStrikeOpen' : '\\sout{' ,
  779. 'fontStrikeClose' : '}' ,
  780. 'listOpen' : '\\begin{itemize}' ,
  781. 'listClose' : '\\end{itemize}' ,
  782. 'listOpenCompact' : '\\begin{compactitem}',
  783. 'listCloseCompact' : '\\end{compactitem}' ,
  784. 'listItemOpen' : '\\item ' ,
  785. 'numlistOpen' : '\\begin{enumerate}' ,
  786. 'numlistClose' : '\\end{enumerate}' ,
  787. 'numlistOpenCompact' : '\\begin{compactenum}',
  788. 'numlistCloseCompact' : '\\end{compactenum}' ,
  789. 'numlistItemOpen' : '\\item ' ,
  790. 'deflistOpen' : '\\begin{description}',
  791. 'deflistClose' : '\\end{description}' ,
  792. 'deflistOpenCompact' : '\\begin{compactdesc}',
  793. 'deflistCloseCompact' : '\\end{compactdesc}' ,
  794. 'deflistItem1Open' : '\\item[' ,
  795. 'deflistItem1Close' : ']' ,
  796. 'bar1' : '\\hrulefill{}' ,
  797. 'bar2' : '\\rule{\linewidth}{1mm}',
  798. 'url' : '\\htmladdnormallink{\a}{\a}',
  799. 'urlMark' : '\\htmladdnormallink{\a}{\a}',
  800. 'email' : '\\htmladdnormallink{\a}{mailto:\a}',
  801. 'emailMark' : '\\htmladdnormallink{\a}{mailto:\a}',
  802. 'img' : '\\includegraphics{\a}',
  803. 'tableOpen' : '\\begin{center}\\begin{tabular}{|~C~|}',
  804. 'tableClose' : '\\end{tabular}\\end{center}',
  805. 'tableRowOpen' : '\\hline ' ,
  806. 'tableRowClose' : ' \\\\' ,
  807. 'tableCellSep' : ' & ' ,
  808. '_tableColAlignLeft' : 'l' ,
  809. '_tableColAlignRight' : 'r' ,
  810. '_tableColAlignCenter' : 'c' ,
  811. '_tableCellAlignLeft' : 'l' ,
  812. '_tableCellAlignRight' : 'r' ,
  813. '_tableCellAlignCenter': 'c' ,
  814. '_tableCellColSpan' : '\a' ,
  815. '_tableCellMulticolOpen' : '\\multicolumn{\a}{|~C~|}{',
  816. '_tableCellMulticolClose' : '}',
  817. 'tableColAlignSep' : '|' ,
  818. 'comment' : '% \a' ,
  819. 'TOC' : '\\tableofcontents',
  820. 'pageBreak' : '\\clearpage',
  821. 'EOD' : '\\end{document}'
  822. },
  823. 'lout': {
  824. 'paragraphOpen' : '@LP' ,
  825. 'blockTitle1Open' : '@BeginSections' ,
  826. 'blockTitle1Close' : '@EndSections' ,
  827. 'blockTitle2Open' : ' @BeginSubSections' ,
  828. 'blockTitle2Close' : ' @EndSubSections' ,
  829. 'blockTitle3Open' : ' @BeginSubSubSections' ,
  830. 'blockTitle3Close' : ' @EndSubSubSections' ,
  831. 'title1Open' : '~A~@Section @Title { \a } @Begin',
  832. 'title1Close' : '@End @Section' ,
  833. 'title2Open' : '~A~ @SubSection @Title { \a } @Begin',
  834. 'title2Close' : ' @End @SubSection' ,
  835. 'title3Open' : '~A~ @SubSubSection @Title { \a } @Begin',
  836. 'title3Close' : ' @End @SubSubSection' ,
  837. 'title4Open' : '~A~@LP @LeftDisplay @B { \a }',
  838. 'title5Open' : '~A~@LP @LeftDisplay @B { \a }',
  839. 'anchor' : '@Tag { \a }\n' ,
  840. 'blockVerbOpen' : '@LP @ID @F @RawVerbatim @Begin',
  841. 'blockVerbClose' : '@End @RawVerbatim' ,
  842. 'blockQuoteOpen' : '@QD {' ,
  843. 'blockQuoteClose' : '}' ,
  844. # enclosed inside {} to deal with joined**words**
  845. 'fontMonoOpen' : '{@F {' ,
  846. 'fontMonoClose' : '}}' ,
  847. 'fontBoldOpen' : '{@B {' ,
  848. 'fontBoldClose' : '}}' ,
  849. 'fontItalicOpen' : '{@II {' ,
  850. 'fontItalicClose' : '}}' ,
  851. 'fontUnderlineOpen' : '{@Underline{' ,
  852. 'fontUnderlineClose' : '}}' ,
  853. # the full form is more readable, but could be BL EL LI NL TL DTI
  854. 'listOpen' : '@BulletList' ,
  855. 'listClose' : '@EndList' ,
  856. 'listItemOpen' : '@ListItem{' ,
  857. 'listItemClose' : '}' ,
  858. 'numlistOpen' : '@NumberedList' ,
  859. 'numlistClose' : '@EndList' ,
  860. 'numlistItemOpen' : '@ListItem{' ,
  861. 'numlistItemClose' : '}' ,
  862. 'deflistOpen' : '@TaggedList' ,
  863. 'deflistClose' : '@EndList' ,
  864. 'deflistItem1Open' : '@DropTagItem {' ,
  865. 'deflistItem1Close' : '}' ,
  866. 'deflistItem2Open' : '{' ,
  867. 'deflistItem2Close' : '}' ,
  868. 'bar1' : '@DP @FullWidthRule' ,
  869. 'url' : '{blue @Colour { \a }}' ,
  870. 'urlMark' : '\a ({blue @Colour { \a }})' ,
  871. 'email' : '{blue @Colour { \a }}' ,
  872. 'emailMark' : '\a ({blue Colour{ \a }})' ,
  873. 'img' : '~A~@IncludeGraphic { \a }' , # eps only!
  874. '_imgAlignLeft' : '@LeftDisplay ' ,
  875. '_imgAlignRight' : '@RightDisplay ' ,
  876. '_imgAlignCenter' : '@CentredDisplay ' ,
  877. # lout tables are *way* complicated, no support for now
  878. #'tableOpen' : '~A~@Tbl~B~\naformat{ @Cell A | @Cell B } {',
  879. #'tableClose' : '}' ,
  880. #'tableRowOpen' : '@Rowa\n' ,
  881. #'tableTitleRowOpen' : '@HeaderRowa' ,
  882. #'tableCenterAlign' : '@CentredDisplay ' ,
  883. #'tableCellOpen' : '\a {' , # A, B, ...
  884. #'tableCellClose' : '}' ,
  885. #'_tableBorder' : '\nrule {yes}' ,
  886. 'comment' : '# \a' ,
  887. # @MakeContents must be on the config file
  888. 'TOC' : '@DP @ContentsGoesHere @DP',
  889. 'pageBreak' : '@NP' ,
  890. 'EOD' : '@End @Text'
  891. },
  892. # http://moinmo.in/SyntaxReference
  893. 'moin': {
  894. 'title1' : '= \a =' ,
  895. 'title2' : '== \a ==' ,
  896. 'title3' : '=== \a ===' ,
  897. 'title4' : '==== \a ====' ,
  898. 'title5' : '===== \a =====',
  899. 'blockVerbOpen' : '{{{' ,
  900. 'blockVerbClose' : '}}}' ,
  901. 'blockQuoteLine' : ' ' ,
  902. 'fontMonoOpen' : '{{{' ,
  903. 'fontMonoClose' : '}}}' ,
  904. 'fontBoldOpen' : "'''" ,
  905. 'fontBoldClose' : "'''" ,
  906. 'fontItalicOpen' : "''" ,
  907. 'fontItalicClose' : "''" ,
  908. 'fontUnderlineOpen' : '__' ,
  909. 'fontUnderlineClose' : '__' ,
  910. 'fontStrikeOpen' : '--(' ,
  911. 'fontStrikeClose' : ')--' ,
  912. 'listItemOpen' : ' * ' ,
  913. 'numlistItemOpen' : ' \a. ' ,
  914. 'deflistItem1Open' : ' ' ,
  915. 'deflistItem1Close' : '::' ,
  916. 'deflistItem2LinePrefix': ' :: ' ,
  917. 'bar1' : '----' ,
  918. 'bar2' : '--------' ,
  919. 'url' : '[\a]' ,
  920. 'urlMark' : '[\a \a]' ,
  921. 'email' : '[\a]' ,
  922. 'emailMark' : '[\a \a]' ,
  923. 'img' : '[\a]' ,
  924. 'tableRowOpen' : '||' ,
  925. 'tableCellOpen' : '~A~' ,
  926. 'tableCellClose' : '||' ,
  927. 'tableTitleCellClose' : '||' ,
  928. '_tableCellAlignRight' : '<)>' ,
  929. '_tableCellAlignCenter' : '<:>' ,
  930. 'comment' : '/* \a */' ,
  931. 'TOC' : '[[TableOfContents]]'
  932. },
  933. # http://code.google.com/p/support/wiki/WikiSyntax
  934. 'gwiki': {
  935. 'title1' : '= \a =' ,
  936. 'title2' : '== \a ==' ,
  937. 'title3' : '=== \a ===' ,
  938. 'title4' : '==== \a ====' ,
  939. 'title5' : '===== \a =====',
  940. 'blockVerbOpen' : '{{{' ,
  941. 'blockVerbClose' : '}}}' ,
  942. 'blockQuoteLine' : ' ' ,
  943. 'fontMonoOpen' : '{{{' ,
  944. 'fontMonoClose' : '}}}' ,
  945. 'fontBoldOpen' : '*' ,
  946. 'fontBoldClose' : '*' ,
  947. 'fontItalicOpen' : '_' , # underline == italic
  948. 'fontItalicClose' : '_' ,
  949. 'fontStrikeOpen' : '~~' ,
  950. 'fontStrikeClose' : '~~' ,
  951. 'listItemOpen' : ' * ' ,
  952. 'numlistItemOpen' : ' # ' ,
  953. 'url' : '\a' ,
  954. 'urlMark' : '[\a \a]' ,
  955. 'email' : 'mailto:\a' ,
  956. 'emailMark' : '[mailto:\a \a]',
  957. 'img' : '[\a]' ,
  958. 'tableRowOpen' : '|| ' ,
  959. 'tableRowClose' : ' ||' ,
  960. 'tableCellSep' : ' || ' ,
  961. },
  962. # http://powerman.name/doc/asciidoc
  963. 'adoc': {
  964. 'title1' : '== \a' ,
  965. 'title2' : '=== \a' ,
  966. 'title3' : '==== \a' ,
  967. 'title4' : '===== \a' ,
  968. 'title5' : '===== \a' ,
  969. 'blockVerbOpen' : '----' ,
  970. 'blockVerbClose' : '----' ,
  971. 'fontMonoOpen' : '+' ,
  972. 'fontMonoClose' : '+' ,
  973. 'fontBoldOpen' : '*' ,
  974. 'fontBoldClose' : '*' ,
  975. 'fontItalicOpen' : '_' ,
  976. 'fontItalicClose' : '_' ,
  977. 'listItemOpen' : '- ' ,
  978. 'listItemLine' : '\t' ,
  979. 'numlistItemOpen' : '. ' ,
  980. 'url' : '\a' ,
  981. 'urlMark' : '\a[\a]' ,
  982. 'email' : 'mailto:\a' ,
  983. 'emailMark' : 'mailto:\a[\a]' ,
  984. 'img' : 'image::\a[]' ,
  985. },
  986. # http://wiki.splitbrain.org/wiki:syntax
  987. # Hint: <br> is \\ $
  988. # Hint: You can add footnotes ((This is a footnote))
  989. 'doku': {
  990. 'title1' : '===== \a =====',
  991. 'title2' : '==== \a ====' ,
  992. 'title3' : '=== \a ===' ,
  993. 'title4' : '== \a ==' ,
  994. 'title5' : '= \a =' ,
  995. # DokuWiki uses ' ' identation to mark verb blocks (see indentverbblock)
  996. 'blockQuoteLine' : '>' ,
  997. 'fontMonoOpen' : "''" ,
  998. 'fontMonoClose' : "''" ,
  999. 'fontBoldOpen' : "**" ,
  1000. 'fontBoldClose' : "**" ,
  1001. 'fontItalicOpen' : "//" ,
  1002. 'fontItalicClose' : "//" ,
  1003. 'fontUnderlineOpen' : "__" ,
  1004. 'fontUnderlineClose' : "__" ,
  1005. 'fontStrikeOpen' : '<del>' ,
  1006. 'fontStrikeClose' : '</del>' ,
  1007. 'listItemOpen' : ' * ' ,
  1008. 'numlistItemOpen' : ' - ' ,
  1009. 'bar1' : '----' ,
  1010. 'url' : '[[\a]]' ,
  1011. 'urlMark' : '[[\a|\a]]' ,
  1012. 'email' : '[[\a]]' ,
  1013. 'emailMark' : '[[\a|\a]]' ,
  1014. 'img' : '{{\a}}' ,
  1015. 'imgAlignLeft' : '{{\a }}' ,
  1016. 'imgAlignRight' : '{{ \a}}' ,
  1017. 'imgAlignCenter' : '{{ \a }}' ,
  1018. 'tableTitleRowOpen' : '^ ' ,
  1019. 'tableTitleRowClose' : ' ^' ,
  1020. 'tableTitleCellSep' : ' ^ ' ,
  1021. 'tableRowOpen' : '| ' ,
  1022. 'tableRowClose' : ' |' ,
  1023. 'tableCellSep' : ' | ' ,
  1024. # DokuWiki has no attributes. The content must be aligned!
  1025. # '_tableCellAlignRight' : '<)>' , # ??
  1026. # '_tableCellAlignCenter': '<:>' , # ??
  1027. # DokuWiki colspan is the same as txt2tags' with multiple |||
  1028. # 'comment' : '## \a' , # ??
  1029. # TOC is automatic
  1030. },
  1031. # http://www.pmwiki.org/wiki/PmWiki/TextFormattingRules
  1032. 'pmw': {
  1033. 'title1' : '~A~! \a ' ,
  1034. 'title2' : '~A~!! \a ' ,
  1035. 'title3' : '~A~!!! \a ' ,
  1036. 'title4' : '~A~!!!! \a ' ,
  1037. 'title5' : '~A~!!!!! \a ' ,
  1038. 'blockQuoteOpen' : '->' ,
  1039. 'blockQuoteClose' : '\n' ,
  1040. # In-text font
  1041. 'fontLargeOpen' : "[+" ,
  1042. 'fontLargeClose' : "+]" ,
  1043. 'fontLargerOpen' : "[++" ,
  1044. 'fontLargerClose' : "++]" ,
  1045. 'fontSmallOpen' : "[-" ,
  1046. 'fontSmallClose' : "-]" ,
  1047. 'fontLargerOpen' : "[--" ,
  1048. 'fontLargerClose' : "--]" ,
  1049. 'fontMonoOpen' : "@@" ,
  1050. 'fontMonoClose' : "@@" ,
  1051. 'fontBoldOpen' : "'''" ,
  1052. 'fontBoldClose' : "'''" ,
  1053. 'fontItalicOpen' : "''" ,
  1054. 'fontItalicClose' : "''" ,
  1055. 'fontUnderlineOpen' : "{+" ,
  1056. 'fontUnderlineClose' : "+}" ,
  1057. 'fontStrikeOpen' : '{-' ,
  1058. 'fontStrikeClose' : '-}' ,
  1059. # Lists
  1060. 'listItemOpen' : '* ' ,
  1061. 'numlistItemOpen' : '# ' ,
  1062. 'deflistItem1Open' : ': ' ,
  1063. 'deflistItem1Close' : ':' ,
  1064. 'deflistItem2LineOpen' : '::' ,
  1065. 'deflistItem2LineClose' : ':' ,
  1066. # Verbatim block
  1067. 'blockVerbOpen' : '[@' ,
  1068. 'blockVerbClose' : '@]' ,
  1069. 'bar1' : '----' ,
  1070. # URL, email and anchor
  1071. 'url' : '\a' ,
  1072. 'urlMark' : '[[\a -> \a]]' ,
  1073. 'email' : '\a' ,
  1074. 'emailMark' : '[[\a -> mailto:\a]]',
  1075. 'anchor' : '[[#\a]]\n' ,
  1076. # Image markup
  1077. 'img' : '\a' ,
  1078. #'imgAlignLeft' : '{{\a }}' ,
  1079. #'imgAlignRight' : '{{ \a}}' ,
  1080. #'imgAlignCenter' : '{{ \a }}' ,
  1081. # Table attributes
  1082. 'tableTitleRowOpen' : '||! ' ,
  1083. 'tableTitleRowClose' : '||' ,
  1084. 'tableTitleCellSep' : ' ||!' ,
  1085. 'tableRowOpen' : '||' ,
  1086. 'tableRowClose' : '||' ,
  1087. 'tableCellSep' : ' ||' ,
  1088. },
  1089. # http://en.wikipedia.org/wiki/Help:Editing
  1090. 'wiki': {
  1091. 'title1' : '== \a ==' ,
  1092. 'title2' : '=== \a ===' ,
  1093. 'title3' : '==== \a ====' ,
  1094. 'title4' : '===== \a =====' ,
  1095. 'title5' : '====== \a ======',
  1096. 'blockVerbOpen' : '<pre>' ,
  1097. 'blockVerbClose' : '</pre>' ,
  1098. 'blockQuoteOpen' : '<blockquote>' ,
  1099. 'blockQuoteClose' : '</blockquote>' ,
  1100. 'fontMonoOpen' : '<tt>' ,
  1101. 'fontMonoClose' : '</tt>' ,
  1102. 'fontBoldOpen' : "'''" ,
  1103. 'fontBoldClose' : "'''" ,
  1104. 'fontItalicOpen' : "''" ,
  1105. 'fontItalicClose' : "''" ,
  1106. 'fontUnderlineOpen' : '<u>' ,
  1107. 'fontUnderlineClose' : '</u>' ,
  1108. 'fontStrikeOpen' : '<s>' ,
  1109. 'fontStrikeClose' : '</s>' ,
  1110. #XXX Mixed lists not working: *#* list inside numlist inside list
  1111. 'listItemLine' : '*' ,
  1112. 'numlistItemLine' : '#' ,
  1113. 'deflistItem1Open' : '; ' ,
  1114. 'deflistItem2LinePrefix': ': ' ,
  1115. 'bar1' : '----' ,
  1116. 'url' : '[\a]' ,
  1117. 'urlMark' : '[\a \a]' ,
  1118. 'email' : 'mailto:\a' ,
  1119. 'emailMark' : '[mailto:\a \a]' ,
  1120. # [[Image:foo.png|right|Optional alt/caption text]] (right, left, center, none)
  1121. 'img' : '[[Image:\a~A~]]' ,
  1122. '_imgAlignLeft' : '|left' ,
  1123. '_imgAlignCenter' : '|center' ,
  1124. '_imgAlignRight' : '|right' ,
  1125. # {| border="1" cellspacing="0" cellpadding="4" align="center"
  1126. 'tableOpen' : '{|~A~~B~ cellpadding="4"',
  1127. 'tableClose' : '|}' ,
  1128. 'tableRowOpen' : '|-\n| ' ,
  1129. 'tableTitleRowOpen' : '|-\n! ' ,
  1130. 'tableCellSep' : ' || ' ,
  1131. 'tableTitleCellSep' : ' !! ' ,
  1132. '_tableBorder' : ' border="1"' ,
  1133. '_tableAlignCenter' : ' align="center"' ,
  1134. 'comment' : '<!-- \a -->' ,

Large files files are truncated, but you can click here to view the full file