<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://performiq.com/kb/index.php?action=history&amp;feed=atom&amp;title=Python_txt2html</id>
	<title>Python txt2html - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://performiq.com/kb/index.php?action=history&amp;feed=atom&amp;title=Python_txt2html"/>
	<link rel="alternate" type="text/html" href="https://performiq.com/kb/index.php?title=Python_txt2html&amp;action=history"/>
	<updated>2026-05-18T11:35:59Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://performiq.com/kb/index.php?title=Python_txt2html&amp;diff=2165&amp;oldid=prev</id>
		<title>PeterHarding: New page: &lt;pre&gt; #!/usr/bin/python  &quot;&quot;&quot; txt2html.py, Version 4.5.00 (Update: 15.5.02) Python script  by Tobias Polzin, polzin@gmx.de  If you like the module, please give me feedback.  All rights rese...</title>
		<link rel="alternate" type="text/html" href="https://performiq.com/kb/index.php?title=Python_txt2html&amp;diff=2165&amp;oldid=prev"/>
		<updated>2008-05-24T07:31:19Z</updated>

		<summary type="html">&lt;p&gt;New page: &amp;lt;pre&amp;gt; #!/usr/bin/python  &amp;quot;&amp;quot;&amp;quot; txt2html.py, Version 4.5.00 (Update: 15.5.02) Python script  by Tobias Polzin, polzin@gmx.de  If you like the module, please give me feedback.  All rights rese...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
txt2html.py, Version 4.5.00 (Update: 15.5.02)&lt;br /&gt;
Python script  by Tobias Polzin, polzin@gmx.de&lt;br /&gt;
&lt;br /&gt;
If you like the module, please give me feedback. &lt;br /&gt;
All rights reserved. Rapid creation of HTML and TEX files from txt files with &lt;br /&gt;
the following syntax (indenting lines is used for scoping as in PYTHON): &lt;br /&gt;
&amp;gt;Headlines&lt;br /&gt;
&lt;br /&gt;
Normal text, _bold text_, *emphasised*&lt;br /&gt;
there are:&lt;br /&gt;
 - descriptions: this is a description text&lt;br /&gt;
   the identation is used as in python. &lt;br /&gt;
     * itemizes&lt;br /&gt;
     * unsorted lists&lt;br /&gt;
Converted to html: &lt;br /&gt;
Headlines&lt;br /&gt;
&lt;br /&gt;
Normal text, bold text, emphasised &lt;br /&gt;
there are: &lt;br /&gt;
  descriptions:&lt;br /&gt;
  this is a description text the identation is used as in python. &lt;br /&gt;
    itemizes &lt;br /&gt;
    unsorted lists &lt;br /&gt;
Converted to Latex: &lt;br /&gt;
% Generated by txt2html, polzin@gmx.de&lt;br /&gt;
% tt (05.05.2000)&lt;br /&gt;
\documentclass[a4paper]{article}&lt;br /&gt;
\usepackage[latin1]{inputenc}&lt;br /&gt;
\begin{document}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
\subsection*{Headlines}&lt;br /&gt;
&lt;br /&gt;
\\&lt;br /&gt;
Normal text, \textbf{bold text},  \emph{emphasised}&lt;br /&gt;
\\&lt;br /&gt;
there are:&lt;br /&gt;
\begin{description}&lt;br /&gt;
\item[descriptions:]&lt;br /&gt;
    this is a description text&lt;br /&gt;
   the identation is used as in python. &lt;br /&gt;
\begin{itemize}&lt;br /&gt;
\item&lt;br /&gt;
       itemizes&lt;br /&gt;
\item&lt;br /&gt;
       unsorted lists&lt;br /&gt;
\end{itemize}&lt;br /&gt;
\end{description}&lt;br /&gt;
\end{document}&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
from sys import argv,exit&lt;br /&gt;
from string import split&lt;br /&gt;
import time&lt;br /&gt;
import re&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
linescan = re.compile(r&amp;quot;(?P *(?P[*&amp;gt;-])? *)&amp;quot;+ r&amp;quot;(?P(?P&amp;#039;&amp;#039;&amp;#039;, r&amp;#039;&amp;#039;&amp;#039;%% Generated by txt2html, polzin@gmx.de %% %s \documentclass[a4paper]{article} \usepackage[latin1]{inputenc} \begin{document} &amp;#039;&amp;#039;&amp;#039;][tex] % (filename + &lt;br /&gt;
time.strftime(&amp;quot; (%d.%m.%Y)&amp;quot;, time.localtime(time.time())))&lt;br /&gt;
 &lt;br /&gt;
EXIT=[&amp;#039;&amp;#039;, r&amp;#039;\end{document}&amp;#039;][tex]&lt;br /&gt;
lastlen    = 80&lt;br /&gt;
lastindent = 0&lt;br /&gt;
indents    = []&lt;br /&gt;
bfison     = 0&lt;br /&gt;
 &lt;br /&gt;
f = open(filename,&amp;quot;r&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
print INTRO&lt;br /&gt;
&lt;br /&gt;
for l in f.readlines():&lt;br /&gt;
   m      = linescan.match(l) &lt;br /&gt;
   llen   = len(l)&lt;br /&gt;
   indent = len(m.group(&amp;quot;indent&amp;quot;))&lt;br /&gt;
   # print &amp;quot;% &amp;quot;+`m.group(&amp;quot;mode&amp;quot;)`,indent,lastindent&lt;br /&gt;
   &lt;br /&gt;
   if lastindentindent:&lt;br /&gt;
      while indents and indents[-1][1]&amp;gt;indent:&lt;br /&gt;
         print MODE[indents[-1][0]][2]&lt;br /&gt;
         del indents[-1] &lt;br /&gt;
         lastlen=maxlen&lt;br /&gt;
         lastindent=indent&lt;br /&gt;
         line=m.group(&amp;quot;line&amp;quot;)&lt;br /&gt;
         if m.group(&amp;quot;mode&amp;quot;): &lt;br /&gt;
            p=MODE[m.group(&amp;quot;mode&amp;quot;)][1]&lt;br /&gt;
            if &amp;quot;%&amp;quot; in p:&lt;br /&gt;
               if m.group(&amp;quot;title&amp;quot;): &lt;br /&gt;
                  p=p%m.group(&amp;quot;title&amp;quot;)&lt;br /&gt;
                  line=m.group(&amp;quot;notitle&amp;quot;)&lt;br /&gt;
               else:&lt;br /&gt;
                  p=p%line&lt;br /&gt;
                  line=&amp;quot;&amp;quot;&lt;br /&gt;
                  if p:&lt;br /&gt;
                     print p&lt;br /&gt;
                     llen=maxlen&lt;br /&gt;
                  elif (len(split(line))&amp;gt;0 and lastlen+len(split(line)[0])&amp;lt;maxlen):&lt;br /&gt;
                   &lt;br /&gt;
                     print BR&lt;br /&gt;
                     line=emphscan.sub(r&amp;quot; %s\1%s&amp;quot; % (EM[0],EM[1]),line) &lt;br /&gt;
                     line=bfscan.sub(bfinsert,line)&lt;br /&gt;
                     if len(line):&lt;br /&gt;
                        print &amp;quot; &amp;quot;*indent+line &lt;br /&gt;
                     lastindent=indent&lt;br /&gt;
                     lastlen=llen&lt;br /&gt;
                     print EXIT &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Python]]&lt;br /&gt;
[[Category:TeX]]&lt;/div&gt;</summary>
		<author><name>PeterHarding</name></author>
	</entry>
</feed>