[pmg-devel] [PATCH v3 pmg-docs 1/3] asciidoc-pmg: ignore link targets for non-manpages

Mira Limbeck m.limbeck at proxmox.com
Thu Jun 4 11:28:24 CEST 2020


(This is taken from pve-docs commit
7de8bba68de1875aca04ebd1cd941a2992c24753)

To allow linking from to a chapter/section not included in a manpage
allow the manpage link resolver to just return text in a case the
link target text is in fact no manpage.

If the link is a valid one in general will be checked in a lot of
other places, so here we won't run into a regression where a wrong,
non-existing, link does not get detected by the build system.

Signed-off-by: Mira Limbeck <m.limbeck at proxmox.com>
---
As the patch is taken from pve-docs should there be any additional tags
or info?

 asciidoc-pmg.in | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/asciidoc-pmg.in b/asciidoc-pmg.in
index ec4bb2a..74899e8 100644
--- a/asciidoc-pmg.in
+++ b/asciidoc-pmg.in
@@ -146,7 +146,11 @@ sub replace_man_xref {
     die "xref: no text for man page link '$blockid'\n" if !$text;
 
     my $section = $fileinfo->{mansection}->{manvolnum}->{$link};
-    die "link target is not a manual page" if !defined($section);
+    # die "link target is not a manual page" if !defined($section);
+    if (!defined($section)) {
+	warn "link '$blockid' target '$link' is not a manual page, ignoring\n";
+	return "$text";
+    }
 
 
     if ($man_target eq 'html') {
-- 
2.20.1




More information about the pmg-devel mailing list