aboutsummaryrefslogtreecommitdiff
path: root/man
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-06-02 22:52:40 +1200
committerTom Ryder <tom@sanctum.geek.nz>2017-06-02 23:01:28 +1200
commite69db9954057b6df99e8e666b199e499aec12007 (patch)
treeeaa51d95cb1ae762114f050b1ea79f1466a532f6 /man
parentCorrect mi5(1df) man page formatting (diff)
downloaddotfiles-e69db9954057b6df99e8e666b199e499aec12007.tar.gz
dotfiles-e69db9954057b6df99e8e666b199e499aec12007.zip
Implemented an idea
Slightly cleverer parsing for mi5
Diffstat (limited to 'man')
-rw-r--r--man/man1/mi5.1df34
1 files changed, 20 insertions, 14 deletions
diff --git a/man/man1/mi5.1df b/man/man1/mi5.1df
index 7782ebce..04f964c1 100644
--- a/man/man1/mi5.1df
+++ b/man/man1/mi5.1df
@@ -20,21 +20,23 @@ and predictable for its author, who wants badly to like m4 but doesn't. It's
primarily intended for situations where the majority of a file is simple static
text, and only a few simple macros need to be defined and expanded, which
covers almost every usage case for the author. It's written to work with any
-POSIX m4.
+POSIX awk and to generate output for any POSIX m4.
.P
mi5 inverts m4's usual approach by approaching most of the file as if it were
part of an m4 quote, with <% and %> as the delimiters to specify markers in
-which macro expansion should occur. This makes m4 work in a way reminiscent of
-templating libraries or languages like PHP.
+which macro expansion should occur. This is therefore a way to shoehorn m4 into
+working in a way reminiscent of templating libraries or languages like PHP.
.P
Macros can be expanded as blocks:
.P
<%
- define(`FOO', `bar')
- define(`BAZ', include(`include/quux.inc')
- ?>
+
+ define(`FOO', `bar')
+ define(`BAZ', include(`include/quux.inc')
+
+ %>
.P
-For this format, "dnl" macros to delete newlines for each declaration are
+For this format, `dnl' macros to delete newlines for each declaration are
inserted for you. Blank lines are skipped, and leading and trailing spaces are
ignored. The above code therefore produces no actual output, as it only has two
define calls.
@@ -44,15 +46,19 @@ For inline expansion, the syntax is similar, but the behaviour slightly differen
The value of the FOO macro is <% FOO %>.
.P
Spaces immediately after the opening delimiter and before the closing delimiter
-are ignored, but spaces produced within the macro are preserved.
+are ignored, but spaces produced within the macro are preserved. `dnl` macros
+are not inserted for inline blocks.
.P
-Ideally, you do macro definition in an mi5 block at the top of your file, and
-very simple macro expansion in an mi5 inline.
+Ideally, you do your complex macro definition in a block at the top of your
+file, and your simple macro expansion of those results in an inline.
.SH CAVEATS
-Only very simple macro expansions work in inline calls at the moment. This can
-be fixed by the author tokenizing the line properly, which he'll do Real Soon
-Now (TM). Specifically, quote delimiters do not work.
+The <% delimiters %> are hardcoded for now.
+.P
+Inline expansions cannot span multiple lines. Use blocks for that.
+.P
+Doesn't cope at all with `changequote'. If you need that, you should probably
+write raw m4.
.SH SEE ALSO
-bp(1df), xargs(1)
+m4(1)
.SH AUTHOR
Tom Ryder <tom@sanctum.geek.nz>