m4_dnl Hey Emacs, this is really M4, but please use -*- autoconf -*- mode
m4_dnl
m4_dnl m4html.lib - lightweight web authoring helper
m4_dnl Copyright (C) 2000 Michael Weber
m4_dnl
m4_dnl This library is free software; you can redistribute it and/or
m4_dnl modify it under the terms of the GNU Library General Public
m4_dnl License as published by the Free Software Foundation; either
m4_dnl version 2 of the License, or (at your option) any later
m4_dnl version.
m4_dnl
m4_dnl This library is distributed in the hope that it will be useful,
m4_dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
m4_dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
m4_dnl GNU Library General Public License for more details.
m4_dnl
m4_dnl You should have received a copy of the GNU Library General
m4_dnl Public License along with this library; if not, write to the
m4_dnl Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
m4_dnl 02111-1307 USA
m4_dnl
m4_dnl -----------------------------------------------------------------------
m4_divert(-1)
m4_changequote([, ])
m4_changecom([])
m4_dnl -----------------------------------------------------------------------
m4_dnl site defaults
m4_dnl
m4_define([_M4HTML_PERL_COMMAND], [/usr/bin/perl -w])
m4_define([_M4HTML_SH_COMMAND], [/bin/sh])
m4_define([_M4HTML_DATE_COMMAND], [date --rfc-822])
m4_define([_M4HTML_TMP_DIR], [/tmp])
m4_define([_M4HTML_TMP_FILE_PREFIX], [m4html])
m4_define([_M4HTML_TMP_FILE], [_M4HTML_TMP_DIR/_M4HTML_TMP_FILE_PREFIX[]XXXXXXX])
m4_dnl -----------------------------------------------------------------------
m4_define([_m4html_temp_file], [m4_maketemp(_M4HTML_TMP_FILE)])
m4_m4wrap([m4_esyscmd([rm -f ]_M4HTML_TMP_DIR/_M4HTML_TMP_FILE_PREFIX[]*)])
m4_define([_m4html_err_args],
[m4_errprint([m4html: m4___file__:m4___line__: not enough arguments to $1
])m4_m4exit(1)])
m4_define([_m4html_esyscmd],
[m4_esyscmd([$1])]) m4_dnl | tr -d '\n'
m4_dnl -----------------------------------------------------------------------
m4_define([_TAGLINE], [m4___file__ - $1])
m4_define([_LGPL],
[Copyright (C) m4_ifelse($#, 2, [$2], [_m4html_esyscmd([date +%Y])]) $1.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA])
m4_define([_GFDL],
[Copyright (C) m4_ifelse($#, 2, [$2], [_m4html_esyscmd([date +%Y])]) $1.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts.
A copy of the license can be found at http://www.gnu.org/copyleft/fdl.html.])
m4_dnl -----------------------------------------------------------------------
m4_dnl hyperrefs markup:
m4_dnl
m4_define([_HREF],
[m4_pushdef([_tmp_link],
[m4_ifelse(m4_regexp([$1], [[. -]]),-1,
[$1],
[m4_translit([_href_$1], [. -], [___])])])m4_dnl
m4_define(_tmp_link,
[[$1]])m4_dnl
_tmp_link[]m4_dnl
m4_popdef(_tmp_link)])
m4_define([_EMAIL], [$1 <$2>])
m4_define([_m4html_concat_with_ampersand],
[m4_ifelse(
[$#],0,[],
[$#],1,[$1],
[$1&$0(m4_shift($@))])])
m4_dnl
m4_dnl requires commas to be escaped two times:
m4_dnl _MAILTO(name, email, [subject=foo[,] bar], cc=baz)
m4_dnl ^^^
m4_dnl
m4_define([_MAILTO],
[m4_pushdef([_tmp_args],
[_m4html_concat_with_ampersand(m4_shift(m4_shift($@)))])m4_dnl
$1m4_dnl
m4_popdef([_tmp_args])])
m4_define([_MAILTO_AUTHOR],
[_MAILTO([_AUTHOR_NAME], [_AUTHOR_EMAIL])])
m4_dnl -----------------------------------------------------------------------
m4_dnl Logical markup:
m4_dnl
m4_define([_m4html_multi_stmt],
[m4_ifelse(
[$#], 0, [],
[$#], 1, [$1],
[$#], 2, [<$1>$2$1>],
[<$1>$2$1>
_m4html_multi_stmt([$1], m4_shift(m4_shift($@)))])])
m4_define([_], [$1])
m4_define([_EM], [$1])
m4_define([_STRONG], [$1])
m4_define([_CITE], [$1])
m4_define([_PRE], [$1
])
m4_define([_CODE], [$1])
m4_define([_P], [_m4html_multi_stmt([p],$@)]) m4_dnl
m4_define([_ADDRESS],
[
$1
])
m4_dnl -----------------------------------------------------------------------
m4_dnl Physical markup:
m4_dnl
m4_define([_B], [$1])
m4_define([_I], [$1]])
m4_define([_S], [$1]])
m4_define([_SUB], [$1])
m4_define([_SUP], [$1])
m4_define([_TT], [$1])
m4_define([_U], [$1])
m4_define([_SMALL], [$1])
m4_define([_BIG], [$1])
m4_define([_CENTER], [_m4html_multi_stmt([center],$@)])
m4_define([_BR], [
])
m4_define([_ACRONYM],
[m4_changequote(`, ')m4_dnl
m4_patsubst(`$1', `\([A-Z]+\)', `_(\1)')`'m4_dnl
m4_changequote([, ])])
m4_dnl -----------------------------------------------------------------------
m4_dnl images:
m4_dnl
m4_define([_m4html_image_size],
[_m4html_esyscmd([imgsize -f 'width="%i" height="%i"' $1])])
m4_define([_IMG],
[
])
m4_dnl -----------------------------------------------------------------------
m4_dnl footnotes
m4_dnl
m4_define([_m4html_init_footnotes],
[m4_define([_m4html_footnote_counter], [0])m4_dnl
m4_define([_m4html_footnotes], [])])
_m4html_init_footnotes
m4_define([_FOOTNOTE],
[m4_define([_m4html_footnote_counter], m4_incr(_m4html_footnote_counter))m4_dnl
m4_pushdef([_tmp_name],[footnote-]m4_ifelse($2,,_m4html_footnote_counter,$2))m4_dnl
_m4html_footnote_counterm4_dnl
m4_define([_m4html_footnotes],
[]_m4html_footnotes[m4_dnl
]_m4html_footnote_counter[:
$1
])])
m4_define([_PRINT_FOOTNOTES],
[m4_ifelse(_m4html_footnotes,,,
[
_m4html_footnotes
])
_m4html_init_footnotes])
m4_dnl -----------------------------------------------------------------------
m4_dnl DTD stuff:
m4_dnl
m4_define([_DTD_LANG], [EN])
m4_define([_DTD_VENDOR], [IETF])
m4_define([_DTD_TYPE], [DTD HTML])
m4_define([_DOCTYPE],
[])
m4_dnl -----------------------------------------------------------------------
m4_dnl misc:
m4_dnl
m4_define([_HEADER],
[_DOCTYPE
$1
m4_ifelse($2,,,
[
])m4_dnl
m4_ifelse($3,,,
[
])m4_dnl
m4_ifelse($4,,,
[
])m4_dnl
m4_dnl
m4_m4wrap([
])])
m4_define([_BODY],
[m4_dnl
m4_m4wrap([_PRINT_FOOTNOTES
])])
m4_define([_LAST_UPDATED],
[
_ADDRESS([_MAILTO_AUTHOR])
Last updated: _m4html_esyscmd([date --rfc-822])
])
m4_dnl -----------------------------------------------------------------------
m4_dnl 'embedded' language hacks
m4_dnl
m4_define([_PERL],
[m4_divert(-1)
m4_pushdef([_tmp_file], _m4html_temp_file)
m4_esyscmd([cat <<]'__MARK__[]_tmp_file' >_tmp_file
# This file is generated by m4___file__
#
$1
__MARK__[]_tmp_file)
m4_divert(0)m4_dnl
_m4html_esyscmd(_M4HTML_PERL_COMMAND _tmp_file)[]m4_dnl
m4_dnl m4_esyscmd([rm -f ]_tmp_file)m4_dnl
m4_popdef([_tmp_file])])
m4_define([_SH],
[m4_divert(-1)
m4_pushdef([_tmp_file], _m4html_temp_file)
_tmp_file
m4_esyscmd([cat <<]'__MARK__[]_tmp_file' >_tmp_file
# This file is generated by m4___file__
#
$1
__MARK__[]_tmp_file)
m4_divert(0)m4_dnl
_m4html_esyscmd(_M4HTML_SH_COMMAND _tmp_file)[]m4_dnl
m4_esyscmd([rm -f ]_tmp_file)m4_dnl
m4_popdef([_tmp_file])])
m4_dnl -----------------------------------------------------------------------
m4_dnl make Emacs happy...
m4_dnl
m4_dnl Local Variables:
m4_dnl mode: autoconf
m4_dnl comment-start: "m4_dnl "
m4_dnl require-final-newline: nil
m4_dnl End:
m4_dnl final newline NOT ALLOWED HERE!
m4_divert[]m4_dnl
[]