Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to convert some webpages to nicely formatted Latex documents. The webpage is a discussion forum, with deeply nested comments. Before I begin to write my own naive implementation, are there any tools/scripts which help with such html->latex structure transformation. For example, suppose a thread hierarchy is a simple ul li nesting , I need a tool that helps me put it into itemize blocks. And if possible, even for more complex div and span nesting.

Here is an example to make it more explicit:

<ul>
 <li>I am a parent comment of the root post. This is my opinion.</li>
 <ul>
     <li> I disagree with the parent and these are my opinions.</li>
     <ul>
         <li> Your opinion is wrong because of such and such facts. </li>
         <ul>
             <li> I am a deeply nested comment </li>
         </ul>
         <li> I agree, I also disagree with parent comment. </li>
     </ul>
  <li> I am another parent comment to the root post </li>
<ul>

To convert this to

\begin{itemize}
    \item I am a parent comment of the root post. This is my opinion.
    \begin{itemize}
        \item I disagree with the parent and these are my opinions.
        \begin{itemize}
            \item Your opinion is wrong because of such and such facts.
            \begin{itemize}
                 \item I am a deeply nested comment.
            \end{itemize}
            \item  I agree, I also disagree with parent comment.             
        \end{itemize}
    \end{itemize}
    \item I am another parent comment to the root post 
\end{itemize}

enter image description here

share|improve this question

closed as too localized by Martin Schröder, Qrrbrbirlbel, Stefan Kottwitz Apr 6 '13 at 22:20

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
One way is to parse the webpage to some internal representation, and convert that to LaTeX. Examples of that kind of tools include Pandoc (Haskell) and Kramdown (Ruby). –  morbusg Jul 5 '12 at 4:03
    
@morbusg do you know of alternatives for python/C/C++ ? Kramdown looks good. –  yayu Jul 5 '12 at 4:07
    
ConTeXt can directly parse and typeset XML (and, by extension, XHTML). See for example dl.contextgarden.net/myway/tas –  Aditya Jul 5 '12 at 7:04
    
@yayu: sorry, I don't remember seeing one. –  morbusg Jul 5 '12 at 15:25

Browse other questions tagged or ask your own question.