From 4083b9ac03baf5b89b006ea8949c81f43922efa0 Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Fri, 15 Jan 2010 15:07:32 +0000 Subject: [PATCH] Cherry-pick unreleased vendor changes to mdoc: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit : 2009-10-26 Werner LEMBERG : : * tmac/doc-common (Dx): Define register. : : 2009-10-26 Jörg Sonnenberger : : Implement `%U' in mdoc for URL references. : : * tmac/doc-common (%U): New register. : (Rd): Handle `doc-url-count' and `doc-url-name'. : : * tmac/doc.tmac (doc-url-count, doc-url-name): New registers. : (doc-save-global-vars, doc-restore-global-vars, doc-reset-reference, : doc-print-reference): Handle `doc-url-count' and `doc-url-name'. : (%U): New macro. : : * NEWS, tmac/groff_mdoc.man: Document `%U' macro. : : 2009-04-01 Werner LEMBERG : : * tmac/doc.tmac: Call `ec' before mapping characters. --- tmac/doc-common | 4 +++ tmac/doc.tmac | 77 ++++++++++++++++++++++++++++++++++++++++++--- tmac/groff_mdoc.man | 2 ++ 3 files changed, 79 insertions(+), 4 deletions(-) diff --git a/tmac/doc-common b/tmac/doc-common index 8b1afa5674bb..ff99165ef63b 100644 --- a/tmac/doc-common +++ b/tmac/doc-common @@ -46,6 +46,7 @@ .nr %Q 1 .nr %R 1 .nr %T 1 +.nr %U 1 .nr %V 1 .nr Ac 3 .nr Ad 12n @@ -77,6 +78,7 @@ .nr Dq 12n .nr Ds 6n\" many manpages still use this as a -width value .nr Dv 12n +.nr Dx 1 .nr Ec 3 .nr Ef 8n\" ? .nr Ek 8n\" ? @@ -1170,6 +1172,8 @@ . tm doc-reference-title-count == \n[doc-reference-title-count] . tm doc-reference-title-name == `\*[doc-reference-title-name]' . tm doc-reference-title-name-for-book == `\*[doc-reference-title-name-for-book]' +. tm doc-url-count == \n[doc-url-count] +. tm doc-url-name == `\*[doc-url-name]' . tm doc-volume-count == \n[doc-volume-count] . tm doc-volume-name == `\*[doc-volume-name]' . tm doc-have-author == \n[doc-have-author] diff --git a/tmac/doc.tmac b/tmac/doc.tmac index 3fde369a0bde..017835e00bf0 100644 --- a/tmac/doc.tmac +++ b/tmac/doc.tmac @@ -3430,6 +3430,8 @@ . nr doc-reference-title-count-saved \n[doc-reference-title-count] . ds doc-reference-title-name-saved "\*[doc-reference-title-name] . ds doc-reference-title-name-for-book-saved "\*[doc-reference-title-name-for-book] +. nr doc-url-count-saved \n[doc-url-count] +. ds doc-url-name-saved "\*[doc-url-name] . nr doc-volume-count-saved \n[doc-volume-count] . ds doc-volume-name-saved "\*[doc-volume-name] . nr doc-have-author-saved \n[doc-have-author] @@ -3570,6 +3572,8 @@ . nr doc-reference-title-count \n[doc-reference-title-count-saved] . ds doc-reference-title-name "\*[doc-reference-title-name-saved] . ds doc-reference-title-name-for-book "\*[doc-reference-title-name-for-book-saved] +. nr doc-url-count \n[doc-url-count-saved] +. ds doc-url-name "\*[doc-url-name-saved] . nr doc-volume-count \n[doc-volume-count-saved] . ds doc-volume-name "\*[doc-volume-name-saved] . nr doc-have-author \n[doc-have-author-saved] @@ -5194,6 +5198,8 @@ .\" NS doc-reference-title-name-for-book .\" NS doc-report-count .\" NS doc-report-name +.\" NS doc-url-count +.\" NS doc-url-name .\" NS doc-volume-count .\" NS doc-volume-name . @@ -5208,6 +5214,7 @@ . nr doc-corporate-count 0 . nr doc-report-count 0 . nr doc-reference-title-count 0 +. nr doc-url-count 0 . nr doc-volume-count 0 . nr doc-date-count 0 . nr doc-page-number-count 0 @@ -5222,6 +5229,7 @@ . ds doc-report-name . ds doc-reference-title-name . ds doc-reference-title-name-for-book +. ds doc-url-name . ds doc-volume-name . ds doc-date . ds doc-page-number-string @@ -5316,6 +5324,13 @@ . doc-finish-reference \n[doc-volume-count] . \} . +. if \n[doc-url-count] \{\ +. unformat doc-url-name +. chop doc-url-name +. nop \*[doc-url-name]\c +. doc-finish-reference \n[doc-url-count] +. \} +. . if \n[doc-page-number-count] \{\ . unformat doc-page-number-string . chop doc-page-number-string @@ -6019,6 +6034,18 @@ .. . . +.\" NS doc-url-count global register +.\" NS counter of hypertext references +. +.nr doc-url-count 0 +. +. +.\" NS doc-url-name global box +.\" NS string of collected hypertext references +. +.ds doc-url-name +. +. .\" NS doc-volume-count global register .\" NS counter of reference title references . @@ -6031,6 +6058,48 @@ .ds doc-volume-name . . +.\" NS %U user macro +.\" NS hypertext reference +.\" NS +.\" NS modifies: +.\" NS doc-arg-ptr +.\" NS doc-curr-font +.\" NS doc-curr-size +.\" NS doc-macro-name +.\" NS doc-reference-count +.\" NS doc-url-count +.\" NS +.\" NS local variables: +.\" NS doc-env-%U +.\" NS +.\" NS width register `%U' set in doc-common +. +.de %U +. if (\n[doc-arg-limit] : (\n[.$] == 0)) \{\ +. tm Usage: .%U URL ... (#\n[.c]) +. return +. \} +. +. nr doc-url-count +1 +. nr doc-reference-count +1 +. +. ds doc-macro-name %U +. doc-parse-args \$@ +. +. nr doc-arg-ptr +1 +. nr doc-curr-font \n[.f] +. nr doc-curr-size \n[.ps] +. +. \" append to reference box +. boxa doc-url-name +. ev doc-env-%U +. evc 0 +. in 0 +. nf +. doc-do-references +.. +. +. .\" NS %V user macro .\" NS reference volume .\" NS @@ -6039,7 +6108,7 @@ .\" NS doc-curr-font .\" NS doc-curr-size .\" NS doc-macro-name -.\" NS doc-reference-title-count +.\" NS doc-reference-count .\" NS doc-volume-count .\" NS .\" NS local variables: @@ -6425,6 +6494,9 @@ .blm doc-empty-line . . +.ec +. +. .\" For UTF-8, map some characters conservatively for the sake .\" of easy cut and paste. . @@ -6438,9 +6510,6 @@ .\} . . -.ec -. -. .\" load local modifications .mso mdoc.local . diff --git a/tmac/groff_mdoc.man b/tmac/groff_mdoc.man index e217a5b8f1ac..174030b88f00 100644 --- a/tmac/groff_mdoc.man +++ b/tmac/groff_mdoc.man @@ -2556,6 +2556,8 @@ Corporate or foreign author. Report name. .It Li .%T Title of article. +.It Li .%U +Optional hypertext reference. .It Li .%V Volume. .El