Macros are special purpose keywords, that are expanded on conversion time. They are used to insert dynamic information, for example the current date or information about the document source.
A macro is represented by the %%
chars followed by its
name, such as %%date
. Some macros do accept an optional
formatting string inside parenthesis, right after the macro name, such
as %%date(%Y-%m-%d)
. This format string mixes common text
with special directives, identified by a percent sign % followed by an
identification character. If no format string is given, the default
format is used.
Macro Name | Expands to... | Default Format |
---|---|---|
%%date | The current date | %Y%m%d |
%%mtime | The source file modification time | %Y%m%d |
%%infile | The source file path | %f |
%%outfile | The output file path | %f |
%%toc | The document TOC (Table of Contents) | - |
General rules:
%%date
,
%%DaTe
and %%DATE
are identicalFull example (bold text are expanded macros):
This is the Txt2tags User Guide, converted to html by txt2tags from the userguide.t2t source file. The conversion was done at 2010-11-04 08:09:04, but the last change on the source document was made on 2010-10-31 00:26:16. Both source and converted file reside on the userguide directory.