diff options
author | 2010-07-01 22:35:54 +0000 | |
---|---|---|
committer | 2010-07-01 22:35:54 +0000 | |
commit | e552a5cef0219ea63fb9521677e1a8a05ad35727 (patch) | |
tree | 4a4e069b6b57e03c5805f88f307dae15e95a65ad /mdoc_action.c | |
parent | 9c216164abd606b0097a7d91e8e0026c721fa54d (diff) | |
download | mandoc-e552a5cef0219ea63fb9521677e1a8a05ad35727.tar.gz mandoc-e552a5cef0219ea63fb9521677e1a8a05ad35727.tar.zst mandoc-e552a5cef0219ea63fb9521677e1a8a05ad35727.zip |
In the mdoc(7) parser, inspect roff registers early such that all parts
of the parser can use the resulting cues. In particular, this allows
to use .nr nS to force SYNOPSIS-style .Nm indentation outside the
SYNOPSIS as needed by ifconfig(8).
To actually make this useable, .Pp must rewind .Nm, or the rest of the
section would end up indented. Implement a quick hack for now,
a generic solution can be designed later.
ok kristaps@ and tested by sobrado@
Diffstat (limited to 'mdoc_action.c')
-rw-r--r-- | mdoc_action.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/mdoc_action.c b/mdoc_action.c index d01d665b..e4eed904 100644 --- a/mdoc_action.c +++ b/mdoc_action.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_action.c,v 1.72 2010/06/27 15:52:41 kristaps Exp $ */ +/* $Id: mdoc_action.c,v 1.73 2010/07/01 22:35:54 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -457,6 +457,17 @@ post_sh(POST_ARGS) if (SEC_NONE == m->lastnamed || SEC_CUSTOM != sec) m->lastnamed = sec; + /* + * Switch the parser's SYNOPSIS mode, to be copied + * into individual nodes when creating them. + * Note that this mode can also be set and unset + * using the roff nS register. + */ + if (SEC_SYNOPSIS == sec) + m->flags |= MDOC_SYNOPSIS; + else + m->flags &= ~MDOC_SYNOPSIS; + /* Some sections only live in certain manual sections. */ switch ((m->lastsec = sec)) { |