5
0
mirror of git://git.proxmox.com/git/pve-docs.git synced 2025-01-21 18:03:45 +03:00

new file pve-docs-mediawiki-import.in

And use auto-generated data from link-refs.json.

Also avoid strange file names.
This commit is contained in:
Dietmar Maurer 2016-10-10 09:14:25 +02:00
parent cb84ed187a
commit b489b02c74
3 changed files with 68 additions and 53 deletions

View File

@ -169,16 +169,21 @@ asciidoc-pve: asciidoc-pve.in link-refs.json
chmod +x asciidoc-pve.tmp
mv asciidoc-pve.tmp asciidoc-pve
pve-docs-mediawiki-import: pve-docs-mediawiki-import.in link-refs.json
cat pve-docs-mediawiki-import.in link-refs.json > pve-docs-mediawiki-import.tmp
chmod +x pve-docs-mediawiki-import.tmp
mv pve-docs-mediawiki-import.tmp pve-docs-mediawiki-import
test: asciidoc-pve
./asciidoc-pve compile-wiki-section pve-package-repos.adoc
#./asciidoc-pve compile-wiki-chapter ha-manager.adoc
WIKI_IMPORTS= \
section-pve-usbstick-plain.html \
section-getting-help-plain.html \
section-pve-system-requirements-plain.html \
$(addsuffix -plain.html, $(addprefix sysadmin-, ${SYSADMIN_PARTS})) \
$(addsuffix -plain.html, $(addprefix chapter-, ${CHAPTER_LIST})) \
pve-usbstick-plain.html \
getting-help-plain.html \
pve-system-requirements-plain.html \
$(addsuffix -plain.html, ${SYSADMIN_PARTS}) \
$(addsuffix -plain.html, ${CHAPTER_LIST}) \
$(addsuffix .5-plain.html, ${CONFIG_LIST}) \
$(addsuffix -plain.html, $(addprefix pve-storage-, ${STORAGE_TYPES}))
@ -203,23 +208,14 @@ all: index.html
%-nwdiag.svg: %.nwdiag
nwdiag -T svg $*.nwdiag -o $@;
sysadmin-%-plain.html: asciidoc-pve %.adoc
./asciidoc-pve compile-wiki-section -o $@ $*.adoc
%-plain.html: asciidoc-pve %.adoc
./asciidoc-pve compile-wiki -o $@ $*.adoc
section-%-plain.html: asciidoc-pve %.adoc
./asciidoc-pve compile-wiki-section -o $@ $*.adoc
chapter-sysadmin.html chapter-sysadmin-plain.html: ${SYSADMIN_SOURCES}
chapter-sysadmin.html sysadmin-plain.html: ${SYSADMIN_SOURCES}
chapter-%.html: %.adoc ${PVE_COMMON_DOC_SOURCES}
asciidoc ${ADOC_STDARG} -a toc -o $@ $*.adoc
chapter-%-plain.html: %.adoc ${PVE_COMMON_DOC_SOURCES}
./asciidoc-pve compile-wiki-chapter -o $@ $*.adoc
pve-storage-%-plain.html: pve-storage-%.adoc ${PVE_COMMON_DOC_SOURCES}
./asciidoc-pve compile-wiki-section -o $@ pve-storage-$*.adoc
%.1.html: %.adoc %.1-synopsis.adoc ${PVE_COMMON_DOC_SOURCES}
asciidoc ${ADOC_MAN1_HTML_ARGS} -o $@ $*.adoc
@ -277,10 +273,11 @@ deb:
rm -f ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB};
make ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB};
${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}: index.html ${INDEX_INCLUDES} ${WIKI_IMPORTS} ${API_VIEWER_SOURCES} ${GEN_DEB_SOURCES}
${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}: index.html ${INDEX_INCLUDES} ${WIKI_IMPORTS} ${API_VIEWER_SOURCES} ${GEN_DEB_SOURCES} asciidoc-pve pve-docs-mediawiki-import
rm -rf build
mkdir build
rsync -a debian/ build/debian
cp pve-docs-mediawiki-import build/debian/tree/pve-docs-mediawiki/pve-docs-mediawiki-import
echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build/debian/SOURCE
# install files for pve-doc-generator package
mkdir -p build/usr/share/${GEN_PACKAGE}
@ -313,5 +310,5 @@ update: clean
make all
clean:
rm -rf *.tmp.xml *.html *.pdf *.epub *.tmp *.1 *.5 *.8 *.deb *.changes build api-viewer/apidoc.js chapter-*.html chapter-*-plain.html chapter-*.html pve-admin-guide.chunked asciidoc-pve link-refs.json .asciidoc-pve-tmp_*
rm -rf *.tmp.xml *.html *.pdf *.epub *.tmp *.1 *.5 *.8 *.deb *.changes build api-viewer/apidoc.js chapter-*.html *-plain.html chapter-*.html pve-admin-guide.chunked asciidoc-pve link-refs.json .asciidoc-pve-tmp_* pve-docs-mediawiki-import
find . -name '*~' -exec rm {} ';'

View File

