Skip to content

Commit 4d39337

Browse files
committed
Make further modifications for mdoc rendering
1 parent ae8c30d commit 4d39337

6 files changed

Lines changed: 63 additions & 60 deletions

File tree

examples/ls.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.\"
2-
.\" Generated by predoc at 2025-09-19T02:26:42Z
2+
.\" Generated by predoc at 2025-09-20T14:45:08Z
33
.\"
44
.\" Copyright (c) 1980, 1990, 1991, 1993, 1994
55
.\" The Regents of the University of California. All rights reserved.

examples/mdoc.7

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.\"
2-
.\" Generated by predoc at 2025-09-19T02:26:42Z
2+
.\" Generated by predoc at 2025-09-20T14:45:08Z
33
.\"
44
.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
55
.\" Copyright (c) 2010, 2011, 2013-2020 Ingo Schwarze <schwarze@openbsd.org>
@@ -1083,7 +1083,7 @@ for a single page or
10831083
for a range of pages,
10841084
for example:
10851085
.Bd -literal -offset indent
1086-
\&.%P pp\&. 42\e(en47
1086+
\&.%P pp\&. 42\e\*(lpen47
10871087
.Ed
10881088
.It Xo
10891089
.Ic \&%Q
@@ -1143,7 +1143,7 @@ Do not use this for postal addresses.
11431143
.Pp
11441144
Examples:
11451145
.Bd -literal -offset indent
1146-
\&.Ad \(lB0,$]
1146+
\&.Ad \(lB0,$\(rB
11471147
\&.Ad 0x00000000
11481148
.Ed
11491149
.It Xo
@@ -1961,7 +1961,7 @@ It is followed by a newline.
19611961
.Pp
19621962
Examples:
19631963
.Bd -literal -offset indent
1964-
\&.Dl % mandoc mdoc\&.7 \e(ba less
1964+
\&.Dl % mandoc mdoc\&.7 \e\*(lpba less
19651965
.Ed
19661966
.Pp
19671967
See also
@@ -1982,7 +1982,7 @@ Examples:
19821982
\&.Do
19831983
April is the cruellest month
19841984
\&.Dc
1985-
\e(em T\&.S\&. Eliot
1985+
\e\*(lpem T\&.S\&. Eliot
19861986
.Ed
19871987
.Pp
19881988
See also
@@ -1996,7 +1996,7 @@ Encloses its arguments in “typographic” double-quotes.
19961996
Examples:
19971997
.Bd -literal -offset indent
19981998
\&.Dq April is the cruellest month
1999-
\e(em T\&.S\&. Eliot
1999+
\e\*(lpem T\&.S\&. Eliot
20002000
.Ed
20012001
.Pp
20022002
See also
@@ -2146,7 +2146,7 @@ The
21462146
argument is used as the enclosure tail,
21472147
for example,
21482148
specifying
2149-
.Ql "\e(rq"
2149+
.Ql "\e\*(lprq"
21502150
will emulate
21512151
.Ic \&Dc .
21522152
.It Xo
@@ -2233,7 +2233,7 @@ The
22332233
argument is used as the enclosure head,
22342234
for example,
22352235
specifying
2236-
.Ql "\e(lq"
2236+
.Ql "\e\*(lplq"
22372237
will emulate
22382238
.Ic \&Do .
22392239
.It Xo
@@ -3862,7 +3862,7 @@ function definition or include directive.
38623862
Examples:
38633863
.Bd -literal -offset indent
38643864
\&.Vt unsigned char
3865-
\&.Vt extern const char * const sys_signame\(lB] ;
3865+
\&.Vt extern const char * const sys_signame\(lB\(rB ;
38663866
.Ed
38673867
.Pp
38683868
For parameters in function prototypes,
@@ -3932,14 +3932,14 @@ its name as an argument to another macro.
39323932
For example,
39333933
.Ql "\&.Op Fl O Ar file"
39343934
produces
3935-
.Ql "\(lB-O file]" .
3935+
.Ql "\(lB-O file\(rB" .
39363936
To prevent a macro call and render the macro name literally,
39373937
escape it by prepending a zero-width space,
39383938
.Ql "\e&" .
39393939
For example,
39403940
.Ql "Op \e&Fl O"
39413941
produces
3942-
.Ql "\(lBFl O]" .
3942+
.Ql "\(lBFl O\(rB" .
39433943
If a macro is not callable but its name appears as an argument
39443944
to another macro,
39453945
it is interpreted as opaque text.
@@ -3971,18 +3971,18 @@ and (optionally)
39713971
.Ic \&Bl
39723972
contain a head.
39733973
.Bd -literal -offset indent
3974-
\&.Yo \(lB-arg \(lBparm\&.\&.\&.]] \(lBhead\&.\&.\&.]
3975-
\(lBbody\&.\&.\&.]
3974+
\&.Yo \(lB-arg \(lBparm\&.\&.\&.\(rB\(rB \(lBhead\&.\&.\&.\(rB
3975+
\(lBbody\&.\&.\&.\(rB
39763976
\&.Yc
39773977
.Ed
39783978
.Bl -column " " " " " " " "
39793979
.It Xo
39803980
.Em Macro
3981-
.Ta\c
3981+
.Ta
39823982
.Em Callable
3983-
.Ta\c
3983+
.Ta
39843984
.Em Parsed
3985-
.Ta\c
3985+
.Ta
39863986
.Em Scope
39873987
.Xc
39883988
.It Xo
@@ -4086,17 +4086,17 @@ in
40864086
.Fl column )
40874087
has multiple heads.
40884088
.Bd -literal -offset indent
4089-
\&.Yo \(lB-arg \(lBparm\&.\&.\&.]] \(lBhead\&.\&.\&. \(lBTa head\&.\&.\&.]]
4090-
\(lBbody\&.\&.\&.]
4089+
\&.Yo \(lB-arg \(lBparm\&.\&.\&.\(rB\(rB \(lBhead\&.\&.\&. \(lBTa head\&.\&.\&.\(rB\(rB
4090+
\(lBbody\&.\&.\&.\(rB
40914091
.Ed
40924092
.Bl -column " " " " " " " "
40934093
.It Xo
40944094
.Em Macro
4095-
.Ta\c
4095+
.Ta
40964096
.Em Callable
4097-
.Ta\c
4097+
.Ta
40984098
.Em Parsed
4099-
.Ta\c
4099+
.Ta
41004100
.Em Scope
41014101
.Xc
41024102
.It Xo
@@ -4176,20 +4176,20 @@ a head (\c
41764176
and/or tail (\c
41774177
.Ic \&Ec ) .
41784178
.Bd -literal -offset indent
4179-
\&.Yo \(lB-arg \(lBparm\&.\&.\&.]] \(lBhead\&.\&.\&.]
4180-
\(lBbody\&.\&.\&.]
4181-
\&.Yc \(lBtail\&.\&.\&.]
4179+
\&.Yo \(lB-arg \(lBparm\&.\&.\&.\(rB\(rB \(lBhead\&.\&.\&.\(rB
4180+
\(lBbody\&.\&.\&.\(rB
4181+
\&.Yc \(lBtail\&.\&.\&.\(rB
41824182

4183-
\&.Yo \(lB-arg \(lBparm\&.\&.\&.]] \(lBhead\&.\&.\&.] \(lBbody\&.\&.\&.] Yc \(lBtail\&.\&.\&.]
4183+
\&.Yo \(lB-arg \(lBparm\&.\&.\&.\(rB\(rB \(lBhead\&.\&.\&.\(rB \(lBbody\&.\&.\&.\(rB Yc \(lBtail\&.\&.\&.\(rB
41844184
.Ed
41854185
.Bl -column " " " " " " " "
41864186
.It Xo
41874187
.Em Macro
4188-
.Ta\c
4188+
.Ta
41894189
.Em Callable
4190-
.Ta\c
4190+
.Ta
41914191
.Em Parsed
4192-
.Ta\c
4192+
.Ta
41934193
.Em Scope
41944194
.Xc
41954195
.It Xo
@@ -4438,14 +4438,14 @@ closed by
44384438
Like block full-implicit,
44394439
but with single-line scope closed by the end of the line.
44404440
.Bd -literal -offset indent
4441-
\&.Yo \(lB-arg \(lBval\&.\&.\&.]] \(lBbody\&.\&.\&.] \(lBres\&.\&.\&.]
4441+
\&.Yo \(lB-arg \(lBval\&.\&.\&.\(rB\(rB \(lBbody\&.\&.\&.\(rB \(lBres\&.\&.\&.\(rB
44424442
.Ed
44434443
.Bl -column " " " " " "
44444444
.It Xo
44454445
.Em Macro
4446-
.Ta\c
4446+
.Ta
44474447
.Em Callable
4448-
.Ta\c
4448+
.Ta
44494449
.Em Parsed
44504450
.Xc
44514451
.It Xo
@@ -4566,11 +4566,11 @@ but no heads.
45664566
.Bl -column " " " " " " " "
45674567
.It Xo
45684568
.Em Macro
4569-
.Ta\c
4569+
.Ta
45704570
.Em Callable
4571-
.Ta\c
4571+
.Ta
45724572
.Em Parsed
4573-
.Ta\c
4573+
.Ta
45744574
.Em Scope
45754575
.Xc
45764576
.It Xo
@@ -4595,20 +4595,20 @@ If a number (or inequality)
45954595
of arguments is (n),
45964596
then the macro accepts an arbitrary number of arguments.
45974597
.Bd -literal -offset indent
4598-
\&.Yo \(lB-arg \(lBval\&.\&.\&.]] \(lBargs\&.\&.\&.] \(lBres\&.\&.\&.]
4598+
\&.Yo \(lB-arg \(lBval\&.\&.\&.\(rB\(rB \(lBargs\&.\&.\&.\(rB \(lBres\&.\&.\&.\(rB
45994599

4600-
\&.Yo \(lB-arg \(lBval\&.\&.\&.]] \(lBargs\&.\&.\&.] Yc\&.\&.\&.
4600+
\&.Yo \(lB-arg \(lBval\&.\&.\&.\(rB\(rB \(lBargs\&.\&.\&.\(rB Yc\&.\&.\&.
46014601

4602-
\&.Yo \(lB-arg \(lBval\&.\&.\&.]] arg0 arg1 argN
4602+
\&.Yo \(lB-arg \(lBval\&.\&.\&.\(rB\(rB arg0 arg1 argN
46034603
.Ed
46044604
.Bl -column " " " " " " " "
46054605
.It Xo
46064606
.Em Macro
4607-
.Ta\c
4607+
.Ta
46084608
.Em Callable
4609-
.Ta\c
4609+
.Ta
46104610
.Em Parsed
4611-
.Ta\c
4611+
.Ta
46124612
.Em Arguments
46134613
.Xc
46144614
.It Xo
@@ -5267,12 +5267,12 @@ Spacing is suppressed after opening delimiters and before closing
52675267
delimiters.
52685268
For example,
52695269
.Bd -literal -offset indent
5270-
\&.Aq ( \(lB word ] ) \&.
5270+
\&.Aq \*(lp \(lB word \(rB \*(rp \&.
52715271
.Ed
52725272
.Pp
52735273
renders as:
52745274
.Bd -literal -offset indent
5275-
(\(lB⟨word⟩])\&.
5275+
\*(lp\(lB⟨word⟩\(rB\*(rp\&.
52765276
.Ed
52775277
.Pp
52785278
Opening delimiters are:
@@ -5328,12 +5328,12 @@ and resume their scope when more arguments follow that are not
53285328
delimiters.
53295329
For example,
53305330
.Bd -literal -offset indent
5331-
\&.Fl a ( b | c \e*(Ba d ) e
5331+
\&.Fl a \*(lp b | c \e*\*(lpBa d \*(rp e
53325332
.Ed
53335333
.Pp
53345334
renders as:
53355335
.Bd -literal -offset indent
5336-
-a (-b | -c | -d) -e
5336+
-a \*(lp-b | -c | -d\*(rp -e
53375337
.Ed
53385338
.Pp
53395339
This applies to both opening and closing delimiters,
@@ -5348,7 +5348,7 @@ vertical bar
53485348
.Pp
53495349
As a special case,
53505350
the predefined string
5351-
.Ql "\e*(Ba"
5351+
.Ql "\e*\*(lpBa"
53525352
is handled and rendered in the same way as a plain
53535353
.Ql "|"
53545354
character.

examples/rmdir.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.\"
2-
.\" Generated by predoc at 2025-09-19T02:26:42Z
2+
.\" Generated by predoc at 2025-09-20T14:45:08Z
33
.\"
44
.\" Copyright (c) 1990, 1993
55
.\" The Regents of the University of California. All rights reserved.

lib/mdoc.janet

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88
(def- sq 39)
99
(def- po 40)
1010
(def- pc 41)
11+
(def- cm 44)
1112
(def- ms 45)
1213
(def- fs 46)
1314
(def- bo 91)
1415
(def- bs 92)
1516
(def- bc 93)
1617

17-
(def- trail-delims ".,:;?!)")
18+
(def- trail-delims ".,:;)]?!")
1819
(def- macros [
1920
"Ac" "Ad" "An" "Ao" "Ap" "Aq" "Ar" "At" "Bc" "Bd" "Bf" "Bk" "Bl" "Bo" "Bq"
2021
"Brc" "Bro" "Brq" "Bsx" "Bt" "Bx" "Cd" "Cm" "D1" "Db" "Dc" "Dd" "Dl" "Do"
@@ -54,7 +55,8 @@
5455

5556
(defn- buffer-esc [b s &opt inline?]
5657
(def escapes
57-
{bo "\\(lB" bs "\\e" dq "\\(dq" fs "\\&." sq "\\(aq"})
58+
{bc "\\(rB" bo "\\(lB" bs "\\e" dq "\\(dq" fs "\\&." pc "\\*(rp"
59+
po "\\*(lp" sq "\\(aq"})
5860
(var i 0)
5961
(while (def ch (get s i))
6062
(buffer/push b (get escapes ch ch))
@@ -281,6 +283,7 @@
281283
(when (and cont-output?
282284
(ending-nl? b)
283285
(not (string/has-suffix? "Xo\n" b))
286+
(not (string/has-suffix? "Ta\n" b))
284287
(not (string/check-set trail-delims (string/slice b -3 -2))))
285288
(buffer/popn b 1)
286289
(buffer/push b "\\c\n"))

man/man1/predoc.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.\"
2-
.\" Generated by predoc at 2025-09-19T02:26:42Z
2+
.\" Generated by predoc at 2025-09-20T14:45:08Z
33
.\"
44
.Dd September 13, 2025
55
.Dt PREDOC 1

man/man7/predoc.7

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.\"
2-
.\" Generated by predoc at 2025-09-19T02:26:42Z
2+
.\" Generated by predoc at 2025-09-20T14:45:08Z
33
.\"
44
.Dd September 13, 2025
55
.Dt PREDOC 7
@@ -118,7 +118,7 @@ the frontmatter must include a
118118
The other elements are optional.
119119
.Bd -literal -offset indent
120120
---
121-
Title: EXAMPLE(7)
121+
Title: EXAMPLE\*(lp7\*(rp
122122
Authors: Jane Smith <jane@example\&.org>
123123
Date: 2025-01-01
124124
Project: Example
@@ -758,7 +758,7 @@ to the command.
758758
An optional is denoted by
759759
.Ql "\(lB"
760760
and
761-
.Ql "]"
761+
.Ql "\(rB"
762762
enclosing arguments and/or options.
763763
An optional will only be parsed if its contents are some combination
764764
of arguments,
@@ -768,7 +768,7 @@ and
768768
.Ql "|" .
769769
.Bd -literal -offset indent
770770
Begin the training program using **train**
771-
\(lB**--coop** | **--location** _location_]\&.
771+
\(lB**--coop** | **--location** _location_\(rB\&.
772772
.Ed
773773
.Pp
774774
An optional cannot be nested in other inline elements.
@@ -902,7 +902,7 @@ An external cross-reference is denoted by a Predoc inline marker
902902
on either side of the text.
903903
The text must end in a number in parentheses.
904904
.Bd -literal -offset indent
905-
The image translators work for `construct(1)`\&.
905+
The image translators work for `construct\*(lp1\*(rp`\&.
906906
.Ed
907907
.Pp
908908
A cross-reference cannot be nested in other inline elements.
@@ -1026,16 +1026,16 @@ request.
10261026
A link is denoted by
10271027
.Ql "\(lB"
10281028
and
1029-
.Ql "]"
1029+
.Ql "\(rB"
10301030
on either side of the linked text.
10311031
The URL must immediately following the
1032-
.Ql "]"
1032+
.Ql "\(rB"
10331033
and be surrounded by
1034-
.Ql "("
1034+
.Ql "\*(lp"
10351035
and
1036-
.Ql ")" .
1036+
.Ql "\*(rp" .
10371037
.Bd -literal -offset indent
1038-
I know \(lBkung fu](https://example\&.org)\&.
1038+
I know \(lBkung fu\(rB\*(lphttps://example\&.org\*(rp\&.
10391039
.Ed
10401040
.Pp
10411041
A link can be nested in emphasis text and strong text.

0 commit comments

Comments
 (0)