]> git.proxmox.com Git - pve-docs.git/commitdiff
use asciidoc-pve whenever possible
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 12 Oct 2016 04:35:30 +0000 (06:35 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 12 Oct 2016 04:35:30 +0000 (06:35 +0200)
So that we have correct links.

Makefile
asciidoc-pve.in

index 61923a8ebf191a5fcfc1ca2acb057efc51125acf..fe758b7ef3a9001c8b31e204291c8136c3a2ec82 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -216,17 +216,17 @@ chapter-%.html: %.adoc asciidoc-pve ${PVE_COMMON_DOC_SOURCES}
 %.1.html: %.adoc %.1-synopsis.adoc asciidoc-pve ${PVE_COMMON_DOC_SOURCES}
        ./asciidoc-pve compile-man-html -o $@ $*.adoc
 
-pmxcfs.8.html: pmxcfs.adoc pmxcfs.8-cli.adoc ${PVE_COMMON_DOC_SOURCES}
-       asciidoc ${ADOC_MAN8_HTML_ARGS} -o $@ pmxcfs.adoc
+pmxcfs.8.html: pmxcfs.adoc pmxcfs.8-cli.adoc asciidoc-pve ${PVE_COMMON_DOC_SOURCES}
+       ./asciidoc-pve compile-man-html -o $@ pmxcfs.adoc
 
-%.8.html: %.adoc %.8-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
-       asciidoc ${ADOC_MAN8_HTML_ARGS} -o $@ $*.adoc
+%.8.html: %.adoc %.8-synopsis.adoc asciidoc-pve ${PVE_COMMON_DOC_SOURCES}
+       ./asciidoc-pve compile-man-html -o $@ $*.adoc
 
-%.5.html: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
-       asciidoc ${ADOC_MAN5_HTML_ARGS} -o $@ $*.adoc
+%.5.html: %.adoc %.5-opts.adoc asciidoc-pve ${PVE_COMMON_DOC_SOURCES}
+       ./asciidoc-pve compile-man-html -o $@ $*.adoc
 
-%.5-plain.html: %.adoc %.5-opts.adoc ${PVE_COMMON_DOC_SOURCES}
-       asciidoc -s ${ADOC_MAN5_HTML_ARGS} -o $@ $*.adoc
+%.5-plain.html: %.adoc %.5-opts.adoc asciidoc-pve ${PVE_COMMON_DOC_SOURCES}
+       ./asciidoc-pve compile-man-wiki -o $@ $*.adoc
 
 README.html: README.adoc
        asciidoc ${ADOC_STDARG} -o $@ $<
index 223908fc84c45deba89c059bbf68832287764d41..582267db3bbc9c8afb8b4b950add1312ac2b9ee5 100644 (file)
@@ -33,7 +33,7 @@ if (-f "attributes.txt" && -f "pve-admin-guide.adoc") {
 
 my $prepared_files = {};
 
-my $man_target_html = 0;
+my $man_target = 'man';
 my $env_stack = [];
 my $env_skip = 0;
 
@@ -133,15 +133,17 @@ sub replace_man_xref {
     die "link target is not a manual page" if !defined($section);
 
 
-    if (0 && $man_target_html) {
+    if ($man_target eq 'html') {
        my $target = $link;
        $target =~ s/\.adoc//;
        $target .= ".$section";
        return "link:${target}.html#${blockid}\[$text\]";
-    } else {
+    } elsif ($man_target eq 'man') {
        my $command = $link;
        $command =~ s/\.adoc//;
        return "\*${text}\* (man \*${command}\*($section))";
+    } else {
+       die "internal error"
     }
 }
 
@@ -151,7 +153,13 @@ sub replace_xref {
     if ($env eq 'wiki') {
        return replace_wiki_xref($blockid, $text);
     } elsif ($env eq 'manvolnum') {
-       return replace_man_xref($blockid, $text);
+       if (($man_target eq 'man') || ($man_target eq 'html')) {
+           return replace_man_xref($blockid, $text);
+       } elsif ($man_target eq 'wiki') {
+           return replace_wiki_xref($blockid, $text);
+       } else {
+           die "internal error"
+       }
     } elsif ($env eq 'default') {
        return replace_default_xref($blockid, $text);
     } else {
@@ -277,7 +285,7 @@ sub compile_asciidoc {
        $outfile = $infile;
        $outfile =~ s/\.adoc$//;
        if ($env eq 'manvolnum') {
-           if ($man_target_html) {
+           if (($man_target eq 'html') || ($man_target eq 'wiki')) {
                $outfile .= ".$mansection.html";
            } else {
                $outfile .= ".$mansection";
@@ -287,7 +295,7 @@ sub compile_asciidoc {
        }
     }
 
-    if (($env eq 'manvolnum') && !$man_target_html) {
+    if (($env eq 'manvolnum') && ($man_target eq 'man')) {
 
        # asciidoc /etc/asciidoc/docbook-xsl/manpage.xsl skip REFERENCES
        # section like footnotes, so we cannot use a2x.
@@ -338,7 +346,8 @@ sub compile_asciidoc {
 
        my $cmd = ['asciidoc'];
 
-       push @$cmd, '-s' if $env eq 'wiki';
+       push @$cmd, '-s' if ($env eq 'wiki') ||
+           (($env eq 'manvolnum') && ($man_target eq 'wiki'));
 
        foreach my $key (keys %$attributes) {
            my $value = $attributes->{$key};
@@ -384,7 +393,18 @@ if ($clicmd eq 'compile-wiki') {
 
 } elsif ($clicmd eq 'compile-man-html') {
 
-    $man_target_html = 1;
+    $man_target = 'html';
+
+    eval { compile_asciidoc('manvolnum'); };
+    my $err = $@;
+
+    cleanup();
+
+    die $err if $err;
+
+} elsif ($clicmd eq 'compile-man-wiki') {
+
+    $man_target = 'wiki';
 
     eval { compile_asciidoc('manvolnum'); };
     my $err = $@;