tulrich.com
☰ Menu+  instagram  tuffy  ringing ear  rentals 

geekstuff | gameswf | Textweb | Chunked LOD | dumbuild

Cheat sheets: CVS | cygwin | Debian | Emacs | MythTV

Textweb

Sick of HTML? Want to write your web pages with a plain-text like markup language? Here's a not-too-big Perl script that rewrites simple text formatting on the fly to generate HTML.

Ideas stolen blatantly from Wiki, LaTeX, Zope structured text, make-doc-pro, Almost Free Text etc. Nevertheless all of those are too heavyweight or have other drawbacks (like the markup is not enough like plain-text for my taste).

The implementation is pretty crummy at the moment, but it's already usable and serving my immediate purposes.

Philosophy

Code

Here is the textweb.pl script source, including installation notes and markup description.


Markup

Here are some examples of markup. You can see the source for this page here. You can view the .txt source for many of the pages on this site (i.e. the ones processed with Textweb) by just replacing the ".html" extension in the URL with ".txt".

sourcemarked up
A bare link to some web page:
http://tulrich.com.

A bare link to some web page: http://tulrich.com.

Some inline
[[http://tulrich.com][linked text]].

Some inline linked text.

A bulleted list:

  * Item 1

  * Item 2

  * Another item, let's call it 3

A bulleted list:

  • Item 1

  • Item 2

  • Another item, let's call it 3

``some curly quotes''

“some curly quotes”

*some emphasis*

some emphasis

_some underlining_

some underlining

How about /some italics./

How about some italics.

A horizontal rule
-------------------
Line above.

A horizontal rule

Line above.

Heading
=======

Heading

Some paragraph text.

Some symbols: A > B & C < D

Some paragraph text.

Some symbols: A > B & C < D

---- some inline code ----
for (int i = 0; i < 10; i++)
{
	printf("the number %d\n", i);
}
---- end inline code ----
---- some inline code ----
for (int i = 0; i < 10; i++)
{
	printf("the number %d\n", i);
}
---- end inline code ----

How To Blog

You can blog with Textweb any way you feel like, but if you want to get an Atom feed for free, format your posts like so:

[... anything; header formatting, etc ...]

\atom_author{Your Name Here}

----------------------------------------------------------------------
5 May 2003

*Post Title Here*

Type your post text here, use whatever formatting you like, etc.  End
your post and start the next one with a horizontal bar.

----------------------------------------------------------------------

10 April 2003

*And So On*

More hot blog here.
----------------------------------------------------------------------

[... any footer junk that doesn't have an obvious date line won't generate entries...]

Link to your Atom feed by replacing your ".html" extension with ".xml". For an example, peek at my blog source at http://tulrich.com/index.txt and http://tulrich.com/rants-2005.txt, and the resulting Atom feed, http://tulrich.com/index.xml .

tu@tulrich.com |