VirtualBox

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

Last change on this file since 100148 was 99514, checked in by vboxsync, 20 months ago

manual: Added the changelog to the (DITA) manual. bugref:10302

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1#!/usr/bin/env kmk_ash
2# $Id: docbook-changelog-to-manual-dita.sh 99514 2023-04-22 01:59:25Z 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 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# 3: The out directory.
40# 4: '--'
41# 5+: xsltproc invocation (sans output, input and xslt file).
42#
43if test $# -lt 6; then
44 echo "syntax error: too few arguments" 1>&2;
45 exit 2;
46fi
47MY_INPUT_FILE="$1"
48MY_XSLT="$2"
49MY_OUTPUT_DIR="$3"
50if test "$4" != "--"; then
51 echo "syntax error: Expected '--' as the 4th parameter, got: $4" 1>&2;
52 exit 2;
53fi
54shift 4
55
56if ! test -f "${MY_INPUT_FILE}"; then
57 echo "error: Input file does not exists or is not a regular file: ${MY_INPUT_FILE}" 1>&2;
58 exit 1;
59fi
60if ! test -f "${MY_XSLT}"; then
61 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;
62 exit 1;
63fi
64if ! test -d "${MY_OUTPUT_DIR}"; then
65 echo "error: Destination directory does not exists or not a directory: ${MY_OUTPUT_DIR}" 1>&2;
66 exit 1;
67fi
68
69# Exit on failure.
70set -e
71
72#
73# First get the ID list from it.
74# We drop the first line with the <?xml ... ?> stuff.
75#
76MY_TOPIC_IDS=$($* --stringparam g_sMode ids "${MY_XSLT}" "${MY_INPUT_FILE}" | ${MY_SED} -e 1d)
77
78#
79# Extract each topic.
80#
81for MY_ID in ${MY_TOPIC_IDS};
82do
83 $* \
84 --stringparam g_sMode topic \
85 --stringparam g_idTopic "${MY_ID}" \
86 --output "${MY_OUTPUT_DIR}/${MY_ID}.dita" "${MY_XSLT}" "${MY_INPUT_FILE}"
87done
88
89#
90# Now for the ditamap file.
91#
92$* --stringparam g_sMode map --output "${MY_OUTPUT_DIR}/changelog-versions.ditamap" "${MY_XSLT}" "${MY_INPUT_FILE}"
93exit 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