* mandoc: Implement the roff(7) .nop (no operation) request.
@ 2018-08-10 4:41 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2018-08-10 4:41 UTC (permalink / raw)
To: source
Log Message:
-----------
Implement the roff(7) .nop (no operation) request.
Examples of manual pages (ab)using it
include groff(7), chem(1), groff_mom(7), and groff_hdtbl(7).
Modified Files:
--------------
mandoc:
TODO
roff.7
roff.c
Revision Data
-------------
Index: roff.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/roff.c,v
retrieving revision 1.329
retrieving revision 1.330
diff -Lroff.c -Lroff.c -u -p -r1.329 -r1.330
--- roff.c
+++ roff.c
@@ -197,6 +197,7 @@ static enum rofferr roff_line_ignore(RO
static void roff_man_alloc1(struct roff_man *);
static void roff_man_free1(struct roff_man *);
static enum rofferr roff_manyarg(ROFF_ARGS);
+static enum rofferr roff_nop(ROFF_ARGS);
static enum rofferr roff_nr(ROFF_ARGS);
static enum rofferr roff_onearg(ROFF_ARGS);
static enum roff_tok roff_parse(struct roff *, char *, int *,
@@ -490,7 +491,7 @@ static struct roffmac roffs[TOKEN_NONE]
{ roff_line_ignore, NULL, NULL, 0 }, /* nhychar */
{ roff_unsupp, NULL, NULL, 0 }, /* nm */
{ roff_unsupp, NULL, NULL, 0 }, /* nn */
- { roff_unsupp, NULL, NULL, 0 }, /* nop */
+ { roff_nop, NULL, NULL, 0 }, /* nop */
{ roff_nr, NULL, NULL, 0 }, /* nr */
{ roff_unsupp, NULL, NULL, 0 }, /* nrf */
{ roff_line_ignore, NULL, NULL, 0 }, /* nroff */
@@ -3158,6 +3159,15 @@ roff_eo(ROFF_ARGS)
mandoc_vmsg(MANDOCERR_ARG_SKIP, r->parse,
ln, pos, "eo %s", buf->buf + pos);
return ROFF_IGN;
+}
+
+static enum rofferr
+roff_nop(ROFF_ARGS)
+{
+ while (buf->buf[pos] == ' ')
+ pos++;
+ *offs = pos;
+ return ROFF_RERUN;
}
static enum rofferr
Index: TODO
===================================================================
RCS file: /home/cvs/mandoc/mandoc/TODO,v
retrieving revision 1.258
retrieving revision 1.259
diff -LTODO -LTODO -u -p -r1.258 -r1.259
--- TODO
+++ TODO
@@ -38,9 +38,6 @@ are mere guesses, and some may be wrong.
--- missing roff features ----------------------------------------------
-- .nop prints its arguments as text,
- see groff(7) for an example
-
- .ft CB selects constant-width bold font
see groff_out(7) for examples
Index: roff.7
===================================================================
RCS file: /home/cvs/mandoc/mandoc/roff.7,v
retrieving revision 1.96
retrieving revision 1.97
diff -Lroff.7 -Lroff.7 -u -p -r1.96 -r1.97
--- roff.7
+++ roff.7
@@ -206,7 +206,7 @@ Unescaped trailing spaces are stripped f
literal context.
In general, trailing whitespace on any input line is discouraged for
reasons of portability.
-In the rare case that a blank character is needed at the end of an
+In the rare case that a space character is needed at the end of an
input line, it may be forced by
.Sq \e\ \e& .
.Pp
@@ -665,7 +665,7 @@ produces
.Pp
in the input stream, and thus in the output: \fI\^XtFree\^\fP.
Each occurrence of \e\e$* is replaced with all the arguments,
-joined together with single blank characters.
+joined together with single space characters.
.Pp
Since macros and user-defined strings share a common string table,
defining a macro
@@ -1346,8 +1346,11 @@ Currently unsupported.
Temporarily turn off line numbering.
Currently unsupported.
.It Ic \&nop Ar body
-Execute the rest of the input line as a request or macro line.
-Currently unsupported.
+Execute the rest of the input line as a request, macro, or text line,
+skipping the
+.Ic \&nop
+request and any space characters immediately following it.
+This is mostly used to indent text lines inside macro definitions.
.It Ic \&nr Ar register Oo Cm + Ns | Ns Cm - Oc Ns Ar expression Op Ar stepsize
Define or change a register.
A register is an arbitrary string value that defines some sort of state,
--
To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-08-10 4:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-10 4:41 mandoc: Implement the roff(7) .nop (no operation) request schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).