* mdocml: Let .Ao and .Aq render as "<>" after .An and as "\(la\(ra"
@ 2014-11-19 22:00 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-11-19 22:00 UTC (permalink / raw)
To: source
Log Message:
-----------
Let .Ao and .Aq render as "<>" after .An and as "\(la\(ra" elsewhere,
just like groff; minibug noticed by bentley@.
Modified Files:
--------------
mdocml:
mdoc_html.c
mdoc_man.c
mdoc_term.c
Revision Data
-------------
Index: mdoc_man.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_man.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -Lmdoc_man.c -Lmdoc_man.c -u -p -r1.73 -r1.74
--- mdoc_man.c
+++ mdoc_man.c
@@ -46,6 +46,7 @@ static void font_push(char);
static void font_pop(void);
static void mid_it(void);
static void post__t(DECL_ARGS);
+static void post_aq(DECL_ARGS);
static void post_bd(DECL_ARGS);
static void post_bf(DECL_ARGS);
static void post_bk(DECL_ARGS);
@@ -72,6 +73,7 @@ static void post_vt(DECL_ARGS);
static int pre__t(DECL_ARGS);
static int pre_an(DECL_ARGS);
static int pre_ap(DECL_ARGS);
+static int pre_aq(DECL_ARGS);
static int pre_bd(DECL_ARGS);
static int pre_bf(DECL_ARGS);
static int pre_bk(DECL_ARGS);
@@ -172,8 +174,8 @@ static const struct manact manacts[MDOC_
{ NULL, pre__t, post__t, NULL, NULL }, /* %T */
{ NULL, NULL, post_percent, NULL, NULL }, /* %V */
{ NULL, NULL, NULL, NULL, NULL }, /* Ac */
- { cond_body, pre_enc, post_enc, "<", ">" }, /* Ao */
- { cond_body, pre_enc, post_enc, "<", ">" }, /* Aq */
+ { cond_body, pre_aq, post_aq, NULL, NULL }, /* Ao */
+ { cond_body, pre_aq, post_aq, NULL, NULL }, /* Aq */
{ NULL, NULL, NULL, NULL, NULL }, /* At */
{ NULL, NULL, NULL, NULL, NULL }, /* Bc */
{ NULL, pre_bf, post_bf, NULL, NULL }, /* Bf */
@@ -867,6 +869,25 @@ pre_ap(DECL_ARGS)
print_word("'");
outflags &= ~MMAN_spc;
return(0);
+}
+
+static int
+pre_aq(DECL_ARGS)
+{
+
+ print_word(n->parent->prev != NULL &&
+ n->parent->prev->tok == MDOC_An ? "<" : "\\(la");
+ outflags &= ~MMAN_spc;
+ return(1);
+}
+
+static void
+post_aq(DECL_ARGS)
+{
+
+ outflags &= ~(MMAN_spc | MMAN_nl);
+ print_word(n->parent->prev != NULL &&
+ n->parent->prev->tok == MDOC_An ? ">" : "\\(ra");
}
static int
Index: mdoc_html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_html.c,v
retrieving revision 1.210
retrieving revision 1.211
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.210 -r1.211
--- mdoc_html.c
+++ mdoc_html.c
@@ -2075,7 +2075,8 @@ mdoc_quote_pre(MDOC_ARGS)
case MDOC_Ao:
/* FALLTHROUGH */
case MDOC_Aq:
- print_text(h, "\\(la");
+ print_text(h, n->parent->prev != NULL &&
+ n->parent->prev->tok == MDOC_An ? "<" : "\\(la");
break;
case MDOC_Bro:
/* FALLTHROUGH */
@@ -2151,7 +2152,8 @@ mdoc_quote_post(MDOC_ARGS)
case MDOC_Ao:
/* FALLTHROUGH */
case MDOC_Aq:
- print_text(h, "\\(ra");
+ print_text(h, n->parent->prev != NULL &&
+ n->parent->prev->tok == MDOC_An ? ">" : "\\(ra");
break;
case MDOC_Bro:
/* FALLTHROUGH */
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.290
retrieving revision 1.291
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.290 -r1.291
--- mdoc_term.c
+++ mdoc_term.c
@@ -1854,7 +1854,8 @@ termp_quote_pre(DECL_ARGS)
case MDOC_Ao:
/* FALLTHROUGH */
case MDOC_Aq:
- term_word(p, "<");
+ term_word(p, n->parent->prev != NULL &&
+ n->parent->prev->tok == MDOC_An ? "<" : "\\(la");
break;
case MDOC_Bro:
/* FALLTHROUGH */
@@ -1925,7 +1926,8 @@ termp_quote_post(DECL_ARGS)
case MDOC_Ao:
/* FALLTHROUGH */
case MDOC_Aq:
- term_word(p, ">");
+ term_word(p, n->parent->prev != NULL &&
+ n->parent->prev->tok == MDOC_An ? ">" : "\\(ra");
break;
case MDOC_Bro:
/* FALLTHROUGH */
--
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:[~2014-11-19 22:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-19 22:00 mdocml: Let .Ao and .Aq render as "<>" after .An and as "\(la\(ra" 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).