From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: Implement the roff(7) .nop (no operation) request.
Date: Thu, 9 Aug 2018 23:41:56 -0500 (EST) [thread overview]
Message-ID: <c89eee51d5bf19f3@fantadrom.bsd.lv> (raw)
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
reply other threads:[~2018-08-10 4:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c89eee51d5bf19f3@fantadrom.bsd.lv \
--to=schwarze@mandoc.bsd.lv \
--cc=source@mandoc.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).