1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
r"""
embed package
To use the embed package, include the following code in your latex document.
It will define the HTML environment and the \html command. The HTML
environment is exactly the same as the comment environment. The \html
command acts like the \verb command in that it will eat up all content
between two matching characters (e.g., \html+<b>bold text</b>+). In
plasTeX, the content of both of these macros will appear in the output
document as-is.
\newif\ifplastex\plastexfalse
\ifplastex
\\usepackage{embed}
\else
\\usepackage{comment}\excludecomment{HTML}
\def\html#1{\def\@html##1#1{}\@html}
\fi
Example:
before \html+<span style="color:red">red text</span>+ after
before
\begin{HTML}
<div style="background-color:blue; color:white">
<p>line 1</p>
<p><b>line 2</b></p>
</div>
\end{HTML}
after
"""
from plasTeX.DOM import Text
from plasTeX.Base.LaTeX.Verbatim import verbatim
from plasTeX.Base.LaTeX.Verbatim import verb
class HTML(verbatim):
captionable = True
blockType = False
def digest(self, tokens):
verbatim.digest(self, tokens)
self.str = Text(''.join(self))
self.str.isMarkup = True
return []
class XHTML(HTML):
pass
class html(verb):
args = ''
def digest(self, tokens):
verb.digest(self, tokens)
self.str = Text(''.join(self))
self.str.isMarkup = True
return []
class xhtml(html):
pass
|