version 1.265, 2020/04/06 10:16:17 |
version 1.267, 2020/04/08 11:56:03 |
Line 344 html_make_id(const struct roff_node *n, int unique) |
|
Line 344 html_make_id(const struct roff_node *n, int unique) |
|
unsigned int slot; |
unsigned int slot; |
int suffix; |
int suffix; |
|
|
if (n->string != NULL) |
if (n->tag != NULL) |
buf = mandoc_strdup(n->string); |
buf = mandoc_strdup(n->tag); |
else { |
else { |
switch (n->tok) { |
switch (n->tok) { |
case MDOC_Sh: |
case MDOC_Sh: |
Line 779 print_otag_id(struct html *h, enum htmltag elemtype, c |
|
Line 779 print_otag_id(struct html *h, enum htmltag elemtype, c |
|
{ |
{ |
struct roff_node *nch; |
struct roff_node *nch; |
struct tag *ret, *t; |
struct tag *ret, *t; |
const char *id; |
char *id, *href; |
|
|
ret = NULL; |
ret = NULL; |
id = NULL; |
id = href = NULL; |
if (n->flags & NODE_ID) |
if (n->flags & NODE_ID) |
id = html_make_id(n, 1); |
id = html_make_id(n, 1); |
if (id != NULL && htmltags[elemtype].flags & HTML_INPHRASE) |
if (n->flags & NODE_HREF) |
ret = print_otag(h, TAG_A, "chR", "permalink", id); |
href = id == NULL ? html_make_id(n, 0) : id; |
|
if (href != NULL && htmltags[elemtype].flags & HTML_INPHRASE) |
|
ret = print_otag(h, TAG_A, "chR", "permalink", href); |
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 && (nch = n->child) != NULL) { |
if (href != NULL && (nch = n->child) != NULL) { |
/* man(7) is safe, it tags phrasing content only. */ |
/* man(7) is safe, it tags phrasing content only. */ |
if (n->tok > MDOC_MAX || |
if (n->tok > MDOC_MAX || |
htmltags[elemtype].flags & HTML_TOPHRASE) |
htmltags[elemtype].flags & HTML_TOPHRASE) |
Line 799 print_otag_id(struct html *h, enum htmltag elemtype, c |
|
Line 801 print_otag_id(struct html *h, enum htmltag elemtype, c |
|
while (nch != NULL && nch->type == ROFFT_TEXT) |
while (nch != NULL && nch->type == ROFFT_TEXT) |
nch = nch->next; |
nch = nch->next; |
if (nch == NULL) |
if (nch == NULL) |
print_otag(h, TAG_A, "chR", "permalink", id); |
print_otag(h, TAG_A, "chR", "permalink", href); |
} |
} |
} |
} |
|
if (id == NULL) |
|
free(href); |
return ret; |
return ret; |
} |
} |
|
|