version 1.343, 2022/06/24 11:15:53 |
version 1.344, 2022/06/25 12:44:25 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2014-2021 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2014-2022 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> |
|
* Copyright (c) 2022 Anna Vyalkova <cyber@sysrq.in> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
* purpose with or without fee is hereby granted, provided that the above |
* purpose with or without fee is hereby granted, provided that the above |
Line 665 mdoc_nm_pre(MDOC_ARGS) |
|
Line 666 mdoc_nm_pre(MDOC_ARGS) |
|
static int |
static int |
mdoc_xr_pre(MDOC_ARGS) |
mdoc_xr_pre(MDOC_ARGS) |
{ |
{ |
if (NULL == n->child) |
char *name, *section, *label; |
|
|
|
if (n->child == NULL) |
return 0; |
return 0; |
|
|
|
name = n->child->string; |
|
if (n->child->next != NULL) { |
|
section = n->child->next->string; |
|
mandoc_asprintf(&label, "%s, section %s", name, section); |
|
} else |
|
section = label = NULL; |
|
|
if (h->base_man1) |
if (h->base_man1) |
print_otag(h, TAG_A, "chM", "Xr", |
print_otag(h, TAG_A, "chM?", "Xr", |
n->child->string, n->child->next == NULL ? |
name, section, "aria-label", label); |
NULL : n->child->next->string); |
|
else |
else |
print_otag(h, TAG_A, "c", "Xr"); |
print_otag(h, TAG_A, "c?", "Xr", "aria-label", label); |
|
|
n = n->child; |
free(label); |
print_text(h, n->string); |
print_text(h, name); |
|
|
if (NULL == (n = n->next)) |
if (section == NULL) |
return 0; |
return 0; |
|
|
h->flags |= HTML_NOSPACE; |
h->flags |= HTML_NOSPACE; |
print_text(h, "("); |
print_text(h, "("); |
h->flags |= HTML_NOSPACE; |
h->flags |= HTML_NOSPACE; |
print_text(h, n->string); |
print_text(h, section); |
h->flags |= HTML_NOSPACE; |
h->flags |= HTML_NOSPACE; |
print_text(h, ")"); |
print_text(h, ")"); |
return 0; |
return 0; |