w_doc_id(s2aimpl.man)dnl

This file is copyright (c) 2004,2005,2006 by Panu Kalliokoski
and released under the license in ../LICENSE

w_use(examples/reflection-disclaimer)

Definitions for man.  (Of course, we also use some raw troff and tbl.)

Metadata man-ism:
{{{
define(`w_section', `w_set_or_get(`@w_section', `$1')')
define(`w_man_desc',
`ifdef(`@w_man_has_desc',`.br',`.SH NAME')`'w_nl`'define(`@w_man_has_desc',t)'dnl
`ifelse(`$2',,`w_title \- $1`'', `$1 \- $2`'')')
}}}

Paragraphs and headings.

{{{
define(`w_softpara', `w_dump_footnotes(`.br`'w_nl`'',)`'dnl')
define(`w_paragraph', `.PP`'w_nl')
define(`w_headline',
`ifelse(`$1',1,`.SH $2',`$1',2,`.SS $2',
   `$1',3,`.PP`'w_nl.B $2',`.PP`'w_nl.SB $2')')
}}}

Block system environments.

Oh my god, do we do things by hand!  It almost makes me happy of all the
infrastructure we have for this.  Paragraphs within list items have to
be made special.  We do list numbering by hand.  List nesting is done
via RS and RE, but it should probably have more complicated rules.
{{{
w_define_env(`w_man_list',
`pushdef(`w_paragraph', `.IP "" 4`'w_nl`'').RS 4`'w_nl`'',
`.RE`'w_nl`'popdef(`w_paragraph')w_softopen')
w_derive_env(`-', `w_man_list', 0,,,,)
define(`w_listitem', `.IP \(bu 4`'w_nl\&')
w_derive_env(`#', `w_man_list', 0,
`w_newcounter(enumlist)',,,`w_delcounter(enumlist)')
w_define_env(`#i',
`w_stepcounter(enumlist).IP w_counter_arabic(enumlist). 4`'w_nl\&')')
w_define_env(`q', `.RS 8`'w_nl`'', `.RE`'w_nl`'')
define(`w_defnterm', `.TP`'w_nl`'\&$1`'')
w_define_env(`t',
`pushdef(`w_paragraph', `.TP`'w_nl\&w_nl`'')',
`popdef(`w_paragraph')')
w_define_env(`:',
`.RS 3`'w_nl`'',
`.RE`'w_nl`'w_softopen')
}}}

Other environments.

{{{
w_define_env(`litblock', `w_beg_para.nf`'w_nl\fC', `\fP`'w_nl.fi')
define(`w_footnotemark', `\&w_nl.SM [$1]w_nl\&')
w_define_env(center, `.ce 10000`'w_nl`'', `.ce 0`'w_nl`'')
w_define_env(comment,
`pushdef(`w_softbr', `.\" ')pushdef(`w_softpara', `.\"')`'w_nl.\"',
``'popdef(`w_softbr')popdef(`w_softpara')w_nl\&')
define(`w_caption', `.SM $1')
}}}

Emphasis.

{{{
define(`w_literal', `\fC`'$1\fP`'')
define(`w_emph', `\fI`'$1\fP`'')
define(`w_strong', `\fB`'$1\fP`'')
define(`w_quotation', `\(lq`'$1\(rq`'')
}}}

Other inlines.

{{{
define(`w_linebr', `w_nl`'.br')
define(`w_link', `$2`'w_footnote(`$1')')
define(`w_img', `\&w_nl.PSPIC "w_file(`$1.'w_picture_suffix)"w_nl\&')
define(`w_label', `$2')
define(`w_refer', `$2')
}}}

Tables.

tbl is very sensitive to white space.  We try to protect from errors,
but I really can't make sure that all combinations of markup and tables
work.

{{{
define(`w_make_tablespec',
`ifelse(`$*',,,`ifelse(`$1',p,l,`$1') w_make_tablespec(shift($@))')')
w_define_env(w_table,
`pushdef(`w_eline',` \')\&w_nl`'.TS`'w_nl`'w_make_tablespec($@).w_nl`'',
`\&w_nl`'.TE`'w_nl`'popdef(`w_eline')')
w_define_env(w_row,,
`undefine(`@w_in_row_flag')define(`w_eline',`define(`w_eline',` \')')')
w_define_env(w_cell,
`ifdef(`@w_in_row_flag',`	')define(`@w_in_row_flag',t)'dnl
`ifelse(`$2',p,`T{w_nl\&')',
`ifelse(`$2',p,`\&w_nl`'T}')')
define(`w_table_rule', `_')
}}}

Special and quoted characters.

{{{
define(`w_bldot', `\&.')
define(`w_bs', `\\')
define(`w_blap', `\&w_apo')
define(`w_emdash', `\`('em')
define(`w_endash', `\-')
define(`w_ellipsis', `.\|.\|.')
define(`w_copyrightsign', `\`('co')
define(`w_trademarksign', `\`('tm')
define(`w_rarrow', `\`('->')
define(`w_larrow', `\`('<-')
}}}
