Home... Help... Search... Computers... Quotes... WakkyPedia...


Txt2Tags - Write Once, Many Formats, Easy HTML

Txt2Tags

Txt2tags is a wonderful tool for creating html format files (ie, web pages). I use it extensively for creating the pages on this website. Just create a text file with your content and some simple markup, feed it into txt2tages and you have a web page. The resulting html is very portable, with no fancy bits that tend to trick many browsers (especially on mobile phones) into displaying garbled content.

You do sacrifice some control over format, but the ease of creating and adjusting many pages more than offsets this, in my opinion.

Txt2tags is written in Python and can be used on Linux, Mac or Windows.

An Example

Once txt2tags has been installed, you run it like this on the command line:- e.g.

~/temp $ txt2tags -t html --style=modern.css IamFondOfPigs.txt

which then creates IamFondOfPigs.html

Sample Source File

I am fond of pigs
Last updated: %%mtime(%d %b %Y)
 
%!options: --toc
-----------------------------------
[Home... index.html]
[Help... help.html]
[Search... search.html]
[Quotes... Quotes.html]
[WakkyPedia... WakkyPedia.html]
-----------------------------------
I am fond of pigs

 [misc/Pig-800px-Pig_in_a_bucket-ccbysa-Ben_Salter-wikipedia.jpg] 

	"I am fond of pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - //Winston Churchill//

 [misc/Pig_USDA01c0116-pd-wmc1w.jpg] 
-----------------------------------
[Home... index.html]
[Help... help.html]
[Search... search.html]
[Quotes... Quotes.html]
[WakkyPedia... WakkyPedia.html]
-----------------------------------
This page http://tardus.net/IamFondOfPigs.html
published: 27 May 2014    
= About Tardus =
[Contact me, "Tardus" contactMe.html]
[Copyright copyright.html]
[[misc/t2tpowered-white.png] http://txt2tags.org] [powered by txt2tags http://txt2tags.org]
=Search tardus.net=
[misc/triSearchIcon.jpg] 
''<form action="/cgi-sys/entropysearch.cgi" target=searchwindow>''
''Search tardus.net <input type="text" name="query" value="">''
''<input type="hidden" name="user" value="tardusne">''
''<input type="hidden" name="basehref" value="http://tardus.net">''
''<input type="hidden" name="template" value="default">''
''<input type="submit" value="Search">''
''</form>''

Creating a Printable PDF file

Txt2tags cannot directly create PDF output. The best way I found is to use the wkhtmltopdf convertor as follows:-

~/temp $ wkhtmltopdf IamFondOfPigs.html IamFondOfPigs.pdf

How I Use It

I have set of BASH shell scripts that create the source "t2t" text files for me, from an even more simple set of article files (also plain text). The scripts add in the markup and content for menus, etc. Here is an example:-

I am fond of pigs

 [misc/Pig-800px-Pig_in_a_bucket-ccbysa-Ben_Salter-wikipedia.jpg] 

	"I am fond of pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - //Winston Churchill//

 [misc/Pig_USDA01c0116-pd-wmc1w.jpg] 

Home... Help... Search... Computers... Quotes... WakkyPedia...


This page http://tardus.net/txt2tags.html published: 11 November 2015 published: 27 May 2014

About Tardus

Contact me, "Tardus" Copyright powered by txt2tags

Search tardus.net

Search tardus.net