diff options
author | wl <wl> | 2007-09-19 14:55:54 +0000 |
---|---|---|
committer | wl <wl> | 2007-09-19 14:55:54 +0000 |
commit | e4f206b8a3104ee734b913a2d50980bf5bdf3634 (patch) | |
tree | 814cb9652b873192c9648453480aa48f37c41271 /tmac/www.tmac | |
parent | e128c4d2011e4dce3bb8db70fdeb59816f839c40 (diff) | |
download | groff-e4f206b8a3104ee734b913a2d50980bf5bdf3634.tar.gz |
* doc/groff.texinfo: Document new .O register and add cross
reference entries.
* NEWS: Updated.
* src/devices/grohtml/grohtml.man: Document new -V and -y options.
* src/devices/grohtml/html-table.cpp: Add support for XHTML 1.1.
(html_table:: emit_colspan, html_table::emit_td): New methods.
(html_table::emit_col): Use html_table::emit_td.
(html_table::emit_table_header): Use html_table::emit_colspan if
dialect xhtml is specified.
(html_table::finish_row): Updated.
* src/devices/grohtml/html-table.h (html_table): Declare
emit_colspan, emit_td.
* src/devices/grohtml/html-text.cpp: Modified tags to comply with
xhtml if this dialect was requested.
* src/devices/grohtml/html-text.h (html_dialect): New enumeration.
(html_text): Add new variable `dialect'.
* src/devices/grohtml/post-html.cpp: Modify header tags to be XHTML
compliant.
(valid_flag, groff_sig, dialect): New global variables.
(html_printer::handle_valid_flag, html_printer::do_math,
html_printer::write_html_anchor, html_printer::write_xhtml_anchor,
html_printer::do_math, html_printer::handle_valid_flag): New
methods.
(html_printer::emit_line, html_printer::emit_raw,
html_printer::do_check_center, html_printer::write_title,
write_rule, html_printer::writeHeadMetaStyle, generate_img_src,
html_printer::begin_page): Altered to be XHTML compliant.
(html_printer::write_header): Updated.
(html_printer::troff_tag): Call do_math.
(html_printer::insert_split_file, html_printer::do_file_components,
html_printer::write_navigation): Create XHTML file components if
necessary and also produces a groff signature if requested.
(~html_printer): Call writeHeadMetaStyle at appropriate places
depending upon html_dialect.
(html_printer::special): Handle new tags `html<?p>' and `math<?p>'.
(main): Added options -x, -V, and -y.
(usage): Updated.
* src/preproc/eqn/box.cpp: Create a distinction between
the MathML device and the XHTML device.
(do_text): Issue a newline at the end of the equation if XHTML was
specified.
(box::top_level): Prefix the output of an equation by the .MATHML
macro.
(output_string): Suppress \n if XHTML was specified.
* src/preproc/eqn/main.cpp (xhtml): New global flag.
(inline_equation): Skip leading spaces after inline equation for
XHTML device.
(main): Set `xhtml' flag if `-Tmathml:xhtml' is specified.
* src/preproc/eqn/eqn.h (xhtml): New external flag.
* src/preproc/eqn/text.cpp (entity_table): Fix typo.
* src/preproc/html/pre-html.cpp (html_dialect): New enumeration.
(dialect, eqn_flag): New global variables.
(html_system): Improve debugging support.
(alterDeviceTo): Test for -Txhtml when altering device to the image
device and reset to -Txhtml.
(addZ): Renamed to...
(addArg): This.
Introducea a general parameter.
(print_args): New debugging function.
(char_buffer::run_output_filter): Use print_args and addArg rather
than addZ.
(char_buffer::do_html, char_buffer::do_image): Add -rxhtml=1 command
line parameter as an argument to the html generation of text when
xhtml is needed. Include -e on the command line if mathml is
required.
(scanArguments): Allow -e, -V, -y and -x options.
-V, -y are handled by the back end. -e sets `eqn_flag'.
-x determines HTML dialect.
* src/roff/groff/groff.cpp (possible_command): New method
`clear_name'.
(main): Set eflag if -e is present on command line.
Set is_xhtml if -Txhtml is present.
Pass `-x x' to the HTML pre and post processors.
Pass `-e' to the HTML pre processor if required.
Pass `-Tmathml:xhtml' to eqn if XHTML is requested.
* src/roff/troff/input.cpp (init_input_requests): Introduce new
number register `\n[.O]'.
* tmac/s.tmac: (LP): Use .nop for semantic sugar.
(cov*ab-init) reformat.
(@EQ): Use EQN-HTML-IMAGE and friends rather than HTML-IMAGE.
(CHECK-FOOTER-AND-KEEP): Define FS, FE such that they use
<cite></cite> for the html device rather than generate images for
footnotes.
* tmac/troffrc-end: Define EQN-HTML-IMAGE,
EQN-HTML-IMAGE-END, EQN-HTML-IMAGE-RIGHT,
EQN-HTML-IMAGE-LEFT, EQN-HTML-IMAGE-INLINE,
EQN-HTML-DO-IMAGE, EQN-HTML-IMAGE-END as null strings.
* tmac/www.tmac: (HTML<?p>): New macro.
(MATH<?p>): New macro.
(IMG, PIMG, MPIMG, HR): Use XHTML compliant syntax.
(www-emit-ltag): New macro.
(www-push-li): Updated.
(ULS): Ensure that tags are balanced in order by use of
www-emit-ltag.
(ULE): Likewise: Use www-emit-ltag and shut down paragraphs in
order.
(OLS, OLE, DLS, DLE): Ditto.
<global>: Define EQ and EN to EQN-HTML-IMAGE and EQN-HTML-IMAGE-END
respectively.
(www-li-ul, www-li-ol, www-li-dl): Updated.
(EQN-HTML-IMAGE, EQN-HTML-IMAGE-RIGHT, EQN-HTML-IMAGE-LEFT,
EQN-HTML-IMAGE-INLINE, EQN-HTML-DO-IMAGE, EQN-HTML-IMAGE-END,
MATHML): New macros.
Diffstat (limited to 'tmac/www.tmac')
-rw-r--r-- | tmac/www.tmac | 171 |
1 files changed, 139 insertions, 32 deletions
diff --git a/tmac/www.tmac b/tmac/www.tmac index 506b0ba6..d1c07936 100644 --- a/tmac/www.tmac +++ b/tmac/www.tmac @@ -301,6 +301,26 @@ www functionality. It should work with any macro set. . \} .. . +.\" +.\" emit an HTML tag. If text has been written in the paragraph +.\" then do not shut the paragraph down. +.\" If text was not written, remove the empty +.\" paragraph tag and emit the desired html tag. +.\" +.de HTML<?p> +. if \\n[www-html] .nop \&\X^html<?p>:\\$*^ +.. +. +.\" +.\" emit a MATH tag. If text has been written in the paragraph +.\" then do not shut the paragraph down. +.\" If text was not written, remove the empty +.\" paragraph tag and emit the desired math tag. +.\" +.de MATH<?p> +. if \\n[www-html] .nop \&\X^math<?p>:\\$*^ +.. +. .\" -------------------------------------------------------------------- .\" HX n .\" @@ -490,7 +510,8 @@ www functionality. It should work with any macro set. . if !'\\$4'' \ . nr www-height \\$4 . HTML <img src="\\$1" alt="Image \\$1" \ - width=\\n[www-width] height=\\n[www-height]> + "width=""\\n[www-width]""" \ + "height=""\\n[www-height]"""></img> . \} . el \ . nop \\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close] @@ -537,22 +558,22 @@ www functionality. It should work with any macro set. . ie (\\n[www-width] == 0) \{\ . ie (\\n[www-height] == 0) \ . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \ - "alt=""Image \\$1""></p>" + "alt=""Image \\$1"""></img></p>" . el \ . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \ "alt=""Image \\$1""" \ - height=\\n[www-height]></p> + "height=""\\n[www-height]"""></img></p> . \} . el \{\ . ie (\\n[www-height] == 0) \ . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \ "alt=""Image \\$1""" \ - width=\\n[www-width]></p> + "width=""\\n[www-width]"""></img></p> . el \ . HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \ "alt=""Image \\$1""" \ - width=\\n[www-width] \ - height=\\n[www-height]></p> + "width=""\\n[www-width]""" \ + "height=""\\n[www-height]"""></img></p> . \} . \} . el \{\ @@ -687,7 +708,7 @@ www functionality. It should work with any macro set. . . nr www-width 1i . nr www-height 1i -. ds www-size-specs width=\\n[www-width] height=\\n[www-height]\" +. ds www-size-specs width=""\\n[www-width]" height="\\n[www-height]" . ie !'\\$2'' \{\ . nr www-is-absolute 0 . nr www-absolute 0 @@ -698,13 +719,13 @@ www functionality. It should work with any macro set. . nr www-width (\\n[www-absolute] * \\n[.l] / 100) . if \\n[www-html] \ . nr www-width (\\n[www-width] * 100 / 240) -. ds www-size-specs width=\\*[www-percentage]\" +. ds www-size-specs width=\"\\*[www-percentage]" . \} . el \{\ . nr www-width \\n[www-absolute] . if \\n[www-html] \ . nr www-width (\\n[www-width] * 100 / 240) -. ds www-size-specs width=\\n[www-width]\" +. ds www-size-specs width=\"\\n[www-width]" . \} . . nr www-height \\n[www-width] @@ -718,13 +739,13 @@ www functionality. It should work with any macro set. . nr www-height (\\n[www-absolute] * \\n[.p] / 100) . if \\n[www-html] \ . nr www-height (\\n[www-height] * 100 / 240) -. ds www-size-specs \\*[www-size-specs] height=\\*[www-percentage]\" +. ds www-size-specs "\\*[www-size-specs] height="\\*[www-percentage]" . \} . el \{\ . nr www-height \\n[www-absolute] . if \\n[www-html] \ . nr www-height (\\n[www-height] * 100 / 240) -. ds www-size-specs \\*[www-size-specs] height=\\*[www-height]\" +. ds www-size-specs "\\*[www-size-specs] "height="\\*[www-height]" . \} . \} . \} @@ -732,11 +753,11 @@ www functionality. It should work with any macro set. . \" height not specified; use width value . ie !\\n[www-is-absolute] \{\ . \" percentage value -. ds www-size-specs \\*[www-size-specs] height=\\*[www-percentage]\" +. ds www-size-specs "\\*[www-size-specs] "height="\\*[www-percentage]" . nr www-height \\n[www-width] . \} . el \{\ -. ds www-size-specs \\*[www-size-specs] height=\\*[www-width]\" +. ds www-size-specs "\\*[www-size-specs] "height="\\*[www-width]" . nr www-height \\n[www-width] . \} . \} @@ -745,13 +766,13 @@ www functionality. It should work with any macro set. . ie !\\n[www-image-just] \ . HTML <img "src=""\\$1""" \ "alt=""Image \\$1""" \ - hspace=\\n[www-htmlimage-gap] \ - align=right \\*[www-size-specs]> + "hspace=""\\n[www-htmlimage-gap]""" \ + "align=""right"" \\*[www-size-specs]"""></img> . el \ . HTML <img "src=""\\$1""" \ "alt=""Image \\$1""" \ - hspace=\\n[www-htmlimage-gap] \ - align=left \\*[www-size-specs]> + "hspace=""\\n[www-htmlimage-gap]""" \ + "align=""left"" \\*[www-size-specs]"""></img> . \} . el \{\ . tm www-width is \\n[www-width] @@ -851,7 +872,7 @@ www functionality. It should work with any macro set. .\" Produce a horizontal line. .\" .de HR -. HTML</p> <hr> +. HTML</p> <hr></hr> .. . .\" -------------------------------------------------------------------- @@ -933,6 +954,7 @@ www functionality. It should work with any macro set. .de www-push-li . nr www-depth +1 . ds www-level\\n[www-depth] \\$1\" +. ds www-ltag\\n[www-depth] . als LI \\$1 .. . @@ -941,6 +963,18 @@ www functionality. It should work with any macro set. . als LI \\*[www-level\\n[www-depth]] .. . +.\" www-emit-ltag - shuts down a previous open list tag +.\" before issuing a new tag \\$1. +.\" It then records tag \\$1 is open. +. +.de www-emit-ltag +. if !'\\*[www-ltag\\n[www-depth]]'' \ +. HTML-NS </\\*[www-ltag\\n[www-depth]]> +. if !'\\$1'' \ +. HTML-NS <\\$1> +. ds www-ltag\\n[www-depth] \\$1 +.. +. .\" .\" Auxiliary macro for ULS. .\" @@ -984,11 +1018,12 @@ www functionality. It should work with any macro set. .de ULS . www-push-li www-li-ul . www-push-ul-level -. ie \\n[www-html] \ +. ie \\n[www-html] \{\ +. www-emit-ltag . HTML</p> <ul> -. el \{\ -. nr www-li-indent +\w'\\*[www-ul-level\\n[www-ul-level]]'u . \} +. el \ +. nr www-li-indent +\w'\\*[www-ul-level\\n[www-ul-level]]'u .. . .\" -------------------------------------------------------------------- @@ -997,8 +1032,10 @@ www functionality. It should work with any macro set. .\" End an unordered list. .\" .de ULE -. ie \\n[www-html] \ -. HTML </ul> +. ie \\n[www-html] \{\ +. www-emit-ltag +. HTML</p> </ul> +. \} . el \{\ . nr www-li-indent -\w'\\*[www-ul-level\\n[www-ul-level]]'u . in \\n[www-li-indent]u @@ -1015,9 +1052,11 @@ www functionality. It should work with any macro set. .de OLS . www-push-li www-li-ol . www-push-ol-level -. ie \\n[www-html] \ +. ie \\n[www-html] \{\ +. www-emit-ltag . HTML</p> <ol "style=""list-style-type:" \ "\\*[www-ol-level\\n[www-ol-level]]"">" +. \} . el \ . nr www-li-indent +\w'\\*[www-ol-tmp]'u .. @@ -1028,8 +1067,10 @@ www functionality. It should work with any macro set. .\" End an ordered list. .\" .de OLE -. ie \\n[www-html] \ +. ie \\n[www-html] \{\ +. www-emit-ltag . HTML </ol> +. \} . el \{\ . nr www-li-indent -\w'\\*[www-ol-tmp]'u . in \\n[www-li-indent]u @@ -1047,8 +1088,10 @@ www functionality. It should work with any macro set. .de DLS . www-push-li www-li-dl . nr www-dl-level +1 -. ie \\n[www-html] \ +. ie \\n[www-html] \{\ +. www-emit-ltag . HTML</p> <dl> +. \} . el \{\ . nr www-li-indent +\\n[www-dl-shift]u . in \\n[www-li-indent]u @@ -1061,8 +1104,10 @@ www functionality. It should work with any macro set. .\" End a definition list. .\" .de DLE -. ie \\n[www-html] \ +. ie \\n[www-html] \{\ +. www-emit-ltag . HTML </dl> +. \} . el \{\ . nr www-li-indent -\\n[www-dl-shift]u . in \\n[www-li-indent]u @@ -1081,7 +1126,7 @@ www functionality. It should work with any macro set. .\" .de www-li-ul . ie \\n[www-html] \ -. HTML-NS <li> +. www-emit-ltag li . el \{\ . www:paraspace . in \\n[www-li-indent]u @@ -1095,7 +1140,7 @@ www functionality. It should work with any macro set. .\" .de www-li-ol . ie \\n[www-html] \ -. HTML-NS <li> +. www-emit-ltag li . el \{\ . www:paraspace . in \\n[www-li-indent]u @@ -1110,7 +1155,7 @@ www functionality. It should work with any macro set. .de www-li-dl . ie \\n[www-html] \{\ . HTML <dt>\\$1</dt> -. HTML-NS <dd> +. www-emit-ltag dd . \} . el \{\ . www:paraspace @@ -1179,8 +1224,8 @@ www functionality. It should work with any macro set. .\" .do if !d TS .do ds TS HTML-IMAGE\" .do if !d TE .do ds TE HTML-IMAGE-END\" -.do if !d EQ .do ds EQ HTML-IMAGE\" -.do if !d EN .do ds EN HTML-IMAGE-END\" +.do if !d EQ .do ds EQ EQN-HTML-IMAGE\" +.do if !d EN .do ds EN EQN-HTML-IMAGE-END\" . .\" .\" supplementary macros used by other macro sets @@ -1245,6 +1290,61 @@ www functionality. It should work with any macro set. . HTML-DO-IMAGE \\*[www-unique-name] i .. . +.\" EQN-HTML-IMAGE and friends check to see whether the equation is +.\" not in an image, in which case it allows html +.\" (mathml) to be generated (if -Txhtml was specified). +. +.de EQN-HTML-IMAGE +. \" generates a centered image +. www-make-unique-name +. EQN-HTML-DO-IMAGE \\*[www-unique-name] c +.. +. +.de EQN-HTML-IMAGE-RIGHT +. www-make-unique-name +. EQN-HTML-DO-IMAGE \\*[www-unique-name] r +.. +. +.de EQN-HTML-IMAGE-LEFT +. www-make-unique-name +. EQN-HTML-DO-IMAGE \\*[www-unique-name] l +.. +. +.de EQN-HTML-IMAGE-INLINE +. www-make-unique-name +. EQN-HTML-DO-IMAGE \\*[www-unique-name] i +.. +.\" -------------------------------------------------------------------- +.\" EQN-HTML-DO-IMAGE - tells troff to issue an image marker which can be +.\" read back by pre-html +.\" +.de EQN-HTML-DO-IMAGE +. ie r xhtml \{\ +. if !(\\n[.O] == 0) \{\ +. if r ps4html \ +. nop \O[5\\$2\\$1.png]\O[1]\O[3] +. if \\n[www-html] \ +. nop \O[5\\$2\\$1.png]\O[0]\O[3] +. \} +. \} +. el .HTML-DO-IMAGE \\$* +.. +. +.\" -------------------------------------------------------------------- +.\" EQN-HTML-IMAGE-END - terminates an image for html +.\" +.de EQN-HTML-IMAGE-END +. ie r xhtml \{\ +. if !(\\n[.O] == 0) \{\ +. if r ps4html \ +. nop \O[4]\O[2]\O[0] +. if \\n[www-html] \ +. nop \O[4]\O[2]\O[1] +. \} +. \} +. el .HTML-IMAGE-END +.. +. .\" -------------------------------------------------------------------- .\" JOBNAME .\" @@ -1389,6 +1489,13 @@ www functionality. It should work with any macro set. . ds www:close \\$2\" .. . +.\" MATHML - enable eqn mathml output to pass through to the device +.\" driver +. +.de MATHML +. if (\\n[.O] == 0) .MATH<?p> \\$* +.. +. .\" -------------------------------------------------------------------- .\" Final Setup .\" -------------------------------------------------------------------- |