[BACK]Return to html.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/html.c between version 1.264 and 1.265

version 1.264, 2020/03/13 15:32:28 version 1.265, 2020/04/06 10:16:17
Line 362  html_make_id(const struct roff_node *n, int unique)
Line 362  html_make_id(const struct roff_node *n, int unique)
                                 return NULL;                                  return NULL;
                         break;                          break;
                 default:                  default:
                         if (n->child->type != ROFFT_TEXT)                          if (n->child == NULL || n->child->type != ROFFT_TEXT)
                                 return NULL;                                  return NULL;
                         buf = mandoc_strdup(n->child->string);                          buf = mandoc_strdup(n->child->string);
                         break;                          break;
Line 769  print_otag(struct html *h, enum htmltag tag, const cha
Line 769  print_otag(struct html *h, enum htmltag tag, const cha
   
 /*  /*
  * Print an element with an optional "id=" attribute.   * Print an element with an optional "id=" attribute.
  * If there is an "id=" attribute, also add a permalink:   * If the element has phrasing content and an "id=" attribute,
  * outside if it's a phrasing element, or inside otherwise.   * also add a permalink: outside if it can be in phrasing context,
    * inside otherwise.
  */   */
 struct tag *  struct tag *
 print_otag_id(struct html *h, enum htmltag elemtype, const char *cattr,  print_otag_id(struct html *h, enum htmltag elemtype, const char *cattr,
     struct roff_node *n)      struct roff_node *n)
 {  {
           struct roff_node *nch;
         struct tag      *ret, *t;          struct tag      *ret, *t;
         const char      *id;          const char      *id;
   
Line 788  print_otag_id(struct html *h, enum htmltag elemtype, c
Line 790  print_otag_id(struct html *h, enum htmltag elemtype, c
         t = print_otag(h, elemtype, "ci", cattr, id);          t = print_otag(h, elemtype, "ci", cattr, id);
         if (ret == NULL) {          if (ret == NULL) {
                 ret = t;                  ret = t;
                 if (id != NULL)                  if (id != NULL && (nch = n->child) != NULL) {
                         print_otag(h, TAG_A, "chR", "permalink", id);                          /* man(7) is safe, it tags phrasing content only. */
                           if (n->tok > MDOC_MAX ||
                               htmltags[elemtype].flags & HTML_TOPHRASE)
                                   nch = NULL;
                           else  /* For mdoc(7), beware of nested blocks. */
                                   while (nch != NULL && nch->type == ROFFT_TEXT)
                                           nch = nch->next;
                           if (nch == NULL)
                                   print_otag(h, TAG_A, "chR", "permalink", id);
                   }
         }          }
         return ret;          return ret;
 }  }

Legend:
Removed from v.1.264  
changed lines
  Added in v.1.265

CVSweb