VirtualBox

source: vbox/trunk/doc/manual/docbook-changelog-to-manual-dita.sh@ 106950

Last change on this file since 106950 was 106061, checked in by vboxsync, 2 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1#!/usr/bin/env kmk_ash
2# $Id: docbook-changelog-to-manual-dita.sh 106061 2024-09-16 14:03:52Z vboxsync $
3## @file
4# Helper script for converting the changelog into a ditamap and a topic
5# file per version.
6#
7
8#
9# Copyright (C) 2023-2024 Oracle and/or its affiliates.
10#
11# This file is part of VirtualBox base platform packages, as
12# available from https://www.virtualbox.org.
13#
14# This program is free software; you can redistribute it and/or
15# modify it under the terms of the GNU General Public License
16# as published by the Free Software Foundation, in version 3 of the
17# License.
18#
19# This program is distributed in the hope that it will be useful, but
20# WITHOUT ANY WARRANTY; without even the implied warranty of
21# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22# General Public License for more details.
23#
24# You should have received a copy of the GNU General Public License
25# along with this program; if not, see <https://www.gnu.org/licenses>.
26#
27# SPDX-License-Identifier: GPL-3.0-only
28#
29
30#
31# Globals.
32#
33MY_SED=kmk_sed
34
35#
36# This script is very internal, so we got the following fixed position parameters:
37# 1: user_ChangeLogImpl.xml to use as input.
38# 2: docbook-changelog-to-manual-dita.xsl
39# 5: The out directory.
40# 6: '--'
41# 7+: xsltproc invocation (sans output, input and xslt file).
42#
43if test $# -lt 8; then
44 echo "syntax error: too few arguments" 1>&2;
45 exit 2;
46fi
47MY_INPUT_FILE="$1"
48MY_XSLT="$2"
49MY_GENERATED_KMK="$3"
50MY_GENERATED_KMK_VARIABLE="$4"
51MY_OUTPUT_DIR="$5"
52if test "$6" != "--"; then
53 echo "syntax error: Expected '--' as the 6th parameter, got: $6" 1>&2;
54 exit 2;
55fi
56shift 6
57
58if ! test -f "${MY_INPUT_FILE}"; then
59 echo "error: Input file does not exists or is not a regular file: ${MY_INPUT_FILE}" 1>&2;
60 exit 1;
61fi
62if ! test -f "${MY_XSLT}"; then
63 echo "error: The given dita-refentry-flat-topic-ids.xsl file does not exists or is not a regular file: ${MY_XSLT_TOPIC_IDS}" 1>&2;
64 exit 1;
65fi
66if ! test -d "${MY_OUTPUT_DIR}"; then
67 echo "error: Destination directory does not exists or not a directory: ${MY_OUTPUT_DIR}" 1>&2;
68 exit 1;
69fi
70
71# Exit on failure.
72set -e
73
74#
75# First get the ID list from it.
76# We drop the first line with the <?xml ... ?> stuff.
77#
78MY_TOPIC_IDS=$($* --stringparam g_sMode ids "${MY_XSLT}" "${MY_INPUT_FILE}" | ${MY_SED} -e 1d)
79
80echo "${MY_GENERATED_KMK_VARIABLE} += \\" > "${MY_GENERATED_KMK}"
81
82#
83# Extract each topic.
84#
85for MY_ID in ${MY_TOPIC_IDS};
86do
87 $* \
88 --stringparam g_sMode topic \
89 --stringparam g_idTopic "${MY_ID}" \
90 --output "${MY_OUTPUT_DIR}/${MY_ID}.dita" "${MY_XSLT}" "${MY_INPUT_FILE}"
91 echo " ${MY_OUTPUT_DIR}/${MY_ID}.dita \\" >> "${MY_GENERATED_KMK}"
92done
93
94#
95# Now for the ditamap file.
96#
97$* --stringparam g_sMode map --output "${MY_OUTPUT_DIR}/changelog-versions.ditamap" "${MY_XSLT}" "${MY_INPUT_FILE}"
98echo "" >> "${MY_GENERATED_KMK}"
99exit 0
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette