From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (schwarze@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.5/8.14.5) with ESMTP id s62JtA61019759 for ; Wed, 2 Jul 2014 15:55:10 -0400 (EDT) Received: (from schwarze@localhost) by krisdoz.my.domain (8.14.5/8.14.3/Submit) id s62JtA76002974; Wed, 2 Jul 2014 15:55:10 -0400 (EDT) Date: Wed, 2 Jul 2014 15:55:10 -0400 (EDT) Message-Id: <201407021955.s62JtA76002974@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: When .Sm is called without an argument, groff toggles the X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- When .Sm is called without an argument, groff toggles the spacing mode, so let us do the same for compatibility. Using this feature is of course not recommended except in manual page obfuscation contests. Modified Files: -------------- mdocml: mdoc_html.c mdoc_man.c mdoc_term.c mdoc_validate.c Revision Data ------------- Index: mdoc_man.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_man.c,v retrieving revision 1.64 retrieving revision 1.65 diff -Lmdoc_man.c -Lmdoc_man.c -u -p -r1.64 -r1.65 --- mdoc_man.c +++ mdoc_man.c @@ -1565,11 +1565,16 @@ static int pre_sm(DECL_ARGS) { - assert(n->child && MDOC_TEXT == n->child->type); - if (0 == strcmp("on", n->child->string)) - outflags |= MMAN_Sm | MMAN_spc; + if (NULL == n->child) + outflags ^= MMAN_Sm; + else if (0 == strcmp("on", n->child->string)) + outflags |= MMAN_Sm; else outflags &= ~MMAN_Sm; + + if (MMAN_Sm & outflags) + outflags |= MMAN_spc; + return(0); } Index: mdoc_validate.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_validate.c,v retrieving revision 1.221 retrieving revision 1.222 diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.221 -r1.222 --- mdoc_validate.c +++ mdoc_validate.c @@ -1668,11 +1668,12 @@ ebool(struct mdoc *mdoc) { if (NULL == mdoc->last->child) { - mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_MACROEMPTY); - mdoc_node_delete(mdoc, mdoc->last); + if (MDOC_Sm == mdoc->last->tok) + mdoc->flags ^= MDOC_SMOFF; return(1); } - check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_EQ, 1); + + check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_LT, 2); assert(MDOC_TEXT == mdoc->last->child->type); Index: mdoc_html.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_html.c,v retrieving revision 1.191 retrieving revision 1.192 diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.191 -r1.192 --- mdoc_html.c +++ mdoc_html.c @@ -1524,22 +1524,15 @@ static int mdoc_sm_pre(MDOC_ARGS) { - assert(n->child && MDOC_TEXT == n->child->type); - if (0 == strcmp("on", n->child->string)) { - /* - * FIXME: no p->col to check. Thus, if we have - * .Bd -literal - * .Sm off - * 1 2 - * .Sm on - * 3 - * .Ed - * the "3" is preceded by a space. - */ - h->flags &= ~HTML_NOSPACE; + if (NULL == n->child) + h->flags ^= HTML_NONOSPACE; + else if (0 == strcmp("on", n->child->string)) h->flags &= ~HTML_NONOSPACE; - } else + else h->flags |= HTML_NONOSPACE; + + if ( ! (HTML_NONOSPACE & h->flags)) + h->flags &= ~HTML_NOSPACE; return(0); } Index: mdoc_term.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v retrieving revision 1.268 retrieving revision 1.269 diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.268 -r1.269 --- mdoc_term.c +++ mdoc_term.c @@ -2056,13 +2056,15 @@ static int termp_sm_pre(DECL_ARGS) { - assert(n->child && MDOC_TEXT == n->child->type); - if (0 == strcmp("on", n->child->string)) { - if (p->col) - p->flags &= ~TERMP_NOSPACE; + if (NULL == n->child) + p->flags ^= TERMP_NONOSPACE; + else if (0 == strcmp("on", n->child->string)) p->flags &= ~TERMP_NONOSPACE; - } else + else p->flags |= TERMP_NONOSPACE; + + if (p->col && ! (TERMP_NONOSPACE & p->flags)) + p->flags &= ~TERMP_NOSPACE; return(0); } -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv