* mdocml: Implement appending to standard man(7) and mdoc(7) macros with
@ 2017-06-18 17:36 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-06-18 17:36 UTC (permalink / raw)
To: source
Log Message:
-----------
Implement appending to standard man(7) and mdoc(7) macros with .am.
With roff_getstrn(), provide finer control which definitions
can be used for what:
* All definitions can be used for .if d tests and .am appending.
* User-defined for \* expansion, .dei expansion, and macro calling.
* Predefined for \* expansion.
* Standard macros, original or renamed, for macro calling.
Several related improvements while here:
* Do not return string table entries that have explicitly been removed.
* Do not create a rentab entry when trying to rename a non-existent macro.
* Clear an existing rentab entry when the external interface
roff_setstr() is called with its name.
* Avoid trailing blanks in macro lines generated from renamed
and from aliased macros.
* Delete the duplicate __m*_reserved[] tables, just use roff_name[].
Modified Files:
--------------
mdocml:
roff.c
mdocml/regress/roff:
Makefile
mdocml/regress/roff/cond:
string.in
string.out_ascii
mdocml/regress/roff/de:
append.in
append.out_ascii
mdocml/regress/roff/string:
Makefile
Added Files:
-----------
mdocml/regress/roff/rn:
Makefile
append.in
append.out_ascii
mdocml/regress/roff/string:
std.in
std.out_ascii
std.out_lint
Revision Data
-------------
Index: string.in
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/roff/cond/string.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/roff/cond/string.in -Lregress/roff/cond/string.in -u -p -r1.1 -r1.2
--- regress/roff/cond/string.in
+++ regress/roff/cond/string.in
@@ -27,3 +27,7 @@ mymacval
.ie d myren now defined
.el OOPS
.if !d myren OOPS
+.PP
+standard macro is
+.ie d PP defined
+.el not defined \(em OOPS
Index: string.out_ascii
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/roff/cond/string.out_ascii,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/roff/cond/string.out_ascii -Lregress/roff/cond/string.out_ascii -u -p -r1.1 -r1.2
--- regress/roff/cond/string.out_ascii
+++ regress/roff/cond/string.out_ascii
@@ -15,6 +15,8 @@ D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
myren not yet defined
now defined
+ standard macro is defined
+
OpenBSD June 14, 2017 STRING(1)
--- /dev/null
+++ regress/roff/rn/append.in
@@ -0,0 +1,23 @@
+.Dd June 18, 2017
+.Dt RN-APPEND 1
+.Os OpenBSD
+.Sh NAME
+.Nm rn-append
+.Nd append to renamed standard macro
+.Sh DESCRIPTION
+original macro:
+.Bo in brackets
+.Bc
+.Pp
+renamed macro:
+.rn Bc myBc
+.Bo in brackets
+.myBc
+.Pp
+appending to macro:
+.am myBc
+.Pq appended words
+..
+.Bo more in brackets
+.myBc
+final text
--- /dev/null
+++ regress/roff/rn/append.out_ascii
@@ -0,0 +1,13 @@
+RN-APPEND(1) General Commands Manual RN-APPEND(1)
+
+N\bNA\bAM\bME\bE
+ r\brn\bn-\b-a\bap\bpp\bpe\ben\bnd\bd - append to renamed standard macro
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ original macro: [in brackets]
+
+ renamed macro: [in brackets]
+
+ appending to macro: [more in brackets] (appended words) final text
+
+OpenBSD June 18, 2017 OpenBSD
--- /dev/null
+++ regress/roff/rn/Makefile
@@ -0,0 +1,5 @@
+# $OpenBSD: Makefile,v 1.10 2017/03/07 20:00:02 schwarze Exp $
+
+REGRESS_TARGETS = append
+
+.include <bsd.regress.mk>
Index: roff.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/roff.c,v
retrieving revision 1.314
retrieving revision 1.315
diff -Lroff.c -Lroff.c -u -p -r1.314 -r1.315
--- roff.c
+++ roff.c
@@ -39,6 +39,14 @@
/* Maximum number of string expansions per line, to break infinite loops. */
#define EXPAND_LIMIT 1000
+/* Types of definitions of macros and strings. */
+#define ROFFDEF_USER (1 << 1) /* User-defined. */
+#define ROFFDEF_PRE (1 << 2) /* Predefined. */
+#define ROFFDEF_REN (1 << 3) /* Renamed standard macro. */
+#define ROFFDEF_STD (1 << 4) /* mdoc(7) or man(7) macro. */
+#define ROFFDEF_ANY (ROFFDEF_USER | ROFFDEF_PRE | \
+ ROFFDEF_REN | ROFFDEF_STD)
+
/* --- data types --------------------------------------------------------- */
/*
@@ -177,10 +185,8 @@ static int roff_getregn(const struct r
const char *, size_t);
static int roff_getregro(const struct roff *,
const char *name);
-static const char *roff_getrenn(const struct roff *,
- const char *, size_t);
static const char *roff_getstrn(const struct roff *,
- const char *, size_t);
+ const char *, size_t, int *);
static int roff_hasregn(const struct roff *,
const char *, size_t);
static enum rofferr roff_insec(ROFF_ARGS);
@@ -207,7 +213,6 @@ static void roff_setstrn(struct roffkv
static enum rofferr roff_so(ROFF_ARGS);
static enum rofferr roff_tr(ROFF_ARGS);
static enum rofferr roff_Dd(ROFF_ARGS);
-static enum rofferr roff_TH(ROFF_ARGS);
static enum rofferr roff_TE(ROFF_ARGS);
static enum rofferr roff_TS(ROFF_ARGS);
static enum rofferr roff_EQ(ROFF_ARGS);
@@ -536,7 +541,7 @@ static struct roffmac roffs[TOKEN_NONE]
{ roff_T_, NULL, NULL, 0 }, /* T& */
{ roff_unsupp, NULL, NULL, 0 }, /* tc */
{ roff_TE, NULL, NULL, 0 }, /* TE */
- { roff_TH, NULL, NULL, 0 }, /* TH */
+ { roff_Dd, NULL, NULL, 0 }, /* TH */
{ roff_line_ignore, NULL, NULL, 0 }, /* tkf */
{ roff_unsupp, NULL, NULL, 0 }, /* tl */
{ roff_line_ignore, NULL, NULL, 0 }, /* tm */
@@ -574,39 +579,6 @@ static struct roffmac roffs[TOKEN_NONE]
{ roff_userdef, NULL, NULL, 0 }
};
-/* not currently implemented: Ds em Eq LP Me PP pp Or Rd Sf SH */
-const char *const __mdoc_reserved[] = {
- "Ac", "Ad", "An", "Ao", "Ap", "Aq", "Ar", "At",
- "Bc", "Bd", "Bf", "Bk", "Bl", "Bo", "Bq",
- "Brc", "Bro", "Brq", "Bsx", "Bt", "Bx",
- "Cd", "Cm", "Db", "Dc", "Dd", "Dl", "Do", "Dq",
- "Dt", "Dv", "Dx", "D1",
- "Ec", "Ed", "Ef", "Ek", "El", "Em",
- "En", "Eo", "Er", "Es", "Ev", "Ex",
- "Fa", "Fc", "Fd", "Fl", "Fn", "Fo", "Fr", "Ft", "Fx",
- "Hf", "Ic", "In", "It", "Lb", "Li", "Lk", "Lp",
- "Ms", "Mt", "Nd", "Nm", "No", "Ns", "Nx",
- "Oc", "Oo", "Op", "Os", "Ot", "Ox",
- "Pa", "Pc", "Pf", "Po", "Pp", "Pq",
- "Qc", "Ql", "Qo", "Qq", "Re", "Rs", "Rv",
- "Sc", "Sh", "Sm", "So", "Sq",
- "Ss", "St", "Sx", "Sy",
- "Ta", "Tn", "Ud", "Ux", "Va", "Vt", "Xc", "Xo", "Xr",
- "%A", "%B", "%C", "%D", "%I", "%J", "%N", "%O",
- "%P", "%Q", "%R", "%T", "%U", "%V",
- NULL
-};
-
-/* not currently implemented: BT DE DS ME MT PT SY TQ YS */
-const char *const __man_reserved[] = {
- "AT", "B", "BI", "BR", "DT",
- "EE", "EN", "EQ", "EX", "HP", "I", "IB", "IP", "IR",
- "LP", "OP", "P", "PD", "PP",
- "R", "RB", "RE", "RI", "RS", "SB", "SH", "SM", "SS",
- "TE", "TH", "TP", "TS", "T&", "UC", "UE", "UR",
- NULL
-};
-
/* Array of injected predefined strings. */
#define PREDEFS_MAX 38
static const struct predef predefs[PREDEFS_MAX] = {
@@ -1172,6 +1144,7 @@ roff_res(struct roff *r, struct buf *buf
int npos; /* position in numeric expression */
int arg_complete; /* argument not interrupted by eol */
int done; /* no more input available */
+ int deftype; /* type of definition to paste */
char term; /* character terminating the escape */
/* Search forward for comments. */
@@ -1369,8 +1342,10 @@ roff_res(struct roff *r, struct buf *buf
switch (stesc[1]) {
case '*':
- if (arg_complete)
- res = roff_getstrn(r, stnam, naml);
+ if (arg_complete) {
+ deftype = ROFFDEF_USER | ROFFDEF_PRE;
+ res = roff_getstrn(r, stnam, naml, &deftype);
+ }
break;
case 'B':
npos = 0;
@@ -1639,6 +1614,7 @@ roff_parse(struct roff *r, char *buf, in
char *cp;
const char *mac;
size_t maclen;
+ int deftype;
enum roff_tok t;
cp = buf + *pos;
@@ -1649,14 +1625,21 @@ roff_parse(struct roff *r, char *buf, in
mac = cp;
maclen = roff_getname(r, &cp, ln, ppos);
- t = (r->current_string = roff_getstrn(r, mac, maclen)) ?
- ROFF_USERDEF :
- (r->current_string = roff_getrenn(r, mac, maclen)) ?
- ROFF_RENAMED : roffhash_find(r->reqtab, mac, maclen);
-
+ deftype = ROFFDEF_USER | ROFFDEF_REN;
+ r->current_string = roff_getstrn(r, mac, maclen, &deftype);
+ switch (deftype) {
+ case ROFFDEF_USER:
+ t = ROFF_USERDEF;
+ break;
+ case ROFFDEF_REN:
+ t = ROFF_RENAMED;
+ break;
+ default:
+ t = roffhash_find(r->reqtab, mac, maclen);
+ break;
+ }
if (t != TOKEN_NONE)
*pos = cp - buf;
-
return t;
}
@@ -1748,9 +1731,10 @@ roff_ccond(struct roff *r, int ln, int p
static enum rofferr
roff_block(ROFF_ARGS)
{
- const char *name;
- char *iname, *cp;
- size_t namesz;
+ const char *name, *value;
+ char *call, *cp, *iname, *rname;
+ size_t csz, namesz, rsz;
+ int deftype;
/* Ignore groff compatibility mode for now. */
@@ -1778,7 +1762,9 @@ roff_block(ROFF_ARGS)
/* Resolve the macro name argument if it is indirect. */
if (namesz && (tok == ROFF_dei || tok == ROFF_ami)) {
- if ((name = roff_getstrn(r, iname, namesz)) == NULL) {
+ deftype = ROFFDEF_USER;
+ name = roff_getstrn(r, iname, namesz, &deftype);
+ if (name == NULL) {
mandoc_vmsg(MANDOCERR_STR_UNDEF,
r->parse, ln, (int)(iname - buf->buf),
"%.*s", (int)namesz, iname);
@@ -1805,6 +1791,33 @@ roff_block(ROFF_ARGS)
if (tok == ROFF_de || tok == ROFF_dei) {
roff_setstrn(&r->strtab, name, namesz, "", 0, 0);
roff_setstrn(&r->rentab, name, namesz, NULL, 0, 0);
+ } else if (tok == ROFF_am || tok == ROFF_ami) {
+ deftype = ROFFDEF_ANY;
+ value = roff_getstrn(r, iname, namesz, &deftype);
+ switch (deftype) { /* Before appending, ... */
+ case ROFFDEF_PRE: /* copy predefined to user-defined. */
+ roff_setstrn(&r->strtab, name, namesz,
+ value, strlen(value), 0);
+ break;
+ case ROFFDEF_REN: /* call original standard macro. */
+ csz = mandoc_asprintf(&call, ".%.*s \\$* \\\"\n",
+ (int)strlen(value), value);
+ roff_setstrn(&r->strtab, name, namesz, call, csz, 0);
+ roff_setstrn(&r->rentab, name, namesz, NULL, 0, 0);
+ free(call);
+ break;
+ case ROFFDEF_STD: /* rename and call standard macro. */
+ rsz = mandoc_asprintf(&rname, "__%s_renamed", name);
+ roff_setstrn(&r->rentab, rname, rsz, name, namesz, 0);
+ csz = mandoc_asprintf(&call, ".%.*s \\$* \\\"\n",
+ (int)rsz, rname);
+ roff_setstrn(&r->strtab, name, namesz, call, csz, 0);
+ free(call);
+ free(rname);
+ break;
+ default:
+ break;
+ }
}
if (*cp == '\0')
@@ -1818,7 +1831,9 @@ roff_block(ROFF_ARGS)
/* Resolve the end marker if it is indirect. */
if (namesz && (tok == ROFF_dei || tok == ROFF_ami)) {
- if ((name = roff_getstrn(r, iname, namesz)) == NULL) {
+ deftype = ROFFDEF_USER;
+ name = roff_getstrn(r, iname, namesz, &deftype);
+ if (name == NULL) {
mandoc_vmsg(MANDOCERR_STR_UNDEF,
r->parse, ln, (int)(iname - buf->buf),
"%.*s", (int)namesz, iname);
@@ -2090,7 +2105,7 @@ roff_evalcond(struct roff *r, int ln, ch
{
char *cp, *name;
size_t sz;
- int number, savepos, istrue, wanttrue;
+ int deftype, number, savepos, istrue, wanttrue;
if ('!' == v[*pos]) {
wanttrue = 0;
@@ -2118,9 +2133,15 @@ roff_evalcond(struct roff *r, int ln, ch
cp++;
name = cp;
sz = roff_getname(r, &cp, ln, cp - v);
- istrue = sz && (v[*pos] == 'r' ? roff_hasregn(r, name, sz) :
- (roff_getstrn(r, name, sz) != NULL ||
- roff_getrenn(r, name, sz) != NULL));
+ if (sz == 0)
+ istrue = 0;
+ else if (v[*pos] == 'r')
+ istrue = roff_hasregn(r, name, sz);
+ else {
+ deftype = ROFFDEF_ANY;
+ roff_getstrn(r, name, sz, &deftype);
+ istrue = !!deftype;
+ }
*pos = cp - v;
return istrue == wanttrue;
default:
@@ -2725,30 +2746,30 @@ roff_it(ROFF_ARGS)
static enum rofferr
roff_Dd(ROFF_ARGS)
{
- const char *const *cp;
-
- if ((r->options & (MPARSE_MDOC | MPARSE_QUICK)) == 0)
- for (cp = __mdoc_reserved; *cp; cp++)
- roff_setstr(r, *cp, NULL, 0);
-
- if (r->format == 0)
- r->format = MPARSE_MDOC;
-
- return ROFF_CONT;
-}
-
-static enum rofferr
-roff_TH(ROFF_ARGS)
-{
- const char *const *cp;
-
- if ((r->options & MPARSE_QUICK) == 0)
- for (cp = __man_reserved; *cp; cp++)
- roff_setstr(r, *cp, NULL, 0);
-
- if (r->format == 0)
- r->format = MPARSE_MAN;
+ int mask;
+ enum roff_tok t, te;
+ switch (tok) {
+ case ROFF_Dd:
+ tok = MDOC_Dd;
+ te = MDOC_MAX;
+ if (r->format == 0)
+ r->format = MPARSE_MDOC;
+ mask = MPARSE_MDOC | MPARSE_QUICK;
+ break;
+ case ROFF_TH:
+ tok = MAN_TH;
+ te = MAN_MAX;
+ if (r->format == 0)
+ r->format = MPARSE_MAN;
+ mask = MPARSE_QUICK;
+ break;
+ default:
+ abort();
+ }
+ if ((r->options & mask) == 0)
+ for (t = tok; t < te; t++)
+ roff_setstr(r, roff_name[t], NULL, 0);
return ROFF_CONT;
}
@@ -3003,7 +3024,8 @@ roff_als(ROFF_ARGS)
if (oldsz == 0)
return ROFF_IGN;
- valsz = mandoc_asprintf(&value, ".%.*s \\$*\n", (int)oldsz, oldn);
+ valsz = mandoc_asprintf(&value, ".%.*s \\$*\\\"\n",
+ (int)oldsz, oldn);
roff_setstrn(&r->strtab, newn, newsz, value, valsz, 0);
roff_setstrn(&r->rentab, newn, newsz, NULL, 0, 0);
free(value);
@@ -3136,6 +3158,7 @@ roff_rn(ROFF_ARGS)
const char *value;
char *oldn, *newn, *end;
size_t oldsz, newsz;
+ int deftype;
oldn = newn = buf->buf + pos;
if (*oldn == '\0')
@@ -3150,33 +3173,32 @@ roff_rn(ROFF_ARGS)
if (newsz == 0)
return ROFF_IGN;
- /*
- * Rename a user-defined macro bearing the old name,
- * overriding an existing renamed high-level macro
- * bearing the new name, if that exists.
- */
-
- if ((value = roff_getstrn(r, oldn, oldsz)) != NULL) {
+ deftype = ROFFDEF_ANY;
+ value = roff_getstrn(r, oldn, oldsz, &deftype);
+ switch (deftype) {
+ case ROFFDEF_USER:
roff_setstrn(&r->strtab, newn, newsz, value, strlen(value), 0);
roff_setstrn(&r->strtab, oldn, oldsz, NULL, 0, 0);
roff_setstrn(&r->rentab, newn, newsz, NULL, 0, 0);
- return ROFF_IGN;
- }
-
- /*
- * Rename a high-level macro bearing the old name,
- * either renaming it a second time if it was already
- * renamed before, or renaming it for the first time.
- * In both cases, override an existing user-defined
- * macro bearing the new name, if that exists.
- */
-
- if ((value = roff_getrenn(r, oldn, oldsz)) != NULL) {
+ break;
+ case ROFFDEF_PRE:
+ roff_setstrn(&r->strtab, newn, newsz, value, strlen(value), 0);
+ roff_setstrn(&r->rentab, newn, newsz, NULL, 0, 0);
+ break;
+ case ROFFDEF_REN:
roff_setstrn(&r->rentab, newn, newsz, value, strlen(value), 0);
roff_setstrn(&r->rentab, oldn, oldsz, NULL, 0, 0);
- } else
+ roff_setstrn(&r->strtab, newn, newsz, NULL, 0, 0);
+ break;
+ case ROFFDEF_STD:
roff_setstrn(&r->rentab, newn, newsz, oldn, oldsz, 0);
- roff_setstrn(&r->strtab, newn, newsz, NULL, 0, 0);
+ roff_setstrn(&r->strtab, newn, newsz, NULL, 0, 0);
+ break;
+ default:
+ roff_setstrn(&r->strtab, newn, newsz, NULL, 0, 0);
+ roff_setstrn(&r->rentab, newn, newsz, NULL, 0, 0);
+ break;
+ }
return ROFF_IGN;
}
@@ -3363,8 +3385,8 @@ roff_renamed(ROFF_ARGS)
{
char *nbuf;
- buf->sz = mandoc_asprintf(&nbuf, ".%s %s", r->current_string,
- buf->buf + pos) + 1;
+ buf->sz = mandoc_asprintf(&nbuf, ".%s%s%s", r->current_string,
+ buf->buf[pos] == '\0' ? "" : " ", buf->buf + pos) + 1;
free(buf->buf);
buf->buf = nbuf;
return ROFF_CONT;
@@ -3419,9 +3441,12 @@ static void
roff_setstr(struct roff *r, const char *name, const char *string,
int append)
{
+ size_t namesz;
- roff_setstrn(&r->strtab, name, strlen(name), string,
+ namesz = strlen(name);
+ roff_setstrn(&r->strtab, name, namesz, string,
string ? strlen(string) : 0, append);
+ roff_setstrn(&r->rentab, name, namesz, NULL, 0, 0);
}
static void
@@ -3497,38 +3522,63 @@ roff_setstrn(struct roffkv **r, const ch
}
static const char *
-roff_getstrn(const struct roff *r, const char *name, size_t len)
+roff_getstrn(const struct roff *r, const char *name, size_t len,
+ int *deftype)
{
- const struct roffkv *n;
- int i;
-
- for (n = r->strtab; n; n = n->next)
- if (0 == strncmp(name, n->key.p, len) &&
- '\0' == n->key.p[(int)len])
- return n->val.p;
-
- for (i = 0; i < PREDEFS_MAX; i++)
- if (0 == strncmp(name, predefs[i].name, len) &&
- '\0' == predefs[i].name[(int)len])
- return predefs[i].str;
-
- return NULL;
-}
-
-/*
- * Check whether *name is the renamed name of a high-level macro.
- * Return the standard name, or NULL if it is not.
- */
-static const char *
-roff_getrenn(const struct roff *r, const char *name, size_t len)
-{
- const struct roffkv *n;
-
- for (n = r->rentab; n; n = n->next)
- if (0 == strncmp(name, n->key.p, len) &&
- '\0' == n->key.p[(int)len])
- return n->val.p;
-
+ const struct roffkv *n;
+ int i;
+ enum roff_tok tok;
+
+ if (*deftype & ROFFDEF_USER) {
+ for (n = r->strtab; n != NULL; n = n->next) {
+ if (strncmp(name, n->key.p, len) == 0 &&
+ n->key.p[len] == '\0' &&
+ n->val.p != NULL) {
+ *deftype = ROFFDEF_USER;
+ return n->val.p;
+ }
+ }
+ }
+ if (*deftype & ROFFDEF_PRE) {
+ for (i = 0; i < PREDEFS_MAX; i++) {
+ if (strncmp(name, predefs[i].name, len) == 0 &&
+ predefs[i].name[len] == '\0') {
+ *deftype = ROFFDEF_PRE;
+ return predefs[i].str;
+ }
+ }
+ }
+ if (*deftype & ROFFDEF_REN) {
+ for (n = r->rentab; n != NULL; n = n->next) {
+ if (strncmp(name, n->key.p, len) == 0 &&
+ n->key.p[len] == '\0' &&
+ n->val.p != NULL) {
+ *deftype = ROFFDEF_REN;
+ return n->val.p;
+ }
+ }
+ }
+ if (*deftype & ROFFDEF_STD) {
+ if (r->man->macroset != MACROSET_MAN) {
+ for (tok = MDOC_Dd; tok < MDOC_MAX; tok++) {
+ if (strncmp(name, roff_name[tok], len) == 0 &&
+ roff_name[tok][len] == '\0') {
+ *deftype = ROFFDEF_STD;
+ return NULL;
+ }
+ }
+ }
+ if (r->man->macroset != MACROSET_MDOC) {
+ for (tok = MAN_TH; tok < MAN_MAX; tok++) {
+ if (strncmp(name, roff_name[tok], len) == 0 &&
+ roff_name[tok][len] == '\0') {
+ *deftype = ROFFDEF_STD;
+ return NULL;
+ }
+ }
+ }
+ }
+ *deftype = 0;
return NULL;
}
Index: Makefile
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/roff/Makefile,v
retrieving revision 1.4
retrieving revision 1.5
diff -Lregress/roff/Makefile -Lregress/roff/Makefile -u -p -r1.4 -r1.5
--- regress/roff/Makefile
+++ regress/roff/Makefile
@@ -1,7 +1,7 @@
# $OpenBSD: Makefile,v 1.20 2015/02/06 16:05:51 schwarze Exp $
SUBDIR = args cond esc scale string
-SUBDIR += br cc de ds ft ig it ll na nr po ps rm sp ta ti tr
+SUBDIR += br cc de ds ft ig it ll na nr po ps rm rn sp ta ti tr
.include "../Makefile.sub"
.include <bsd.subdir.mk>
Index: append.in
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/roff/de/append.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/roff/de/append.in -Lregress/roff/de/append.in -u -p -r1.1 -r1.2
--- regress/roff/de/append.in
+++ regress/roff/de/append.in
@@ -1,4 +1,4 @@
-.Dd July 7, 2014
+.Dd June 18, 2017
.Dt DE-APPEND 1
.Os OpenBSD
.Sh NAME
@@ -23,3 +23,14 @@ ami:
.mye
.mym
end
+.Pp
+standard macro:
+.Bo in brackets
+.Bc end
+.Pp
+append to standard macro:
+.am Bc
+.Pq appended words
+..
+.Bo in brackets
+.Bc end
Index: append.out_ascii
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/roff/de/append.out_ascii,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/roff/de/append.out_ascii -Lregress/roff/de/append.out_ascii -u -p -r1.1 -r1.2
--- regress/roff/de/append.out_ascii
+++ regress/roff/de/append.out_ascii
@@ -6,4 +6,8 @@ N\bNA\bAM\bME\bE
D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
de: OpenBSD am: OpenBSD NetBSD ami: OpenBSD NetBSD FreeBSD end
-OpenBSD July 7, 2014 OpenBSD
+ standard macro: [in brackets] end
+
+ append to standard macro: [in brackets] end (appended words)
+
+OpenBSD June 18, 2017 OpenBSD
--- /dev/null
+++ regress/roff/string/std.out_lint
@@ -0,0 +1,3 @@
+mandoc: std.in:6:4: WARNING: undefined string, using "": DT
+mandoc: std.in:10:4: WARNING: undefined string, using "": myname
+mandoc: std.in: STYLE: RCS id missing
--- /dev/null
+++ regress/roff/string/std.out_ascii
@@ -0,0 +1,15 @@
+STRING-STD(1) General Commands Manual STRING-STD(1)
+
+
+
+N\bNA\bAM\bME\bE
+ string-std - expanding standard macros as strings
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+ expanding the DT macro as a string: >>><<<
+
+ the same after renaming it: >>><<<
+
+
+
+OpenBSD June 18, 2017 STRING-STD(1)
Index: Makefile
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/roff/string/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/roff/string/Makefile -Lregress/roff/string/Makefile -u -p -r1.1 -r1.2
--- regress/roff/string/Makefile
+++ regress/roff/string/Makefile
@@ -1,11 +1,15 @@
# $OpenBSD: Makefile,v 1.6 2014/07/06 19:08:57 schwarze Exp $
-REGRESS_TARGETS=escape infinite zerolength name
-LINT_TARGETS = name
+REGRESS_TARGETS = escape infinite name std zerolength
+LINT_TARGETS = name std
# The infinite test fails badly with groff-1.20.1:
# It fails to print the following text.
-SKIP_GROFF ?= infinite
+SKIP_GROFF ?= infinite
+
+# Groff can expand standard macros as strings, but mandoc cannot.
+
+SKIP_GROFF += std
.include <bsd.regress.mk>
--- /dev/null
+++ regress/roff/string/std.in
@@ -0,0 +1,10 @@
+.TH STRING-STD 1 "June 18, 2017" OpenBSD
+.SH NAME
+string-std - expanding standard macros as strings
+.SH DESCRIPTION
+expanding the DT macro as a string:
+>>>\*[DT]<<<
+.PP
+.rn DT myname
+the same after renaming it:
+>>>\*[myname]<<<
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-06-18 17:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-18 17:36 mdocml: Implement appending to standard man(7) and mdoc(7) macros with 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).