Attachment 'inline_latex.py'

Download

   1 <?xml version="1.0" encoding="ascii"?>
   2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
   3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
   4 <head>
   5 <link rel="icon" href="/moin/extensions/static/hgicon.png" type="image/png" />
   6 <meta name="robots" content="index, nofollow"/>
   7 <link rel="stylesheet" href="/moin/extensions/static/style-gitweb.css" type="text/css" />
   8 
   9 
  10 <title>moin/extensions: data/plugin/parser/inline_latex.py@6aefd777e2dd</title>
  11 <link rel="alternate" type="application/atom+xml"
  12    href="/moin/extensions/atom-log" title="Atom feed for moin/extensions"/>
  13 <link rel="alternate" type="application/rss+xml"
  14    href="/moin/extensions/rss-log" title="RSS feed for moin/extensions"/>
  15 </head>
  16 <body>
  17 
  18 <div class="page_header">
  19 <a href="http://mercurial.selenic.com/" title="Mercurial" style="float: right;">Mercurial</a><a href="/moin/extensions/summary">moin/extensions</a> / file revision
  20 </div>
  21 
  22 <div class="page_nav">
  23 <a href="/moin/extensions/summary">summary</a> |
  24 <a href="/moin/extensions/shortlog">shortlog</a> |
  25 <a href="/moin/extensions/log">changelog</a> |
  26 <a href="/moin/extensions/graph">graph</a> |
  27 <a href="/moin/extensions/tags">tags</a> |
  28 <a href="/moin/extensions/branches">branches</a> |
  29 <a href="/moin/extensions/file/6aefd777e2dd/data/plugin/parser/">files</a> |
  30 <a href="/moin/extensions/rev/6aefd777e2dd">changeset</a> |
  31 file |
  32 <a href="/moin/extensions/file/tip/data/plugin/parser/inline_latex.py">latest</a> |
  33 <a href="/moin/extensions/log/6aefd777e2dd/data/plugin/parser/inline_latex.py">revisions</a> |
  34 <a href="/moin/extensions/annotate/6aefd777e2dd/data/plugin/parser/inline_latex.py">annotate</a> |
  35 <a href="/moin/extensions/diff/6aefd777e2dd/data/plugin/parser/inline_latex.py">diff</a> |
  36 <a href="/moin/extensions/raw-file/6aefd777e2dd/data/plugin/parser/inline_latex.py">raw</a><br/>
  37 </div>
  38 
  39 <div class="title">data/plugin/parser/inline_latex.py</div>
  40 
  41 <div class="title_text">
  42 <table cellspacing="0">
  43 <tr>
  44  <td>author</td>
  45  <td>&#82;&#101;&#105;&#109;&#97;&#114;&#32;&#66;&#97;&#117;&#101;&#114;&#32;&#60;&#114;&#98;&#46;&#112;&#114;&#111;&#106;&#32;&#65;&#84;&#32;&#103;&#111;&#111;&#103;&#108;&#101;&#109;&#97;&#105;&#108;&#32;&#68;&#79;&#84;&#32;&#99;&#111;&#109;&#62;</td></tr>
  46 <tr>
  47  <td></td>
  48  <td>Tue Jun 07 08:35:12 2011 +0200 (2 weeks ago)</td></tr>
  49 
  50 <tr>
  51  <td>changeset 564</td>
  52  <td style="font-family:monospace"><a class="list" href="/moin/extensions/rev/6aefd777e2dd">6aefd777e2dd</a></td></tr>
  53 
  54 <tr>
  55 <td>parent 360</td>
  56 <td style="font-family:monospace">
  57 <a class="list" href="/moin/extensions/file/f57de7994cf6/data/plugin/parser/inline_latex.py">
  58 f57de7994cf6
  59 </a>
  60 </td>
  61 </tr>
  62 
  63 <tr>
  64  <td>permissions</td>
  65  <td style="font-family:monospace">-rw-r--r--</td></tr>
  66 </table>
  67 </div>
  68 
  69 <div class="page_path">
  70 ListPages: list_type of content introduced. It renders the selected pages content instead of the page titles.
  71 </div>
  72 
  73 <div class="page_body">
  74 
  75 <div style="font-family:monospace" class="parity0">
  76 <pre><a class="linenr" href="#l1" id="l1">     1</a> &quot;&quot;&quot;
  77 </pre>
  78 </div>
  79 <div style="font-family:monospace" class="parity1">
  80 <pre><a class="linenr" href="#l2" id="l2">     2</a> inline_latex is a parser that allows regular moin moin wiki syntax,
  81 </pre>
  82 </div>
  83 <div style="font-family:monospace" class="parity0">
  84 <pre><a class="linenr" href="#l3" id="l3">     3</a> but also latex style inline formulas like $...$ and latex style
  85 </pre>
  86 </div>
  87 <div style="font-family:monospace" class="parity1">
  88 <pre><a class="linenr" href="#l4" id="l4">     4</a> paragraph formulas like $$...$$. Note that in the latter case, you
  89 </pre>
  90 </div>
  91 <div style="font-family:monospace" class="parity0">
  92 <pre><a class="linenr" href="#l5" id="l5">     5</a> are (unlike in latex) limited to a single line. If you absolutely
  93 </pre>
  94 </div>
  95 <div style="font-family:monospace" class="parity1">
  96 <pre><a class="linenr" href="#l6" id="l6">     6</a> need multiple lines, use the parser directly.
  97 </pre>
  98 </div>
  99 <div style="font-family:monospace" class="parity0">
 100 <pre><a class="linenr" href="#l7" id="l7">     7</a> 
 101 </pre>
 102 </div>
 103 <div style="font-family:monospace" class="parity1">
 104 <pre><a class="linenr" href="#l8" id="l8">     8</a> Copyright 2005 Johannes Berg &lt;johannes@sipsolutions.net&gt;
 105 </pre>
 106 </div>
 107 <div style="font-family:monospace" class="parity0">
 108 <pre><a class="linenr" href="#l9" id="l9">     9</a>           2009 <a href="http://moinmo.in/ReimarBauer">MoinMoin:ReimarBauer</a> changed for 1.7.2/1.8 and the mathtran extension
 109 </pre>
 110 </div>
 111 <div style="font-family:monospace" class="parity1">
 112 <pre><a class="linenr" href="#l10" id="l10">    10</a> Released under GPLv2.
 113 </pre>
 114 </div>
 115 <div style="font-family:monospace" class="parity0">
 116 <pre><a class="linenr" href="#l11" id="l11">    11</a> &quot;&quot;&quot;
 117 </pre>
 118 </div>
 119 <div style="font-family:monospace" class="parity1">
 120 <pre><a class="linenr" href="#l12" id="l12">    12</a> import re
 121 </pre>
 122 </div>
 123 <div style="font-family:monospace" class="parity0">
 124 <pre><a class="linenr" href="#l13" id="l13">    13</a> from MoinMoin.parser import text_moin_wiki as wiki
 125 </pre>
 126 </div>
 127 <div style="font-family:monospace" class="parity1">
 128 <pre><a class="linenr" href="#l14" id="l14">    14</a> from MoinMoin import wikiutil
 129 </pre>
 130 </div>
 131 <div style="font-family:monospace" class="parity0">
 132 <pre><a class="linenr" href="#l15" id="l15">    15</a> 
 133 </pre>
 134 </div>
 135 <div style="font-family:monospace" class="parity1">
 136 <pre><a class="linenr" href="#l16" id="l16">    16</a> class Parser(wiki.Parser):
 137 </pre>
 138 </div>
 139 <div style="font-family:monospace" class="parity0">
 140 <pre><a class="linenr" href="#l17" id="l17">    17</a>     extensions = '*.tex'
 141 </pre>
 142 </div>
 143 <div style="font-family:monospace" class="parity1">
 144 <pre><a class="linenr" href="#l18" id="l18">    18</a>     scan_rules = wiki.Parser.scan_rules
 145 </pre>
 146 </div>
 147 <div style="font-family:monospace" class="parity0">
 148 <pre><a class="linenr" href="#l19" id="l19">    19</a>     scan_rules += ur'|(?P&lt;latex_formula&gt;\$[^$].*?(?&lt;!\\)\$)'
 149 </pre>
 150 </div>
 151 <div style="font-family:monospace" class="parity1">
 152 <pre><a class="linenr" href="#l20" id="l20">    20</a>     scan_rules += ur'|(?P&lt;latex_formula_para&gt;\$\$.*?(?&lt;!\\)\$\$)'
 153 </pre>
 154 </div>
 155 <div style="font-family:monospace" class="parity0">
 156 <pre><a class="linenr" href="#l21" id="l21">    21</a> 
 157 </pre>
 158 </div>
 159 <div style="font-family:monospace" class="parity1">
 160 <pre><a class="linenr" href="#l22" id="l22">    22</a>     scan_re = re.compile(scan_rules, re.UNICODE|re.VERBOSE)
 161 </pre>
 162 </div>
 163 <div style="font-family:monospace" class="parity0">
 164 <pre><a class="linenr" href="#l23" id="l23">    23</a> 
 165 </pre>
 166 </div>
 167 <div style="font-family:monospace" class="parity1">
 168 <pre><a class="linenr" href="#l24" id="l24">    24</a>     def __init__(self, raw, request, **kw):
 169 </pre>
 170 </div>
 171 <div style="font-family:monospace" class="parity0">
 172 <pre><a class="linenr" href="#l25" id="l25">    25</a>         wiki.Parser.__init__(self, raw, request, **kw)
 173 </pre>
 174 </div>
 175 <div style="font-family:monospace" class="parity1">
 176 <pre><a class="linenr" href="#l26" id="l26">    26</a>         self.formatter = request.formatter
 177 </pre>
 178 </div>
 179 <div style="font-family:monospace" class="parity0">
 180 <pre><a class="linenr" href="#l27" id="l27">    27</a>         self.request = request
 181 </pre>
 182 </div>
 183 <div style="font-family:monospace" class="parity1">
 184 <pre><a class="linenr" href="#l28" id="l28">    28</a>         self.args = kw.get('format_args', '')
 185 </pre>
 186 </div>
 187 <div style="font-family:monospace" class="parity0">
 188 <pre><a class="linenr" href="#l29" id="l29">    29</a>         self.mathtran_parser = wikiutil.importPlugin(self.request.cfg, 'parser', 'text_x_mathtran', 'Parser')
 189 </pre>
 190 </div>
 191 <div style="font-family:monospace" class="parity1">
 192 <pre><a class="linenr" href="#l30" id="l30">    30</a> 
 193 </pre>
 194 </div>
 195 <div style="font-family:monospace" class="parity0">
 196 <pre><a class="linenr" href="#l31" id="l31">    31</a>     def _latex_formula_repl(self, word, groups):
 197 </pre>
 198 </div>
 199 <div style="font-family:monospace" class="parity1">
 200 <pre><a class="linenr" href="#l32" id="l32">    32</a>         word = word[1:len(word)-1]
 201 </pre>
 202 </div>
 203 <div style="font-family:monospace" class="parity0">
 204 <pre><a class="linenr" href="#l33" id="l33">    33</a>         mp = self.mathtran_parser(word, self.request, format_args=self.args)
 205 </pre>
 206 </div>
 207 <div style="font-family:monospace" class="parity1">
 208 <pre><a class="linenr" href="#l34" id="l34">    34</a>         if mp.init_settings:
 209 </pre>
 210 </div>
 211 <div style="font-family:monospace" class="parity0">
 212 <pre><a class="linenr" href="#l35" id="l35">    35</a>             return mp.render(self.formatter)
 213 </pre>
 214 </div>
 215 <div style="font-family:monospace" class="parity1">
 216 <pre><a class="linenr" href="#l36" id="l36">    36</a> 
 217 </pre>
 218 </div>
 219 <div style="font-family:monospace" class="parity0">
 220 <pre><a class="linenr" href="#l37" id="l37">    37</a>     def _latex_formula_para_repl(self, word, groups):
 221 </pre>
 222 </div>
 223 <div style="font-family:monospace" class="parity1">
 224 <pre><a class="linenr" href="#l38" id="l38">    38</a>         mp = self.mathtran_parser(word, self.request, format_args=self.args)
 225 </pre>
 226 </div>
 227 <div style="font-family:monospace" class="parity0">
 228 <pre><a class="linenr" href="#l39" id="l39">    39</a>         if mp.init_settings:
 229 </pre>
 230 </div>
 231 <div style="font-family:monospace" class="parity1">
 232 <pre><a class="linenr" href="#l40" id="l40">    40</a>             return &quot;%s%s%s&quot; % (self.formatter.paragraph(1), mp.render(self.formatter), self.formatter.paragraph(0))
 233 </pre>
 234 </div>
 235 </div>
 236 
 237 <div class="page_footer">
 238 <div class="page_footer_text">moin/extensions</div>
 239 <div class="rss_logo">
 240 <a href="/moin/extensions/rss-log">RSS</a>
 241 <a href="/moin/extensions/atom-log">Atom</a>
 242 </div>
 243 <br />
 244 
 245 </div>
 246 </body>
 247 </html>

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2011-06-28 06:54:08, 16.0 KB) [[attachment:abstract_bohdalova-gregus.pdf]]
  • [get | view] (2011-06-24 17:28:34, 34.4 KB) [[attachment:abstract_jagr.pdf]]
  • [get | view] (2011-06-24 17:28:41, 55.0 KB) [[attachment:abstract_jaworski.pdf]]
  • [get | view] (2011-06-24 17:28:48, 43.2 KB) [[attachment:abstract_kolesarova-stupnanova.pdf]]
  • [get | view] (2011-06-27 14:59:38, 44.1 KB) [[attachment:abstract_komornik-komornikova.pdf]]
  • [get | view] (2011-06-27 14:59:46, 79.9 KB) [[attachment:abstract_lencuchova.pdf]]
  • [get | view] (2011-06-27 14:59:53, 72.0 KB) [[attachment:abstract_mesiar.pdf]]
  • [get | view] (2011-06-27 15:00:02, 76.5 KB) [[attachment:abstract_nanasiova-sabo.pdf]]
  • [get | view] (2011-06-27 15:00:16, 27.5 KB) [[attachment:abstract_pekarova.pdf]]
  • [get | view] (2011-06-27 15:00:24, 210.1 KB) [[attachment:abstract_petrickova.pdf]]
  • [get | view] (2011-06-27 15:00:31, 35.5 KB) [[attachment:abstract_rakonczai.pdf]]
  • [get | view] (2011-06-27 15:00:39, 101.0 KB) [[attachment:abstract_vavrikova.pdf]]
  • [get | view] (2011-06-24 09:17:15, 9.6 KB) [[attachment:inline_latex.py]]
  • [get | view] (2011-11-10 14:11:09, 58.9 KB) [[attachment:krems11-nanasiova.pdf]]
  • [get | view] (2011-08-18 02:17:34, 0.2 KB) [[attachment:latex_24925e0756fc270d86367c4f804c20aad87a233c_p1.png]]
  • [get | view] (2011-08-18 02:17:35, 0.4 KB) [[attachment:latex_2dc02c312052cc726386fceb8c1ebde539445060_p1.png]]
  • [get | view] (2011-08-18 02:17:35, 0.5 KB) [[attachment:latex_6eb308b86c212ec771a7ef1abc1ac639af9043bc_p1.png]]
  • [get | view] (2011-08-18 02:17:35, 0.4 KB) [[attachment:latex_c25fbeebcf97fb40ad02572636708ee729315e80_p1.png]]
  • [get | view] (2011-08-18 02:17:35, 0.4 KB) [[attachment:latex_d370e18d4ed1e99a1c8272a7d80cc6376a3037e9_p1.png]]
  • [get | view] (2011-08-18 02:17:34, 0.2 KB) [[attachment:latex_d66c4a8c6874ed37b5655b009f4f9c6d6dc7236d_p1.png]]
  • [get | view] (2011-08-18 02:17:35, 0.3 KB) [[attachment:latex_e561c94e3c6a271e84911d93917d1d094bf56d81_p1.png]]
  • [get | view] (2011-08-18 02:17:34, 0.6 KB) [[attachment:latex_f87cff447187424381f0cccdd051dce33433e149_p1.png]]
  • [get | view] (2011-08-18 02:17:34, 0.2 KB) [[attachment:latex_ff97188749819c527c4084e8c5ccf9c53ae9ff00_p1.png]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.