@ -162,11 +162,8 @@ sub compile_wiki {
my $leveloffset = 0;
if ($clicmd eq 'compile-wiki-chapter') {
$leveloffset = 0;
} elsif ($clicmd eq 'compile-wiki-section') {
$leveloffset = -1;
}
my $doctype = $fileinfo->{doctype}->{$env}->{$infile} // 0;
$leveloffset = - $doctype;
my $date = `date`;
chomp $date;
@ -211,8 +208,7 @@ sub compile_wiki {
die "aciidoc error";
}
if ($clicmd eq 'compile-wiki-chapter' ||
$clicmd eq 'compile-wiki-section') {
if ($clicmd eq 'compile-wiki') {
eval { compile_wiki(); };
my $err = $@;

View File

@ -8,6 +8,13 @@ use IO::File;
use File::Basename;
use MediaWiki::API;
use JSON;
my $data_str = "";
while (<main::DATA>) { $data_str .= $_; }
my $fileinfo = decode_json($data_str);
my $config_fn = "/root/.pve-docs"; # format 'username:pw'
my $fh = IO::File->new("$config_fn") ||
@ -63,88 +70,88 @@ sub update_page {
my $cat_refdoc = "Reference Documentation";
my $docs = {
'chapter-ha-manager-plain.html' => {
my $docs_old = {
'ha-manager-plain.html' => {
title => "High Availability",
category => $cat_refdoc,
},
'chapter-pve-installation-plain.html' => {
'pve-installation-plain.html' => {
title => "Installation",
category => $cat_refdoc,
},
'section-pve-usbstick-plain.html' => {
'pve-usbstick-plain.html' => {
title => "Install from USB Stick",
category => $cat_refdoc,
},
'section-pve-system-requirements-plain.html' => {
'pve-system-requirements-plain.html' => {
title => "System Requirements",
category => $cat_refdoc,
},
'section-getting-help-plain.html' => {
'getting-help-plain.html' => {
title => "Getting Help",
category => $cat_refdoc,
},
'sysadmin-pve-network-plain.html' => {
'pve-network-plain.html' => {
title => "Network Configuration",
category => $cat_refdoc,
},
'sysadmin-pve-disk-health-monitoring-plain.html' => {
'pve-disk-health-monitoring-plain.html' => {
title => "Disk Health Monitoring",
category => $cat_refdoc,
},
'sysadmin-local-lvm-plain.html' => {
'local-lvm-plain.html' => {
title => "Logical Volume Manager (LVM)",
category => $cat_refdoc,
},
'sysadmin-pve-package-repos-plain.html' => {
'pve-package-repos-plain.html' => {
title => "Package Repositories",
category => $cat_refdoc,
},
'sysadmin-system-software-updates-plain.html' => {
'system-software-updates-plain.html' => {
title => "System Software Updates",
category => $cat_refdoc,
},
'chapter-sysadmin-plain.html' => {
'sysadmin-plain.html' => {
title => "Host System Administration",
category => $cat_refdoc,
},
'chapter-pct-plain.html' => {
'pct-plain.html' => {
title => "Linux Container",
category => $cat_refdoc,
},
'chapter-pmxcfs-plain.html' => {
'pmxcfs-plain.html' => {
title => "Proxmox Cluster File System (pmxcfs)",
category => $cat_refdoc,
},
'chapter-pve-bibliography-plain.html' => {
'pve-bibliography-plain.html' => {
title => "Bibliography",
category => $cat_refdoc,
},
'chapter-pvecm-plain.html' => {
'pvecm-plain.html' => {
title => "Cluster Manager",
category => $cat_refdoc,
},
'chapter-pve-faq-plain.html' => {
'pve-faq-plain.html' => {
title => "FAQ",
category => $cat_refdoc,
},
'chapter-pve-firewall-plain.html' => {
'pve-firewall-plain.html' => {
title => "Firewall",
category => $cat_refdoc,
},
'chapter-pvesm-plain.html' => {
'pvesm-plain.html' => {
title => "Storage",
category => $cat_refdoc,
},
'chapter-pveum-plain.html' => {
'pveum-plain.html' => {
title => "User Management",
category => $cat_refdoc,
},
'chapter-qm-plain.html' => {
'qm-plain.html' => {
title => "Qemu/KVM Virtual Machines",
category => $cat_refdoc,
},
'chapter-vzdump-plain.html' => {
'vzdump-plain.html' => {
title => "Backup and Restore",
category => $cat_refdoc,
},
@ -199,15 +206,30 @@ my $docs = {
},
};
#update_page("testpage1", $filename, $d->{category});
my $wiki_man5_pages = {
'datacenter.cfg.adoc' => 1,
'qm.conf.adoc' => 1,
'pct.conf.adoc' => 1,
};
my $docs = {};
foreach my $source (sort keys %{$fileinfo->{toplevel}->{wiki}}) {
my $title = $fileinfo->{titles}->{wiki}->{$source};
my $doctype = $fileinfo->{doctype}->{wiki}->{$source};
my $suffix = $wiki_man5_pages->{$source} ? '.5-plain.html' : '-plain.html';
my $filename = $source;
$filename =~ s/\.adoc//;
$filename .= $suffix;
foreach my $filename (keys %$docs) {
my $path = "/usr/share/pve-docs/$filename";
die "no such file '$path'" if ! -f $path;
my $d = $docs->{$filename};
update_page($d->{title}, $filename, $d->{category});
update_page($title, $filename, category => $cat_refdoc);
}
# also update 'Get support' page, because this is used since a long
# time and is referenced from outside
update_page("Get support", 'sysadmin-getting-help-plain.html', 'HOWTO');
update_page("Get support", 'getting-help-plain.html', 'HOWTO');
__END__