Category Archives: Site

New hot document: Tips & Tricks

In txt2tags, you ever wondered how to:

  • Make strike, subscript or superscript text?
  • Insert the ALT text for images?
  • Create a custom DIV or SPAN?
  • Make a line break <BR>?
  • Load extra LaTeX packages?
  • Make colored code snippets?

Fear don’t. Txt2tags Tips & Tricks!

Leave a comment to share your own tip or suggest a new!

Advertisements

Using HTMLDOC to split HTML in multiple pages

You have that really big HTML page that takes forever to load on the browser? What about to break it in smaller pieces, one topic per page? The HTMLDOC tool can make it for you.

The main purpose of this tool is to do the opposite: join multiple HTML files into one single PDF file. It has a huge list of options, so you have strong control over the process, like setting fonts, header and footer, automatic Table of Contents, insert a cover page and more.

The txt2tags User Guide PDF is generated from a big HTML file by HTMLDOC.

The latest version comes with a new target called “htmlsep”, that takes an structured HTML page (full of <H1>, <H2>) and breaks it into multiple pages. This is the command line usage:

htmldoc -t htmlsep -o output-folder file.html

Note that it’s required that you create a folder for the generated files, before running the command. Let’s break some files? Here’s a quick sample HTML file with some headings:

<html>
<body>
<h1>Greatest Bands Ever</h1>
  <h2>Punk Rock</h2>
  RAMONES.
  <h2>Softcore</h2>
  Millencolin, No Fun At All, No Use For A Name, ...
  <h2>Other</h2>
  Toy Dolls, Operation Ivy, Face to Face, ...

<h1>Greatest Movies Ever</h1>
  <h2>Documentary</h2>
  Dogtown And Z-Boys, Riding Giants, Step Into Liquid, ...
  <h2>Strange</h2>
  Cube

</body>
</html>

Follow me:

$ ls -F
greatest.html  output/

$ htmldoc -t htmlsep -d output greatest.html 
BYTES: 715
BYTES: 1135
BYTES: 883
BYTES: 1024
BYTES: 1030
BYTES: 1059
BYTES: 998
BYTES: 1074
BYTES: 896

$

Before that command, we’ve had just the HTML file and an empty folder. When running HTMLDOC it shows those “BYTES” lines to inform you everything is OK. Now, let’s check what we have on the output folder:

$ ls output/
Documentary.html        Other.html              Strange.html
GreatestBandsEver.html  PunkRock.html           index.html
GreatestMoviesEver.html Softcore.html           toc.html

Great! Each heading went to its own file, named accordingly. The extra files are “index.html” and “toc.html”, that holds the cover page and the Table of Contents. All the pages have the following navigation links: Contents, Previous, Next, so you can browse them in a sequence.

Handy, simple and fast.

You may play with other options to customize the files:

$ htmldoc -t htmlsep -d output \\
	--no-title --toclevels 2 --toctitle "Contents" \\
	greatest.html 

Remember that big old User Guide in HTML that has hanging around on the txt2tags site? Now it is separated in multiple files. If you prefer the all-in-one version, download the PDF (see About topic).

Note 1: HTMLDOC has no support for CSS. You’ll have to add the <link> tag to the generated files.

Note 2: HTMLDOC reads the file data since the first heading. Use a %!postproc to remove the <H1>Page Title</H1> line when converting to HTML.

Note 3: Download HTMLDOC from www.htmldoc.org, which is the free Open Source version. If you’re in Linux search for “htmldoc” in your package manager. On the Mac you can find it on Fink, or download and compile the sources (it’s quick). Windows users may have to install the commercial demo from Easy Software.

New green site

We’ve had enough of that gray/blue scary site, don’t we? The new txt2tags site is green and was redesigned from scratch.

The problem with the old site (besides its ugliness) was that the menu only appeared in the main page. You follow any link, the menu vanishes. Don’t blame me, I’m a programmer, not a webmaster :)

But this year I’ve learned some web things and the site was improved. Now we have an uniform layout for all pages, with a top header, a menu on the right and a little footer. The light colors are following the Web 2.0 hype. Oh, well…

New txt2tags site

What really matters is that the site is 100% powered by txt2tags.

It’s a showcase of what you can do with the program. All the sources are available and commented, so everybody can study and copy them.

There are some magic involved, using smart filters (PreProc & PostProc), many includes and lots of CSS wizardry. But the outline is simple, using centralized files included by all pages:

  • config.t2t: The default options and filters, the URL database.
  • menu.t2t: The menu links.
  • footer.t2t: The page footer with modification time and link to the sources.

So when creating a new page, all you have to do is:

    My Dogs Page
    Everything about dogs

    %!includeconf: config.t2t
    %!include: menu.t2t

    Content goes here.

    %!include: footer.t2t

On the CSS file you position everything, set sizes and colors. That nice square that points to the current active link on the menu is also made on the CSS.

Now everything is easier to change, user navigation is natural and all the HTML is valid. If you’ve found all that interesting, feel free to use the txt2tags site sources as a starting point for your own site.

By no means I’m a web guru. Any comments about the new site, suggestions and improvements are very welcome!

Blog? Blog.

Hi there.

This is the new place to stay in touch with the latest news about the txt2tags project. Releases, files, documents, translations, site updates.

The good old do-it-yourself news/RSS by hand worked until today, but using a Blog system like WordPress, we get some advantages:

  • Feeds (RSS) with HTML code. The old “by hand” was text-only.
  • Automatic feeds for: whole blog, each category, each post, all comments, comments by post.
  • Permanent (readable) URL for each post, important to keep things organized and easy to find.
  • Multiple categories (tags) to mark each post, so you can monitor just want interests you.
  • And more.

Talking about feeds, subscribe to the txt2tags blog now!

But my favorite feature is having comments for each post. Now everybody can talk and contribute, changing the monologue to a nice conversation.

It’s up and running. Enjoy!

Note: Here are the older news, just in case.