Module: HParser::Latex
- Included in:
- Block::Dl, Block::Head, Block::ListItem, Block::OrderList, Block::P, Block::Pre, Block::Quote, Block::SuperPre, Block::TableCell, Block::TableHeader, Block::UnorderList
- Defined in:
- lib/hparser/latex.rb
Overview
This module provide to_latex
method. This method is intended to convert hatena format to LaTeX format.
For example:
Hatena::Parser.parse('*foo').to_latex # -> \section{foo}
Hatena::Parser.parse('>|bar|<').to_latex # -> \begin{verbatim} <\n> bar <\n> \end{verbatim}
Unlike html, LaTeX phrase cannot be separated with tag and conent. so common methods, such like tag_name and html_content, are not always used. Only to_latex method is commonly impletemted. If content is Arary
,each elements convert to LaTeX by to_latex
. Otherwise,using as it self.
Instance Method Summary collapse
Instance Method Details
#to_latex ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/hparser/latex.rb', line 22 def to_latex content = latex_content if content.class == Array then content = content.map{|x| x.to_latex}.join end content end |