1250757Sjkim.ig 2250757Sjkimwww.tmac - macro package for adding HTML elements to roff documents. 3250757Sjkim 4250757SjkimFile position: <groff_source_top>/tmac/www.tmac 5250757SjkimInstalled position: groff's main macro directory. 6250757Sjkim 7250757Sjkim------------------------------------------------------------------------ 8281075Sdim Legalize 9250757Sjkim------------------------------------------------------------------------ 10250757Sjkim 11250757SjkimThis file is part of groff, the GNU roff type-setting system. 12250757Sjkim 13250757SjkimCopyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. 14250757Sjkimwritten by Gaius Mulley <gaius@glam.ac.uk>, with additions by 15250757SjkimWerner Lemberg <wl@gnu.org> and Bernd Warken <bwarken@mayn.de>. 16250757Sjkim 17250757Sjkimgroff is free software; you can redistribute it and/or modify it under 18250757Sjkimthe terms of the GNU General Public License as published by the Free 19250757SjkimSoftware Foundation; either version 2, or (at your option) any later 20250757Sjkimversion. 21250757Sjkim 22250757Sjkimgroff is distributed in the hope that it will be useful, but WITHOUT 23250757SjkimANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 24250757SjkimFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 25250757Sjkimfor more details. 26250757Sjkim 27250757SjkimYou should have received a copy of the GNU General Public License 28250757Sjkimalong with groff; see the file COPYING. If not, write to the Free 29250757SjkimSoftware Foundation, 51 Franklin St - Fifth Floor, Boston, MA 30250757Sjkim02110-1301, USA. 31250757Sjkim 32250757Sjkim 33250757Sjkim------------------------------------------------------------------------ 34250757Sjkim Description 35250757Sjkim------------------------------------------------------------------------ 36250757Sjkim 37250757SjkimA simple set of macros to provide HTML documents with basic 38250757Sjkimwww functionality. It should work with any macro set. 39250757Sjkim.. 40250757Sjkim. 41250757Sjkim.\" -------------------------------------------------------------------- 42250757Sjkim.\" Setup 43250757Sjkim.\" -------------------------------------------------------------------- 44250838Sjkim. 45250838Sjkim.do if d www:lenstr .nx 46250838Sjkim. 47250757Sjkim.do mso devtag.tmac 48250757Sjkim. 49250757Sjkim.nr _C \n(.C 50250757Sjkim.cp 0 51250757Sjkim. 52250757Sjkim. 53250757Sjkim.nr www-html 0 54250757Sjkim.if '\*[.T]'html' .nr www-html 1 55250757Sjkim. 56250757Sjkim.\" set up www-image-template 57250757Sjkim. 58250757Sjkim.if !d www-image-template \ 59250757Sjkim. ds www-image-template 60250757Sjkim. 61250757Sjkim.if r ps4html \{\ 62250757Sjkim. \" remove the title command when we are generating images for html 63250757Sjkim. \" (stops a title accidentally appearing inside an image) 64250757Sjkim. di www-notitle 65250757Sjkim. tl '''' 66250757Sjkim. di 67250757Sjkim. rm tl 68250757Sjkim. de tl 69250757Sjkim. . 70250757Sjkim.\} 71250757Sjkim. 72250757Sjkim. 73250757Sjkim.\" -------------------------------------------------------------------- 74250757Sjkim.\" Test for `.substring'; result in register `www.substring_ok'. 75250757Sjkim.\" The automated break points in .URL addresses are only added if 76250757Sjkim.\" this register is non-zero. 77250757Sjkim.\" 78250757Sjkim.nr www:substring_ok 0 79250757Sjkim.de www:@test_substring 80250757Sjkim. if !d substring \ 81250757Sjkim. return 82250757Sjkim. ds \\$0:s abcdefg\" 83250757Sjkim. substring \\$0:s 1 1 84250757Sjkim. if !'\\*[\\$0:s]'b' \{\ 85250757Sjkim. rm \\$0:s 86250757Sjkim. return 87250757Sjkim. \} 88250757Sjkim. ds \\$0:s abcdefg\" 89250757Sjkim. substring \\$0:s 0 0 90250757Sjkim. if !'\\*[\\$0:s]'a' \{\ 91250757Sjkim. rm \\$0:s 92250757Sjkim. return 93250757Sjkim. \} 94250757Sjkim. ds \\$0:s abcdefg\" 95250757Sjkim. substring \\$0:s 1 -1 96250757Sjkim. if !'\\*[\\$0:s]'bcdefg' \{\ 97250757Sjkim. rm \\$0:s 98250757Sjkim. return 99250757Sjkim. \} 100250757Sjkim. nr www:substring_ok 1 101250757Sjkim. rm \\$0:s 102250757Sjkim.. 103250757Sjkim.www:@test_substring 104250757Sjkim.rm www:@test_substring 105250757Sjkim. 106250757Sjkim. 107250757Sjkim.\" -------------------------------------------------------------------- 108250757Sjkim.\" Local Macros 109250757Sjkim.\" -------------------------------------------------------------------- 110250757Sjkim. 111250757Sjkim.\" -------------------------------------------------------------------- 112250757Sjkim.\" www:paraspace 113250757Sjkim.\" 114250757Sjkim.\" Space before paragraph. Use \n[PD] if it exists. 115250757Sjkim.\" 116250757Sjkim.nr www:pd 0.5v 117250757Sjkim.de www:paraspace 118250757Sjkim. ie r PD .sp \\n[PD]u 119250757Sjkim. el .sp \\n[www:pd]u 120250757Sjkim.. 121250757Sjkim. 122250757Sjkim.\" 123250757Sjkim.\" -------------------------------------------------------------------- 124250757Sjkim.\" www:error (<test>...) 125250757Sjkim.\" 126250757Sjkim.\" Print error message 127250757Sjkim.\" 128250757Sjkim.de www-error 129250757Sjkim. tm \\n[.F]:\\n[.c]: macro error: \\$* 130250757Sjkim.. 131250757Sjkim.als www:error www-error 132250757Sjkim. 133250757Sjkim.\" -------------------------------------------------------------------- 134250757Sjkim.\" www:lenstr (<register_name> <string_name>) 135250757Sjkim.\" 136250757Sjkim.\" Store length of string named <string_name> into register named 137250757Sjkim.\" <register_name>. 138250757Sjkim.\" 139250757Sjkim.de www:lenstr 140250757Sjkim. if !(\\n[.$] == 2) \{\ 141250757Sjkim. tm .\\$0 expects 2 arguments. 142250757Sjkim. ab 143250757Sjkim. \} 144250757Sjkim. length \\$0:n x\\*[\\$2] 145250757Sjkim. nr \\$1 (\\n[\\$0:n]-1) 146250757Sjkim. rr \\$0:n 147250757Sjkim.. 148250757Sjkim.\" -------------------------------------------------------------------- 149250757Sjkim.\" www:splitstr (<name>) 150250757Sjkim.\" 151250757Sjkim.\" Add a space character between any two adjacent characters in string 152250757Sjkim.\" <name> and restore result into the string variable <name>; space 153250757Sjkim.\" characters are first replaced by the word `space'. 154250757Sjkim.\" 155250757Sjkim.de www:splitstr 156250757Sjkim. if !(\\n[.$] == 1) \ 157250757Sjkim. www:error .\\$0 expects 1 argument. 158250757Sjkim. if '\\*[\\$1]'' \ 159250757Sjkim. return 160250757Sjkim. ds \\$0:r "\\*[\\$1]\"" 161250757Sjkim. ds \\$0:s\" 162250757Sjkim. while 1 \{\ 163250757Sjkim. ds \\$0:c "\\*[\\$0:r]\"" 164250757Sjkim. substring \\$0:c 0 0\" 165250757Sjkim. ie '\\*[\\$0:c]' ' \ 166250757Sjkim. as \\$0:s " space\"" 167250757Sjkim. el \ 168250757Sjkim. as \\$0:s " \\*[\\$0:c]\"" 169250757Sjkim. www:lenstr \\$0:n \\$0:r 170250757Sjkim. if (\\n[\\$0:n] <= 1) \{\ 171250757Sjkim. break 172250757Sjkim. \} 173250757Sjkim. substring \\$0:r 1 -1\" 174250757Sjkim. \} 175250757Sjkim. if !'\\*[\\$0:s]'' \ 176250757Sjkim. substring \\$0:s 1 -1 177250757Sjkim. ds \\$1 \\*[\\$0:s] 178250757Sjkim. rm \\$0:c 179250757Sjkim. rr \\$0:n 180250757Sjkim. rm \\$0:r 181250757Sjkim. rm \\$0:s 182250757Sjkim.. 183250757Sjkim.\" -------------------------------------------------------------------- 184250757Sjkim.\" www:url_breaks (<string_name>) 185250757Sjkim.\" 186250757Sjkim.\" Add `\:' (possible break point) within URL strings after `/'. 187250757Sjkim.\" 188250757Sjkim.\" Smart about multiple `/', existing `\:', and space characters; 189250757Sjkim.\" does not set a break point if less than 5 characters would go to 190250757Sjkim.\" the next line. 191250757Sjkim.\" 192250757Sjkim.de www:url_breaks 193250757Sjkim. if !(\\n[.$] == 1) \ 194250757Sjkim. www:error .\\$0 expects 1 argument. 195250757Sjkim. if !\n[www:substring_ok] \ 196250757Sjkim. return 197250757Sjkim. ds \\$0:s "\\*[\\$1]\"" 198250757Sjkim. www:splitstr \\$0:s 199250757Sjkim. www:url_breaks_splitted \\$0:s \\*[\\$0:s] 200250757Sjkim. ds \\$1 "\\*[\\$0:s]\"" 201250757Sjkim. rm \\$0:s 202250757Sjkim.. 203250757Sjkim.\" -------------------------------------------------------------------- 204250757Sjkim.\" www:url_breaks_splitted (<result> <char> [<char>...]) 205250757Sjkim.\" 206250757Sjkim.\" Add `\:' within URL strings, but arguments are a splitted string. 207250757Sjkim.\" 208250757Sjkim.\" Arguments: >=2: <result> <char> [<char>...] 209250757Sjkim.\" 210250757Sjkim.de www:url_breaks_splitted 211250757Sjkim. nr \\$0:min 5 \" minimal number of characters for next line 212250757Sjkim. if (\\n[.$] < 2) \ 213250757Sjkim. www:error .\\$0 expects at least 2 arguments. 214250757Sjkim. ds \\$0:res \\$1\" 215250757Sjkim. shift 216250757Sjkim. ds \\$0:s\" 217250757Sjkim. nr \\$0:done 0 218250757Sjkim. while !\\n[\\$0:done] \{\ 219250757Sjkim. if (\\n[.$] <= 0) \{\ 220250757Sjkim. nr \\$0:done 1 221250757Sjkim. break 222250757Sjkim. \} 223250757Sjkim. if '\\$1'space' \{\ 224250757Sjkim. as \\$0:s " \"" 225250757Sjkim. shift 226250757Sjkim. continue 227250757Sjkim. \} 228250757Sjkim. if (\\n[.$] < \\n[\\$0:min]) \{\ 229250757Sjkim. as \\$0:s "\\$1\"" 230250757Sjkim. shift 231250757Sjkim. continue 232250757Sjkim. \} 233250757Sjkim. if !'\\$1'/' \{\ 234250757Sjkim. as \\$0:s "\\$1\"" 235250757Sjkim. shift 236250757Sjkim. continue 237250757Sjkim. \} 238250757Sjkim. \" we are at a `/' character 239250757Sjkim. while '\\$1'/' \{\ 240250757Sjkim. as \\$0:s /\" 241250757Sjkim. if (\\n[.$] == 0) \{\ 242250757Sjkim. nr \\$0:done 1 243250757Sjkim. break 244250757Sjkim. \} 245250757Sjkim. shift 246250757Sjkim. \} 247250757Sjkim. if \\n[\\$0:done] \ 248250757Sjkim. break 249250757Sjkim. if (\\n[.$] < \\n[\\$0:min]) \ 250250757Sjkim. continue 251250757Sjkim. if '\\$1'\:' \ 252250757Sjkim. shift 253250757Sjkim. as \\$0:s \:\" 254250757Sjkim. \} 255250757Sjkim. ds \\*[\\$0:res] \\*[\\$0:s]\" 256250757Sjkim. rm \\$0:res 257250757Sjkim. rm \\$0:s 258250757Sjkim.. 259250757Sjkim.\" -------------------------------------------------------------------- 260250757Sjkim.\" User Interface 261250757Sjkim.\" -------------------------------------------------------------------- 262250757Sjkim. 263250757Sjkim.\" -------------------------------------------------------------------- 264250757Sjkim.\" HTML 265250757Sjkim.\" 266250757Sjkim.\" the main auxiliary macro for the HTML interface 267250757Sjkim.\" 268250757Sjkim.de HTML 269250757Sjkim. if \\n[www-html] \{\ 270250757Sjkim. \" was implemented via .nop \&\X^html:\\$*^ but 271250757Sjkim. \" is now implemented using HTML-NS to utilize code factoring. 272250757Sjkim. \" 273250757Sjkim. \" the `\&' makes the vertical mode leave, so to say 274250757Sjkim. \" 275250757Sjkim. nop \&\c 276250757Sjkim. HTML-NS \\$* 277250757Sjkim. nop \& 278250757Sjkim. \} 279250757Sjkim.. 280250757Sjkim.\" 281250757Sjkim.\" an auxiliary macro for HTML (without following space) 282250757Sjkim.\" 283250757Sjkim.de HTML-NS 284250757Sjkim. nop \X^html:\\$*^\c 285250757Sjkim.. 286250757Sjkim.\" 287250757Sjkim.\" emit a HTML tag after shutting down a (possibly open) paragraph 288250757Sjkim.\" 289250757Sjkim.de HTML</p> 290250757Sjkim. if \\n[www-html] \{\ 291250757Sjkim. \" the `\&' makes the vertical mode leave, so to say 292250757Sjkim. nop \&\X^html</p>:\\$*^ 293250757Sjkim. \} 294250757Sjkim.. 295250757Sjkim.\" -------------------------------------------------------------------- 296250757Sjkim.\" HX n 297250757Sjkim.\" 298250757Sjkim.\" Automatic heading level cut off. 299250757Sjkim.\" 300250757Sjkim.\" N is the depth limit of automatically linked headings. So a depth 301250757Sjkim.\" of 2 would cause grohtml to generate a list of links for `.NH 1' 302250757Sjkim.\" and `.NH 2' but not for `.NH 3'. 303250757Sjkim.\" 304250757Sjkim.de HX 305250757Sjkim. if \\n[www-html] \ 306250757Sjkim. nop \X^index:\\$*^ 307250757Sjkim.. 308250757Sjkim.\" -------------------------------------------------------------------- 309250757Sjkim.\" BCL foreground background active not-visited visited 310250757Sjkim.\" 311250757Sjkim.de BCL 312250757Sjkim. HTML <body text=\\$1 bgcolor=\\$2 link=\\$3 alink=\\$4 vlink=\\$5> 313250757Sjkim.. 314250757Sjkim.\" -------------------------------------------------------------------- 315250757Sjkim.\" BGIMG imagefile 316250757Sjkim.\" 317250757Sjkim.de BGIMG 318250757Sjkim. HTML <body background=\\$1> 319250757Sjkim.. 320250757Sjkim.\" -------------------------------------------------------------------- 321250757Sjkim.\" URL url [description] [after] 322250757Sjkim.\" if description is absent then the url becomes the anchor text 323250757Sjkim.\" 324250757Sjkim.de URL 325250757Sjkim. ie !'\\$1'' \{\ 326. ds \\$0:adr \\$1\" 327. www:url_breaks \\$0:adr 328. \} 329. ie \\n[www-html] \{\ 330. ie '\\$3'' \ 331. ds \\$0:after \& 332. el \ 333. ds \\$0:after \&\\$3 334. ie '\\$2'' \ 335. HTML-NS <a href="\\$1">\\$1</a> 336. el \ 337. HTML-NS <a href="\\$1">\\$2</a> 338. nop \\*[\\$0:after] 339. rm \\$0:after 340. \} 341. el \{\ 342. if !r ps4html .ad l 343. ie '\\$2'' \{\ 344. ie '\\$1'' \{\ 345. ie !'\\$3'' \ 346. nop \\$3 347. \} 348. el \{\ 349. ie \\n[.color] \ 350. nop \%\[la]\m[blue]\f[C]\\*[\\$0:adr]\f[]\m[]\[ra]\\$3 351. el \ 352. nop \%\[la]\f[CB]\\*[\\$0:adr]\f[]\[ra]\\$3 353. \} 354. \} 355. el \{\ 356. ie '\\$1'' \{\ 357. ie \\n[.color] \ 358. nop \m[blue]\\$2\m[]\\$3 359. el \ 360. nop \f[B]\\$2\f[]\\$3 361. \} 362. el \{\ 363. ie \\n[.color] \ 364. nop \m[blue]\\$2\m[] \%\[la]\f[C]\\*[\\$0:adr]\f[]\[ra]\\$3 365. el \ 366. nop \f[B]\\$2\f[] \%\[la]\f[C]\\*[\\$0:adr]\f[]\[ra]\\$3 367. \} 368. \} 369. if !r ps4html .ad 370. \} 371. rm \\$0:adr 372.. 373.\" -------------------------------------------------------------------- 374.\" FTP url description [after] 375.\" 376.\" Same as URL. 377.\" 378.als FTP URL 379.\" -------------------------------------------------------------------- 380.\" MTO address description [after] 381.\" 382.\" ADDRESS is the email address (without the `mailto:' prefix). 383.\" 384.\" DESCRIPTION is the optional name. If an empty argument is given, 385.\" ADDRESS is used instead. 386.\" 387.\" AFTER is optional stuff printed immediately after ADDRESS 388.\" (resp. DESCRIPTION). 389.\" 390.\" Example: 391.\" 392.\" Foobar has been written by 393.\" .MTO fred@foo.bar "Fredrick Bloggs" . 394.\" 395.de MTO 396. ie \\n[www-html] \{\ 397. ie '\\$2'' \ 398. URL mailto:\\$1 \\$1 "\\$3" 399. el \ 400. URL mailto:\\$1 "\\$2" "\\$3" 401. \} 402. el \{\ 403. ie '\\$2'' \{\ 404. ie '\\$1'' \{\ 405. ie !'\\$3'' \ 406. nop \\$3 407. \} 408. el \{\ 409. ie \\n[.color] \ 410. nop \%\m[blue]\f[C]\\$1\f[]\m[]\\$3 411. el \ 412. nop \%\f[CB]\\$1\f[]\\$3 413. \} 414. \} 415. el \{\ 416. ie '\\$1'' \{\ 417. ie \\n[.color] \ 418. nop \m[blue]\\$2\m[]\\$3 419. el \ 420. nop \f[B]\\$2\f[]\\$3 421. \} 422. el \{\ 423. ie \\n[.color] \ 424. nop \m[blue]\\$2\m[] \%\[la]\f[C]\\$1\f[]\[ra]\\$3 425. el 426. nop \f[B]\\$2\f[] \%\[la]\f[C]\\$1\f[]\[ra]\\$3 427. \} 428. \} 429. \} 430.. 431.\" -------------------------------------------------------------------- 432.\" TAG name 433.\" 434.\" Generate an html name NAME. 435.\" 436.de TAG 437. HTML <a name="\\$1"></a> 438.. 439.\" -------------------------------------------------------------------- 440.\" IMG [-R|-L|-C] filename [width] [height] 441.\" 442.\" Include an image of any type (will only work for -Thtml). 443.\" 444.\" Alignment is centered by default (-C). 445.\" Default value for WIDTH is 1i. 446.\" If HEIGHT is not given, WIDTH is used as the height. 447.\" 448.de IMG 449. ie \\n[www-html] \{\ 450. ie '\\$2'-R' \ 451. DEVTAG ".right-image" 452. el \{\ 453. ie '\\$2'-L' \ 454. DEVTAG ".left-image" 455. el \ 456. DEVTAG ".centered-image" 457. \} 458. nr www-width 100 459. if !'\\$3'' \ 460. nr www-width \\$3 461. nr www-height \\n[www-width] 462. if !'\\$4'' \ 463. nr www-height \\$4 464. HTML <img src="\\$1" alt="Image \\$1" \ 465 width=\\n[www-width] height=\\n[www-height]> 466. \} 467. el \ 468. nop \[la]\f[C]\\$1\f[]\[ra] 469.. 470.\" -------------------------------------------------------------------- 471.\" PIMG [-R|-L|-C] filename [width] [height] 472.\" 473.\" Include a png image. It will work for -Tps and -Thtml. 474.\" The default value for WIDTH and HEIGHT is zero; the default 475.\" alignment is centering (-C). 476.\" 477.\" Note: This macro can only be used with the `-U' option of groff, 478.\" activating unsafe mode, if not used with -Thtml; the PNG image 479.\" is then converted to the EPS format using netpbm utilities. 480.\" 481.de PIMG 482. ie \\n[www-html] \{\ 483. ie '\\$1'-R' \ 484. DEVTAG ".right-image" 485. el \{\ 486. ie '\\$1'-L' \ 487. DEVTAG ".left-image" 488. el \ 489. DEVTAG ".centered-image" 490. \} 491. nr www-width 0 492. nr www-height 0 493. if !'\\$3'' \ 494. nr www-width (\\$3 * 100 / 240) 495. if !'\\$4'' \ 496. nr www-height (\\$4 * 100 / 240) 497. ie (\\n[www-width] == 0) \{\ 498. ie (\\n[www-height] == 0) \ 499. HTML <img src="\\$2" alt="Image \\$2"> 500. el \ 501. HTML <img src="\\$1" alt="Image \\$2" height=\\n[www-height]> 502. \} 503. el \{\ 504. ie (\\n[www-height] == 0) \ 505. HTML <img src="\\$2" alt="Image \\$2" width=\\n[www-width]> 506. el \ 507. HTML <img src="\\$2" alt="Image \\$2" width=\\n[www-width] \ 508 height=\\n[www-height]> 509. \} 510. \} 511. el \{\ 512. if !r ps4html \{\ 513. www-make-unique-name 514. sy pngtopnm \\$2 | pnmcrop -white | @PNMTOPS_NOSETPAGE@ -noturn > \\*[www-unique-name].eps 515. ie '\\$1'-C' \ 516. PSPIC \\*[www-unique-name].eps \\$3 \\$4 517. el \ 518. PSPIC \\$1 \\*[www-unique-name].eps \\$3 \\$4 519. \} 520. \} 521.. 522. 523.\" -------------------------------------------------------------------- 524.\" auxiliary definitions for MPIMG 525.\" 526.nr www-left-ll-trap 0 527.nr www-left-po-trap 0 528.nr www-right-ll-trap 0 529. 530.de www-finish-left-po 531. po -(\\n[www-left-indent]u + \\n[www-image-gap]u) 532. wh \\n[www-left-po-trap]u 533. nr www-left-indent 0 534.. 535. 536.\" called when the -R picture is finished 537.de www-finish-right-ll 538. ll +(\\n[www-right-indent]u + \\n[www-image-gap]u) 539. \" now see whether we need to inline www-finish-left-ll 540. if (\\n[www-left-ll-trap]u > 0) \ 541. if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-ll-trap]u) \{\ 542. mk www-left-po-trap 543. nr www-left-po-trap +1v 544. wh \\n[www-left-po-trap]u www-finish-left-po 545. ll +\\n[www-left-indent]u 546. wh \\n[www-left-ll-trap]u 547. nr www-left-ll-trap 0 548. \} 549. \" and see whether we need to inline www-finish-left-po 550. if (\\n[www-left-po-trap]u > 0) \ 551. if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-po-trap]u) \{\ 552. po -\\n[www-left-indent]u 553. wh \\n[www-left-po-trap]u 554. nr www-left-indent 0 555. \} 556. wh \\n[www-right-ll-trap]u 557. nr www-right-ll-trap 0 558.. 559. 560.de www-finish-left-ll 561. if (\\n[www-right-ll-trap] > 0) \ 562. if ((\\n[www-left-ll-trap] + 1v) >= \\n[www-right-ll-trap]) \{\ 563. ll +\\n[www-right-indent]u 564. nr www-right-ll-trap 0 565. \} 566. mk www-left-po-trap 567. nr www-left-po-trap +1v 568. wh \\n[www-left-po-trap]u www-finish-left-po 569. ll +(\\n[www-left-indent]u + \\n[www-image-gap]u) 570. wh \\n[www-left-ll-trap]u 571. nr www-left-ll-trap 0 572.. 573. 574.\" www-handle-percent arg N1 N2 S1 575.\" arg - input string (number or number%) 576.\" output parameters: 577.\" N1 - name of number register 1=absolute 0=percentage 578.\" N2 - number register name for absolute value 579.\" S1 - string register name for percentage value 580. 581.de www-handle-percent 582. ds www-percent \\$1\" 583. substring www-percent -1 -1 584. 585. ie '\\*[www-percent]'%' \{\ 586. ds www-abs \\$1\" 587. substring www-abs 0 -2 588. nr \\$2 0 589. nr \\$3 \\*[www-abs] 590. ds \\$4 \\$1\" 591. \} 592. el \{\ 593. nr \\$2 1 594. nr \\$3 \\$1 595. ds \\$4 none\" 596. \} 597.. 598. 599.\" -------------------------------------------------------------------- 600.\" MPIMG [-R|-L] [-G gap] filename [width [height]] 601.\" 602.\" Include a png image and wrap text around it. It will work for 603.\" -Tps and -Thtml. The default value for WIDTH is 1i; default value 604.\" for HEIGHT is WIDTH; the default alignment is left (-L). 605.\" -G is used to insert a gap between the text and the image. 606.\" The height and width can also be given as a percentage. 607.\" The PostScript device converts the percentage width into an 608.\" absolute value by using \\n[.l], and the height by using \\n[.p]. 609.\" 610.\" 611.\" Note: This macro can only be used with the `-U' option of groff, 612.\" activating unsafe mode, if not used with -Thtml; the PNG image 613.\" is then converted to the EPS format using netpbm utilities. 614.\" 615. 616.nr www-htmlimage-gap 0 617. 618.de MPIMG 619. nr www-image-just 1 620. nr www-image-gap 0 621. while (\\n[.$] > 0) \{\ 622. if '-L'\\$1' \{\ 623. nr www-image-just 1 624. shift 625. continue 626. \} 627. if '-R'\\$1' \{\ 628. nr www-image-just 0 629. shift 630. continue 631. \} 632. if '-G'\\$1' \{\ 633. nr www-image-gap \\$2 634. nr www-htmlimage-gap (\\$2 * 100 / 240) 635. shift 2 636. continue 637. \} 638. break 639. \} 640. 641. nr www-width 1i 642. nr www-height 1i 643. ds www-size-specs "width=\\n[www-width] height=\\n[www-height]\" 644. ie !'\\$2'' \{\ 645. nr www-is-absolute 0 646. nr www-absolute 0 647. ds www-percentage none\" 648. www-handle-percent \\$2 www-is-absolute www-absolute www-percentage 649. ie !\\n[www-is-absolute] \{\ 650. \" percentage of linelength requested 651. nr www-width (\\n[www-absolute] * \\n[.l] / 100) 652. if \\n[www-html] \ 653. nr www-width (\\n[www-width] * 100 / 240) 654. ds www-size-specs "width=\\*[www-percentage]\" 655. \} 656. el \{\ 657. nr www-width \\n[www-absolute] 658. if \\n[www-html] \ 659. nr www-width (\\n[www-width] * 100 / 240) 660. ds www-size-specs "width=\\n[www-width]\" 661. \} 662. 663. nr www-height \\n[www-width] 664. ie !'\\$3'' \{\ 665. nr www-is-absolute 0 666. nr www-absolute 0 667. ds www-percentage none\" 668. www-handle-percent \\$3 www-is-absolute www-absolute www-percentage 669. ie !\\n[www-is-absolute] \{\ 670. \" percentage of pagelength requested 671. nr www-height (\\n[www-absolute] * \\n[.p] / 100) 672. if \\n[www-html] \ 673. nr www-height (\\n[www-height] * 100 / 240) 674. ds www-size-specs "\\*[www-size-specs] height=\\*[www-percentage]\" 675. \} 676. el \{\ 677. nr www-height \\n[www-absolute] 678. if \\n[www-html] \ 679. nr www-height (\\n[www-height] * 100 / 240) 680. ds www-size-specs "\\*[www-size-specs] height=\\*[www-height]\" 681. \} 682. \} 683. \} 684. el \{\ 685. \" height not specified; use width value 686. ie !\\n[www-is-absolute] \{\ 687. \" percentage value 688. ds www-size-specs "\\*[www-size-specs] height=\\*[www-percentage]\" 689. nr www-height \\n[www-width] 690. \} 691. el \{\ 692. ds www-size-specs "\\*[www-size-specs] height=\\*[www-width]\" 693. nr www-height \\n[www-width] 694. \} 695. \} 696. 697. ie \\n[www-html] \{\ 698. ie !\\n[www-image-just] \ 699. HTML <img src="\\$1" alt="Image \\$1" hspace=\\n[www-htmlimage-gap] \ 700 align=right \\*[www-size-specs]> 701. el \ 702. HTML <img src="\\$1" alt="Image \\$1" hspace=\\n[www-htmlimage-gap] \ 703 align=left \\*[www-size-specs]> 704. \} 705. el \{\ 706. tm www-width is \\n[www-width] 707. tm www-height is \\n[www-height] 708. if !r ps4html \{\ 709. www-make-unique-name 710. sy pngtopnm \\$1 | pnmcrop -white | @PNMTOPS_NOSETPAGE@ -noturn > \\*[www-unique-name].eps 711. ie !\\n[www-image-just] \{\ 712. \" we must now disable a possible left image trap 713. sp -1 714. if (\\n[www-left-ll-trap] > 0) \ 715. wh \\n[www-left-ll-trap]u 716. if (\\n[www-left-po-trap] > 0) \ 717. wh \\n[www-left-po-trap]u 718. PSPIC -R \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u 719. sp -\\n[ps-desht]u 720. nr www-right-indent \\n[ps-deswid]u 721. \" we want to have some space between text and image, 722. \" so the line length must be shorter 723. ll -(\\n[www-right-indent]u + \\n[www-image-gap]u) 724. mk www-right-ll-trap 725. nr www-right-ll-trap +(\\n[ps-desht]u - 1v) 726. wh \\n[www-right-ll-trap]u www-finish-right-ll 727. \" now restore possible left trap 728. if (\\n[www-left-ll-trap] > 0) \ 729. wh \\n[www-left-ll-trap]u www-finish-left-ll 730. if (\\n[www-left-po-trap] > 0) \ 731. wh \\n[www-left-po-trap]u 732. \} 733. el \{\ 734. \" we must now disable a possible right image trap 735. if (\\n[www-right-ll-trap] > 0) \ 736. wh \\n[www-right-ll-trap]u 737. PSPIC -L \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u 738. sp -\\n[ps-desht]u 739. nr www-left-indent \\n[ps-deswid]u 740. \" increase offset by gap 741. po +(\\n[www-left-indent]u + \\n[www-image-gap]u) 742. \" decrease line length by gap 743. ll -(\\n[www-left-indent]u + \\n[www-image-gap]u) 744. mk www-left-ll-trap 745. nr www-left-ll-trap +(\\n[ps-desht]u - 1v) 746. wh \\n[www-left-ll-trap]u www-finish-left-ll 747. \" now restore possible right trap 748. if (\\n[www-right-ll-trap] > 0) \ 749. wh \\n[www-right-ll-trap]u www-finish-right-ll 750. \} 751. \} 752. \} 753.. 754.\" -------------------------------------------------------------------- 755.\" HnS n 756.\" 757.\" Begin heading. Heading level is N. 758.\" 759.\" HnE 760.\" 761.\" End heading. 762.\" 763.\" If your heading contains URL, FTP, MTO macros you might wish to 764.\" disable automatic links to headings. This can be done via `-P-l' 765.\" from the command line or by using a cakk to `.HX 0'. 766.\" 767.nr www-heading-no -1 768. 769.de HnS 770. ie '\\$1'' \ 771. nr www-heading-no 1 772. el \ 773. nr www-heading-no \\$1 774. DEVTAG-NH \\n[www-heading-no] 775.. 776. 777.de HnE 778. if (\\n[www-heading-no] == -1) \ 779. www-error "HnE found without a corresponding HnS" 780. DEVTAG-EO-H 781.. 782.\" -------------------------------------------------------------------- 783.\" LK 784.\" 785.\" Emit the automatically collected links derived from 786.\" section/numbered headings at this position. 787.\" 788.de LK 789. DEVTAG ".links" 790.. 791.\" -------------------------------------------------------------------- 792.\" HR 793.\" 794.\" Produce a horizontal line. 795.\" 796.de HR 797. HTML</p> "<hr>" 798.. 799.\" -------------------------------------------------------------------- 800.\" NHR 801.\" 802.\" Suppresses the generation of the top and bottom rules which grohtml 803.\" emits by default. 804.\" 805.de NHR 806. DEVTAG ".no-auto-rule" 807.. 808.\" 809.\" www-end-nowhere - end of input trap called to finish diversion. 810.\" 811.de www-end-nowhere 812. if !\\n[www-html] \ 813. di 814. DEVTAG-EO-TL 815.. 816.\" -------------------------------------------------------------------- 817.\" HTL 818.\" 819.\" Generate an HTML title only. This differs from the -ms .TL macro 820.\" which generates both an HTML title and an H1 heading. 821.\" 822.\" This is useful when an author wishes to use a HTML title as search 823.\" engine fodder but a graphic title in the document. 824.\" 825.\" The macro terminates when a space or break is seen (.sp, .br). 826.\" 827.de HTL 828. DEVTAG ".html-tl" 829. if !\\n[www-html] \ 830. di www-nowhere 831. it 2 www-end-nowhere 832.. 833. 834.\" -------------------------------------------------------------------- 835.\" auxiliary definitions for lists 836.\" 837.ds www-ul-level1 \[bu]\ \ \" 838.ds www-ul-level2 \[sq]\ \ \" 839.ds www-ul-level3 \[ci]\ \ \" 840.nr www-ul-level 0 841. 842.ds www-ol-level1 decimal\" 843.ds www-ol-level2 lower-alpha\" 844.ds www-ol-level3 lower-roman\" 845.ds www-ol-tmp 00\ \ \" 846.nr www-ol-ctr1 0 1 847.nr www-ol-ctr2 0 1 848.nr www-ol-ctr3 0 1 849.af www-ol-ctr2 a 850.af www-ol-ctr3 i 851.nr www-ol-level 0 852. 853.nr www-dl-level 0 854.nr www-dl-shift 5n 855. 856.\" 857.\" allow nested lists 858.\" 859.nr www-depth 0 860.nr www-li-indent \n[.i] 861.ds www-level0 nop\" 862.ds www-level1 863.ds www-level2 864.ds www-level3 865.ds www-level4 866.ds www-level5 867.ds www-level6 868.ds www-level7 869.ds www-level8 870.ds www-level9 871. 872.\" which macro to use for LI 873.de www-push-li 874. nr www-depth +1 875. ds www-level\\n[www-depth] \\$1\" 876. als LI \\$1 877.. 878. 879.de www-pop-li 880. nr www-depth -1 881. als LI \\*[www-level\\n[www-depth]] 882.. 883. 884.\" 885.\" Auxiliary macro for ULS. 886.\" 887.de www-push-ul-level 888. nr www-ul-level +1 889. if (\\n[www-ul-level] > 3) \ 890. www-error "ULS: too many levels of indentation (\\n[www-ul-level])" 891.. 892.\" 893.\" Auxiliary macro for ULE. 894.\" 895.de www-pop-ul-level 896. if !\\n[www-ul-level] \ 897. www-error "ULE: trying to terminate a list which does not exist" 898. nr www-ul-level -1 899.. 900. 901.\" 902.\" Auxiliary macro for OLS. 903.\" 904.de www-push-ol-level 905. nr www-ol-level +1 906. if (\\n[www-ol-level] > 3) \ 907. www-error "OLS: too many levels of indentation (\\n[www-ol-level])" 908.. 909.\" 910.\" Auxiliary macro for OLE. 911.\" 912.de www-pop-ol-level 913. if !\\n[www-ol-level] \ 914. www-error "OLE: trying to terminate a list which does not exist" 915. nr www-ol-level -1 916.. 917. 918.\" -------------------------------------------------------------------- 919.\" ULS 920.\" 921.\" Start an unordered list. 922.\" 923.de ULS 924. www-push-li www-li-ul 925. www-push-ul-level 926. ie \\n[www-html] \ 927. HTML</p> "<ul>" 928. el \{\ 929. nr www-li-indent +\w'\\*[www-ul-level\\n[www-ul-level]]'u 930. \} 931.. 932.\" -------------------------------------------------------------------- 933.\" ULE 934.\" 935.\" End an unordered list. 936.\" 937.de ULE 938. ie \\n[www-html] \ 939. HTML "</ul>" 940. el \{\ 941. nr www-li-indent -\w'\\*[www-ul-level\\n[www-ul-level]]'u 942. in \\n[www-li-indent]u 943. \} 944. www-pop-ul-level 945. www-pop-li 946.. 947.\" -------------------------------------------------------------------- 948.\" OLS 949.\" 950.\" Start an ordered list. 951.\" 952.de OLS 953. www-push-li www-li-ol 954. www-push-ol-level 955. ie \\n[www-html] \ 956. HTML</p> "<ol style='list-style-type: \\*[www-ol-level\\n[www-ol-level]]'>" 957. el \ 958. nr www-li-indent +\w'\\*[www-ol-tmp]'u 959.. 960.\" -------------------------------------------------------------------- 961.\" OLE 962.\" 963.\" End an ordered list. 964.\" 965.de OLE 966. ie \\n[www-html] \ 967. HTML "</ol>" 968. el \{\ 969. nr www-li-indent -\w'\\*[www-ol-tmp]'u 970. in \\n[www-li-indent]u 971. nr www-ol-ctr\\n[www-ol-level] 0 1 972. \} 973. www-pop-ol-level 974. www-pop-li 975.. 976.\" -------------------------------------------------------------------- 977.\" 978.\" DLS 979.\" Start a definition list. 980.\" 981.de DLS 982. www-push-li www-li-dl 983. nr www-dl-level +1 984. ie \\n[www-html] \ 985. HTML</p> "<dl>" 986. el \{\ 987. nr www-li-indent +\\n[www-dl-shift]u 988. in \\n[www-li-indent]u 989. \} 990.. 991.\" -------------------------------------------------------------------- 992.\" 993.\" DLE 994.\" End a definition list. 995.\" 996.de DLE 997. ie \\n[www-html] \ 998. HTML "</dl>" 999. el \{\ 1000. nr www-li-indent -\\n[www-dl-shift]u 1001. in \\n[www-li-indent]u 1002. \} 1003. nr www-dl-level -1 1004. www-pop-li 1005.. 1006.\" -------------------------------------------------------------------- 1007.\" LI 1008.\" 1009.\" Insert a list item. 1010.\" 1011.\" ******** 1012.\" www-li-ul - bulleted list item 1013.\" 1014.de www-li-ul 1015. ie \\n[www-html] \ 1016. HTML-NS "<li>" 1017. el \{\ 1018. www:paraspace 1019. in \\n[www-li-indent]u 1020. ti -\w'\\*[www-ul-level\\n[www-ul-level]]'u 1021. nop \\*[www-ul-level\\n[www-ul-level]]\c 1022. \} 1023.. 1024.\" ******** 1025.\" www-li-ol - numbered list item 1026.\" 1027.de www-li-ol 1028. ie \\n[www-html] \ 1029. HTML-NS "<li>" 1030. el \{\ 1031. www:paraspace 1032. in \\n[www-li-indent]u 1033. ti -\w'\\n[www-ol-ctr\\n[www-ol-level]]\ \ 'u 1034. nop \\n+[www-ol-ctr\\n[www-ol-level]]\ \ \c 1035. \} 1036.. 1037.\" ******** 1038.\" www-li-dl - definition list item 1039.\" 1040.de www-li-dl 1041. ie \\n[www-html] \{\ 1042. HTML "<dt>\\$1</dt>" 1043. HTML-NS "<dd>" 1044. \} 1045. el \{\ 1046. www:paraspace 1047. in \\n[www-li-indent]u 1048. ti -\\n[www-dl-shift]u 1049. nop \&\\$1 1050. br 1051. \} 1052.. 1053.\" -------------------------------------------------------------------- 1054.\" DC l text [color] 1055.\" 1056.\" L is the letter to be dropped and enlarged. 1057.\" 1058.\" TEXT is the following text whose height the first letter should not 1059.\" exceed. 1060.\" 1061.\" COLOR is the optional color of the dropped letter (default black). 1062.\" 1063.de DC 1064. ds www-dropcolor black 1065. if !'\\$3'' \ 1066. ds www-dropcolor \\$3 1067. ie '\*(.T'html' \{\ 1068. www-make-unique-name 1069. nr www-drop-width (100u * \\n[.v]u * 3u / \\n[.l]u) 1070. MPIMG -L \\*[www-unique-name].png "\\n[www-drop-width]%" 1071. \} 1072. el \{\ 1073. ie r ps4html \{\ 1074. www-make-unique-name 1075. \" To avoid interferences with another DC macro call which is located 1076. \" very near to the current one, we draw the glyph on a separate page. 1077. \" Otherwise it could theoretically happen that the dropped capital 1078. \" glyphs overlap. 1079. bp 1080. ev www-DC 1081. vs 320p 1082. nop \O[5i\\*[www-unique-name].png]\O[1] 1083. nop \m[\\*[www-dropcolor]]\s[160]\O[3]\\$1\O[4] 1084. nop \O[2]\O[0] 1085. br 1086. ev 1087. bp 1088. \} 1089. el \{\ 1090. ie n \ 1091. nop \\$1\c 1092. el \{\ 1093. nr dummy \w'\\$1'u 1094. nr dcht ((\\n[.v] + \\n[rst]) * \\n[.ps] / \\n[rst]) 1095. char \[dcap] \m[\\*[www-dropcolor]]\s'\\n[dcht]u'\\$1 1096. nop \v'\\n[.v]u'\\[dcap]\v'-\\n[.v]u'\c 1097' ti \w'\\[dcap]'u 1098. \} 1099. \} 1100. \} 1101. nop \\$2 1102.. 1103.\" -------------------------------------------------------------------- 1104.\" Setup around HTML-IMAGE and friends 1105.\" 1106.\" now set up TS, TE, EQ, EN default macros 1107.\" 1108.do if !d TS .do ds TS HTML-IMAGE 1109.do if !d TE .do ds TE HTML-IMAGE-END 1110.do if !d EQ .do ds EQ HTML-IMAGE 1111.do if !d EN .do ds EN HTML-IMAGE-END 1112.\" 1113.\" supplementary macros used by other macro sets 1114.\" 1115.\" here are some tags specially for -Tps or -Thtml when invoked by 1116.\" pre-html to generate png images from postscript. 1117. 1118.\" -------------------------------------------------------------------- 1119.\" HTML-DO-IMAGE - tells troff to issue an image marker which can be 1120.\" read back by pre-html 1121.\" 1122.de HTML-DO-IMAGE 1123. if r ps4html \ 1124. nop \O[5\\$2\\$1.png]\O[1]\O[3] 1125. if \\n[www-html] \ 1126. nop \O[5\\$2\\$1.png]\O[0]\O[3] 1127.. 1128.\" -------------------------------------------------------------------- 1129.\" HTML-IMAGE-END - terminates an image for html 1130.\" 1131.de HTML-IMAGE-END 1132. if r ps4html \ 1133. nop \O[4]\O[2]\O[0] 1134. if \\n[www-html] \ 1135. nop \O[4]\O[2]\O[1] 1136.. 1137. 1138.nr www-png-no 0 1139. 1140.\" -------------------------------------------------------------------- 1141.\" www-make-unique-name - generates another unique name in string 1142.\" `www-unique-name' 1143.\" 1144.de www-make-unique-name 1145. nr www-png-no +1 1146. ds www-unique-name \\*[www-image-template]\\n[www-png-no] 1147.. 1148.\" -------------------------------------------------------------------- 1149.\" HTML-IMAGE and friends tell grohtml that this region of text needs 1150.\" to be rendered as an image. 1151.\" 1152.de HTML-IMAGE 1153. \" generates a centered image 1154. www-make-unique-name 1155. HTML-DO-IMAGE \\*[www-unique-name] c 1156.. 1157. 1158.de HTML-IMAGE-RIGHT 1159. www-make-unique-name 1160. HTML-DO-IMAGE \\*[www-unique-name] r 1161.. 1162. 1163.de HTML-IMAGE-LEFT 1164. www-make-unique-name 1165. HTML-DO-IMAGE \\*[www-unique-name] l 1166.. 1167. 1168.de HTML-IMAGE-INLINE 1169. www-make-unique-name 1170. HTML-DO-IMAGE \\*[www-unique-name] i 1171.. 1172. 1173.\" -------------------------------------------------------------------- 1174.\" JOBNAME 1175.\" 1176.\" Generate multiple output files containing the html. 1177.\" A file is split whenever a .SH or .NH 1 is encountered. 1178.\" The argument to JOBNAME is the file stem for future output files. 1179.\" 1180.de JOBNAME 1181. DEVTAG .job-name \\$1 1182.. 1183.\" -------------------------------------------------------------------- 1184.\" HEAD 1185.\" 1186.\" Adds information to the <head> </head> section of the html 1187.\" document 1188.\" -------------------------------------------------------------------- 1189.de HEAD 1190. DEVTAG .head "\\$*" 1191.. 1192.\" -------------------------------------------------------------------- 1193.\" Final Setup 1194.\" -------------------------------------------------------------------- 1195. 1196.if \n[www-html] \{\ 1197. nh 1198. nr HY 0 1199.\} 1200. 1201.\" 1202.\" start of some code 1203.\" 1204. 1205.de CDS 1206.ft C 1207.nf 1208.. 1209.\" 1210.\" end of some code 1211.\" 1212. 1213.de CDE 1214.fi 1215.ft P 1216.. 1217. 1218.if r ps4html .nop \O[0] 1219.cp \n(_C 1220. 1221.\" now set 1222. 1223.\" -------------------------------------------------------------------- 1224.\" Emacs settings 1225.\" -------------------------------------------------------------------- 1226. 1227.\" Local Variables: 1228.\" mode: nroff 1229.\" End: 1230.\" EOF 1231