From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id 0de714ee for ; Wed, 24 Oct 2018 20:33:11 -0500 (EST) Date: Wed, 24 Oct 2018 20:33:11 -0500 (EST) X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: mandoc: Implement the \f(CW and \f(CR (constant width font) escape X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-Id: <381c717f5ca0d3d5@fantadrom.bsd.lv> Log Message: ----------- Implement the \f(CW and \f(CR (constant width font) escape sequences for HTML output. Somewhat relevant because pod2man(1) relies on this. Missing feature reported by Pali dot Rohar at gmail dot com. Note that constant width font was already correctly selected before this when required by semantic markup. Only attempting physical markup with the low-level escape sequence was ineffective. Modified Files: -------------- mandoc: html.c html.h mandoc.c mandoc.h mdoc_markdown.c roff.c term.c Revision Data ------------- Index: term.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/term.c,v retrieving revision 1.275 retrieving revision 1.276 diff -Lterm.c -Lterm.c -u -p -r1.275 -r1.276 --- term.c +++ term.c @@ -510,6 +510,7 @@ term_word(struct termp *p, const char *w term_fontrepl(p, TERMFONT_BI); continue; case ESCAPE_FONT: + case ESCAPE_FONTCW: case ESCAPE_FONTROMAN: term_fontrepl(p, TERMFONT_NONE); continue; Index: mandoc.h =================================================================== RCS file: /home/cvs/mandoc/mandoc/mandoc.h,v retrieving revision 1.253 retrieving revision 1.254 diff -Lmandoc.h -Lmandoc.h -u -p -r1.253 -r1.254 --- mandoc.h +++ mandoc.h @@ -438,6 +438,7 @@ enum mandoc_esc { ESCAPE_FONTITALIC, /* italic font mode */ ESCAPE_FONTBI, /* bold italic font mode */ ESCAPE_FONTROMAN, /* roman font mode */ + ESCAPE_FONTCW, /* constant width font mode */ ESCAPE_FONTPREV, /* previous font mode */ ESCAPE_NUMBERED, /* a numbered glyph */ ESCAPE_UNICODE, /* a unicode codepoint */ Index: mdoc_markdown.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/mdoc_markdown.c,v retrieving revision 1.26 retrieving revision 1.27 diff -Lmdoc_markdown.c -Lmdoc_markdown.c -u -p -r1.26 -r1.27 --- mdoc_markdown.c +++ mdoc_markdown.c @@ -600,6 +600,7 @@ md_word(const char *s) nextfont = "***"; break; case ESCAPE_FONT: + case ESCAPE_FONTCW: case ESCAPE_FONTROMAN: nextfont = ""; break; Index: html.h =================================================================== RCS file: /home/cvs/mandoc/mandoc/html.h,v retrieving revision 1.94 retrieving revision 1.95 diff -Lhtml.h -Lhtml.h -u -p -r1.94 -r1.95 --- html.h +++ html.h @@ -72,6 +72,7 @@ enum htmlfont { HTMLFONT_BOLD, HTMLFONT_ITALIC, HTMLFONT_BI, + HTMLFONT_CW, HTMLFONT_MAX }; Index: mandoc.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/mandoc.c,v retrieving revision 1.107 retrieving revision 1.108 diff -Lmandoc.c -Lmandoc.c -u -p -r1.107 -r1.108 --- mandoc.c +++ mandoc.c @@ -304,8 +304,13 @@ mandoc_escape(const char **end, const ch case ESCAPE_FONT: if (*sz == 2) { if (**start == 'C') { + if ((*start)[1] == 'W' || + (*start)[1] == 'R') { + gly = ESCAPE_FONTCW; + break; + } /* - * Treat constant-width font modes + * Treat other constant-width font modes * just like regular font modes. */ (*start)++; Index: roff.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/roff.c,v retrieving revision 1.341 retrieving revision 1.342 diff -Lroff.c -Lroff.c -u -p -r1.341 -r1.342 --- roff.c +++ roff.c @@ -3361,6 +3361,7 @@ roff_char(ROFF_ARGS) case ESCAPE_FONTITALIC: case ESCAPE_FONTBOLD: case ESCAPE_FONTBI: + case ESCAPE_FONTCW: case ESCAPE_FONTPREV: font++; break; Index: html.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/html.c,v retrieving revision 1.241 retrieving revision 1.242 diff -Lhtml.c -Lhtml.c -u -p -r1.241 -r1.242 --- html.c +++ html.c @@ -228,6 +228,9 @@ print_metaf(struct html *h, enum mandoc_ case ESCAPE_FONTBI: font = HTMLFONT_BI; break; + case ESCAPE_FONTCW: + font = HTMLFONT_CW; + break; case ESCAPE_FONT: case ESCAPE_FONTROMAN: font = HTMLFONT_NONE; @@ -255,6 +258,9 @@ print_metaf(struct html *h, enum mandoc_ h->metaf = print_otag(h, TAG_B, ""); print_otag(h, TAG_I, ""); break; + case HTMLFONT_CW: + h->metaf = print_otag(h, TAG_SPAN, "c", "Li"); + break; default: break; } @@ -408,6 +414,7 @@ print_encode(struct html *h, const char case ESCAPE_FONTBOLD: case ESCAPE_FONTITALIC: case ESCAPE_FONTBI: + case ESCAPE_FONTCW: case ESCAPE_FONTROMAN: if (0 == norecurse) print_metaf(h, esc); @@ -737,6 +744,9 @@ print_text(struct html *h, const char *w case HTMLFONT_BI: h->metaf = print_otag(h, TAG_B, ""); print_otag(h, TAG_I, ""); + break; + case HTMLFONT_CW: + h->metaf = print_otag(h, TAG_SPAN, "c", "Li"); break; default: print_indent(h); -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv