E. Scott Daniels | 3a2533f | 2020-04-22 12:40:27 -0400 | [diff] [blame] | 1 | .if false |
| 2 | ================================================================================== |
| 3 | Copyright (c) 2020 Nokia |
| 4 | Copyright (c) 2020 AT&T Intellectual Property. |
| 5 | |
| 6 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | you may not use this file except in compliance with the License. |
| 8 | You may obtain a copy of the License at |
| 9 | |
| 10 | http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | |
| 12 | Unless required by applicable law or agreed to in writing, software |
| 13 | distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | See the License for the specific language governing permissions and |
| 16 | limitations under the License. |
| 17 | ================================================================================== |
| 18 | .fi |
| 19 | |
| 20 | .if false |
| 21 | Mnemonic: rts.im |
| 22 | Abstract: This file provides macros allowing {X}fm source to generate |
| 23 | rts input from {X}fm source when the doc is passed through |
| 24 | tfm, and to generate postscirpt output when passed through |
| 25 | pfm. Simalar to the roff.im macro set that allows the generation |
| 26 | of troff input for man pages. |
| 27 | |
| 28 | Author: E. Scott Daniels |
| 29 | Date: 7 February 2019 |
| 30 | |
| 31 | |
| 32 | Maybe useful (but doesn't explain why real formatters aren't being used) |
| 33 | http://docutils.sourceforge.net/docs/user/rst/quickref.html |
| 34 | .fi |
| 35 | |
| 36 | |
| 37 | .** convert {X}fm input into rts. |
| 38 | .** post processing is needed to strip the leading space that tfm insists on adding. |
| 39 | |
| 40 | .** bloody rst has no consistant marking character, and each header level must be different and as long as the text. |
| 41 | .** and of course they don't generate <hx> tags in the resulting HTML, but <section> tags. WTF? |
| 42 | .dv many_equals ============================================================================================ |
| 43 | .dv many_dashes -------------------------------------------------------------------------------------------- |
| 44 | .dv many_tildas ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
E. Scott Daniels | caed01a | 2020-06-12 13:47:13 -0400 | [diff] [blame] | 45 | |
| 46 | .gv semver |
| 47 | .if &_major 1 > |
| 48 | .** tfm version 2.0.0+ supports header annotation for rst |
| 49 | .dh 1 a==after s=2,1 i=0 m=0 |
| 50 | .dh 2 a=-after s=2,1 i=0 m=0 |
| 51 | .dh 3 a=~after s=2,0 i=0 m=0 |
| 52 | |
| 53 | .dv h1 .h1 $1 |
| 54 | .dv h2 .h2 $1 |
| 55 | .dv h3 .h2 $1 |
| 56 | .ei |
| 57 | .dv __alert ### WARNING ### rst.im detects an old(er) version of tfm some formatting might not be right |
| 58 | .sv __alert |
| 59 | |
| 60 | .dh 1 s=2,1 i=0 m=0 |
| 61 | .dh 2 s=1.1 i=0 m=0 |
| 62 | .dh 3 s=1,0 i=0 m=0 |
| 63 | |
| 64 | .dv h1 .sp 1 $1 .br &many_equals .sp 1 |
| 65 | .dv h2 .sp 1 $1 .br &many_dashes .sp 1 |
| 66 | .dv h3 .sp 1 $1 .br &many_tildas .sp 1 |
| 67 | .fi |
| 68 | .dv h4 **$1** |
E. Scott Daniels | 3a2533f | 2020-04-22 12:40:27 -0400 | [diff] [blame] | 69 | |
E. Scott Daniels | 5a9d7c6 | 2020-07-09 11:56:10 -0400 | [diff] [blame] | 70 | .** initially need a wide column to allow copyright to not break |
E. Scott Daniels | 3a2533f | 2020-04-22 12:40:27 -0400 | [diff] [blame] | 71 | .dv cd 1 180i m=0i |
| 72 | |
E. Scott Daniels | 3a2533f | 2020-04-22 12:40:27 -0400 | [diff] [blame] | 73 | |
| 74 | .dv fig |
| 75 | .dv set_font_cw |
| 76 | |
| 77 | .dv nf .sp 1 ^:^: .br .ll -2 .in +2 |
| 78 | .dv fo .in -2 .ll +2 .sp 1 |
| 79 | |
| 80 | .dv indent |
| 81 | .dv uindent |
| 82 | |
| 83 | .dv lic1 + |
| 84 | .dv lic2 - |
| 85 | .dv lic3 * |
| 86 | |
| 87 | .in 0i .** bloody rst is indention sensitive like markdown; sheesh |
| 88 | |
| 89 | .dv esc \ : .** bloody need to escape _ and * at the end of a word |
| 90 | .dv line_len .ll $1 |
| 91 | .dv space .sp 1 |
| 92 | .dv half_space .sp 1 |
| 93 | .dv mult_space .sp $1 |
| 94 | .dv beg_list .ll 17i .sp 1 .dv lic $1 ^: |
| 95 | .dv end_list .ll 6i .sp 1 |
| 96 | |
| 97 | .dv figure .fg $1 |
| 98 | |
| 99 | .dv beg_dlist .sp 1 .ll -3 |
| 100 | .dv end_dlist .br .in 0i .ll +3 |
| 101 | |
| 102 | .** for now we allow only a single layer of defitems |
| 103 | .dv di .in 0i .br $1 .br .in +3 |
| 104 | .dv ditem .in 0i .br $1 .br .in +3 |
| 105 | .** diitem is odd and deprecated |
| 106 | .dv diitem .in 0i .br $1 .br .in +3 |
| 107 | .dv item .br &lic |
| 108 | .dv li .br &lic |
| 109 | |
E. Scott Daniels | 97204c8 | 2020-06-29 15:39:57 -0400 | [diff] [blame] | 110 | .dv ex_start .sp 1 ^:^: .sp 1 .ll -2 .in +2 .nf |
E. Scott Daniels | 3a2533f | 2020-04-22 12:40:27 -0400 | [diff] [blame] | 111 | .dv ex_end .fo on .in -2 .ll +2 .sp 1 |
| 112 | |
| 113 | .dv proto_start .sp 1 .cc .5i .st 9 .sf Courier-bold .nf |
| 114 | .dv proto_end .fo on .sf ^&text_font .st ^&text_size .sp .3 |
| 115 | |
| 116 | .dv center .br $1 .br |
| 117 | .dv center_start .br |
| 118 | .dv center_end .br |
| 119 | |
| 120 | .** fonts and font macros |
| 121 | .dv ital *$1* |
| 122 | .dv bold **$1** |
| 123 | .dv cw $1 |
| 124 | .dv set_font_prop |
| 125 | |
| 126 | .dv table .sp 1 ^[table not supported in rst output] .if false |
| 127 | .dv tab_cell |
| 128 | .dv tab_row |
| 129 | .dv end_table .fi |
| 130 | |
| 131 | .dv super .sm ^[ .sm ^&{ss_num}] |
| 132 | .dv ss_num 1 |
| 133 | .dv note .dv ss_num ^[ ?%.0f ^&ss_num 1 + ] ^: .sm ^^[^&{ss_num}] |
| 134 | .** rst has no concept of a page, so all notes go to the close of the doc |
| 135 | .dv atbot atclose |
| 136 | |
| 137 | .ju off |