From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [RFC PATCH docs 08/13] scan-adoc-refs: enable building pages from proxmox-docs-common/ subdir
Date: Fri, 19 Apr 2024 11:05:14 +0200 [thread overview]
Message-ID: <20240419090519.291775-9-c.heiss@proxmox.com> (raw)
In-Reply-To: <20240419090519.291775-1-c.heiss@proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Makefile | 6 ++++--
asciidoc/asciidoc-pve.conf | 2 ++
pve-doc-generator.mk.in | 6 ++++++
scan-adoc-refs | 25 ++++++++++++++++---------
4 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/Makefile b/Makefile
index 801a2a3..5b14e3d 100644
--- a/Makefile
+++ b/Makefile
@@ -26,9 +26,11 @@ all: index.html
verify-images:
for i in ./images/screenshot/*.png; do ./png-verify.pl $$i; done
-ADOC_SOURCES_GUESS=$(filter-out %-synopsis.adoc %-opts.adoc %-table.adoc, $(wildcard *.adoc))
+ADOC_WILDCARD_SOURCES := *.adoc proxmox-docs-common/*.adoc proxmox-docs-common/partials/*.adoc
+ADOC_SOURCES_GUESS=$(filter-out %-synopsis.adoc %-opts.adoc %-table.adoc, $(wildcard $(ADOC_WILDCARD_SOURCES)))
+
.pve-doc-depends link-refs.json: $(ADOC_SOURCES_GUESS) scan-adoc-refs
- ./scan-adoc-refs *.adoc --depends .pve-doc-depends.tmp > link-refs.json.tmp
+ ./scan-adoc-refs $(ADOC_WILDCARD_SOURCES) --depends .pve-doc-depends.tmp > link-refs.json.tmp
@cmp --quiet .pve-doc-depends .pve-doc-depends.tmp || mv .pve-doc-depends.tmp .pve-doc-depends
@cmp --quiet link-refs.json link-refs.json.tmp || mv link-refs.json.tmp link-refs.json
diff --git a/asciidoc/asciidoc-pve.conf b/asciidoc/asciidoc-pve.conf
index 0c28298..47139b8 100644
--- a/asciidoc/asciidoc-pve.conf
+++ b/asciidoc/asciidoc-pve.conf
@@ -3,6 +3,8 @@
proxmoxGmbh=Proxmox Server Solutions GmbH
copyright=Proxmox Server Solutions GmbH
pve=Proxmox VE
+product=Proxmox VE
+product-short=pve
pricing-url=https://proxmox.com/en/proxmox-virtual-environment/pricing
website=https://www.proxmox.com/
forum-url=https://forum.proxmox.com/
diff --git a/pve-doc-generator.mk.in b/pve-doc-generator.mk.in
index 77fd4f6..a733966 100644
--- a/pve-doc-generator.mk.in
+++ b/pve-doc-generator.mk.in
@@ -71,9 +71,15 @@ endif
%-plain.html: %.adoc ${PVE_COMMON_DOC_SOURCES}
${ASCIIDOC_PVE} compile-wiki -o $@ $*.adoc
+%-plain.html: proxmox-docs-common/%.adoc ${PVE_COMMON_DOC_SOURCES}
+ ${ASCIIDOC_PVE} compile-wiki -o $@ proxmox-docs-common/$*.adoc
+
chapter-%.html: %.adoc ${PVE_COMMON_DOC_SOURCES}
${ASCIIDOC_PVE} compile-chapter -o $@ $*.adoc
+chapter-%.html: proxmox-docs-common/%.adoc ${PVE_COMMON_DOC_SOURCES}
+ ${ASCIIDOC_PVE} compile-chapter -o $@ proxmox-docs-common/$*.adoc
+
%.1: %.adoc %.1-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
${ASCIIDOC_PVE} compile-man -o $@ $*.adoc
test -z "$${PVE_DOC_INSTANTVIEW}" || man -l $@
diff --git a/scan-adoc-refs b/scan-adoc-refs
index 9252701..fd74c20 100755
--- a/scan-adoc-refs
+++ b/scan-adoc-refs
@@ -5,6 +5,8 @@ use warnings;
use Getopt::Long;
use IO::File;
use JSON;
+use Cwd qw(abs_path);
+use File::Spec;
use Data::Dumper;
@@ -19,6 +21,7 @@ my $environments = {
wiki => 1,
manvolnum => 1,
pvelogo => 0, # ignore
+ pve => 0,
};
my $fileinfo = {};
@@ -76,6 +79,12 @@ sub pop_environment {
sub register_include {
my ($filename, $include_filename, $env_list) = @_;
+ # get containing directory of the file that includes ..
+ my $reldir = (File::Spec->splitpath($filename))[1];
+ # .. and resolve the included filename relative to that
+ $include_filename = abs_path(File::Spec->join($reldir, $include_filename))
+ if $reldir;
+
foreach my $e (@$env_list) {
$fileinfo->{include}->{$e}->{$filename}->{$include_filename} = 1;
}
@@ -99,6 +108,7 @@ sub register_title {
# fixme: what about other macros?
$title =~ s/\{pve\}/Proxmox VE/g;
+ $title =~ s/\{product\}/Proxmox VE/g;
$title =~ s!http://\S+\[(.*?)\]!$1!g;
# register document title (onyl once)
@@ -269,23 +279,19 @@ foreach my $e (@$start_env) {
my $toplevel_hash = $fileinfo->{toplevel}->{$e};
foreach my $fn (sort keys %$toplevel_hash) {
my $mansection = $fileinfo->{mansection}->{manvolnum}->{$fn};
+ my $realfn = $fn;
+ $realfn =~ s/^proxmox-docs-common\///;
+ $realfn =~ s/\.adoc$//;
+
if ($e eq 'wiki') {
- my $realfn = $fn;
- $realfn =~ s/\.adoc$//;
if (defined($mansection) && ($mansection == 5)) {
$realfn .= ".$mansection";
}
$realfn = "$realfn-plain.html";
- $fileinfo->{outfile}->{$e}->{$fn} = $realfn;
} elsif ($e eq 'manvolnum') {
- my $realfn = $fn;
- $realfn =~ s/\.adoc$//;
die "toplevel file '$fn' is not marked as manual page!" if !$mansection;
$realfn .= ".$mansection";
- $fileinfo->{outfile}->{$e}->{$fn} = $realfn;
} elsif ($e eq 'default') {
- my $realfn = $fn;
- $realfn =~ s/\.adoc$//;
if (defined($mansection) && ($mansection == 5)) {
$realfn .= ".$mansection";
$realfn = "$realfn.html";
@@ -297,8 +303,9 @@ foreach my $e (@$start_env) {
$realfn = "$realfn.html";
}
}
- $fileinfo->{outfile}->{$e}->{$fn} = $realfn;
}
+
+ $fileinfo->{outfile}->{$e}->{$fn} = $realfn;
}
}
--
2.44.0
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2024-04-19 9:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-19 9:05 [pve-devel] [RFC PATCH docs{, -common} 0/13] introduce common documentation base Christoph Heiss
2024-04-19 9:05 ` [pve-devel] [RFC PATCH docs-common 01/13] installation-media: move page from pve-docs here Christoph Heiss
2024-04-19 10:51 ` Aaron Lauterer
2024-04-19 11:20 ` Christoph Heiss
2024-04-19 9:05 ` [pve-devel] [RFC PATCH docs-common 02/13] installation-media: adapt for common usage Christoph Heiss
2024-04-19 9:05 ` [pve-devel] [RFC PATCH docs-common 03/13] partials: add installation flow from pve-docs Christoph Heiss
2024-04-19 9:05 ` [pve-devel] [RFC PATCH docs-common 04/13] partials: installation-flow: adapt " Christoph Heiss
2024-04-19 9:05 ` [pve-devel] [RFC PATCH docs-common 05/13] partials: add advanced installation hints " Christoph Heiss
2024-04-19 9:05 ` [pve-devel] [RFC PATCH docs-common 06/13] partials: advanced-installation: adapt " Christoph Heiss
2024-04-19 9:05 ` [pve-devel] [RFC PATCH docs 07/13] gitmodules: add proxmox-docs-common Christoph Heiss
2024-04-19 9:05 ` Christoph Heiss [this message]
2024-04-19 9:05 ` [pve-devel] [RFC PATCH docs 09/13] images: strip `pve-` prefix from screenshots used in common docs Christoph Heiss
2024-04-19 9:05 ` [pve-devel] [RFC PATCH docs 10/13] asciidoc: conf: add iso-url variable Christoph Heiss
2024-04-19 9:05 ` [pve-devel] [RFC PATCH docs 11/13] installation-media: move to common docs Christoph Heiss
2024-04-19 9:05 ` [pve-devel] [RFC PATCH docs 12/13] installation: use new 'installation-flow' partial from " Christoph Heiss
2024-04-19 9:05 ` [pve-devel] [RFC PATCH docs 13/13] installation: use new 'advanced-installation' " Christoph Heiss
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240419090519.291775-9-c.heiss@proxmox.com \
--to=c.heiss@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal