]> git.cameronkatri.com Git - mandoc.git/blobdiff - mdoc_man.c
Fix two minibugs reported by Thomas Klausner <wiz at NetBSD>:
[mandoc.git] / mdoc_man.c
index e0fbeeb4064e737924675a65f083080ab9e3eedf..75b68e62d6dec171e98e2b0ff5056424c25f7e03 100644 (file)
@@ -1,4 +1,4 @@
-/*     $Id: mdoc_man.c,v 1.72 2014/11/06 22:28:36 schwarze Exp $ */
+/*     $Id: mdoc_man.c,v 1.74 2014/11/19 22:00:37 schwarze Exp $ */
 /*
  * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
  *
@@ -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_MAX + 1] = {
        { 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 */
@@ -594,7 +596,11 @@ print_node(DECL_ARGS)
                        printf("\\&");
                        outflags &= ~MMAN_spc;
                }
+               if (outflags & MMAN_Sm && ! (n->flags & MDOC_DELIMC))
+                       outflags |= MMAN_spc_force;
                print_word(n->string);
+               if (outflags & MMAN_Sm && ! (n->flags & MDOC_DELIMO))
+                       outflags |= MMAN_spc;
        } else {
                /*
                 * Conditionally run the pre-node action handler for a
@@ -865,6 +871,25 @@ pre_ap(DECL_ARGS)
        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
 pre_bd(DECL_ARGS)
 {