Skip to content

Commit 35678b5

Browse files
author
Jason Porter
committed
Ditamap trial
Signed-off-by: Jason Porter <jporter@ibm.com>
1 parent bdb1986 commit 35678b5

3 files changed

Lines changed: 26 additions & 7 deletions

File tree

.github/workflows/convert-adoc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
node-version: v22.14.0
3434

3535
- name: "Install asciidoctor and asciidoctor-dita-topic converter"
36-
run: gem install asciidoctor asciidoctor-dita-topic
36+
run: bundle install
3737

3838
- name: "Install xslt3"
3939
run: npm install xslt3
@@ -49,7 +49,7 @@ jobs:
4949
# location using the same structure. rsync makes this really easy and pretty quick.
5050
# However, we don't want any of the git files, github files, or other build related files included.
5151
- name: "Copy non-adoc files to output directory"
52-
run: rsync -zarv --exclude="*.adoc" --exclude=".git" --exclude=".github" --exclude "node_modules" --exclude "package.json" --exclude "package.lock" . generated-dita
52+
run: rsync -zarv --exclude="*.adoc" --exclude=".git" --exclude=".github" --exclude "node_modules" --exclude "package.json" --exclude "package.lock" --exclude "Gemfile*". generated-dita
5353

5454
# The dita-topic converter was already downloaded and installed above.
5555
# Using the '-r' flag instructs asciidoctor to include it and the

Gemfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
5+
gem "asciidoctor-dita-topic", git: 'https://github.com/lightguard/asciidoctor-dita-topic', branch: 'ditamap-support'
6+
7+
# gem "rails"

breakout-subsections.xslt

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,35 @@
1313
<xsl:strip-space elements="*" />
1414
<xsl:preserve-space elements="codeblock pre screen" />
1515

16+
<!-- set the language for the topic -->
17+
<xsl:template match="/topic">
18+
<topic id="{@id}" xml:lang="en-us">
19+
<xsl:copy>
20+
<xsl:apply-templates select="node()" />
21+
</xsl:copy>
22+
</topic>
23+
</xsl:template>
24+
25+
<!-- body/title isn't necessary -->
26+
<xsl:template match="//body/title" />
27+
28+
<!-- Some of our files have body/style, it isn't appropriate for dita -->
29+
<xsl:template match="//body/style" />
30+
1631
<!-- Fix up any xref links that reference adoc documents
1732
since adoc will not be used after the dita conversion -->
1833
<xsl:template match="//xref[contains(@href, '.adoc')]">
1934
<xref href="{replace(@href, '.adoc', '.dita')}"><xsl:value-of select="text()" /></xref>
2035
</xsl:template>
2136

2237
<!--
23-
Sections cannot be nested in DITA, but you can do a content reference.
24-
This splits out the nested section into its own topic file and creates a conref in the original document.
38+
Sections cannot be nested in DITA. This splits out the nested section into its own topic file.
2539
The new subsection file will be created alongside the original with the id of the current topic and the
2640
subsection concatenated together.
2741
-->
2842
<xsl:template match="/topic/body/section//section">
2943
<xsl:variable name="sub-section-filename" select="concat(ancestor::topic/@id, @id, $file-extension)" />
30-
<div conref="{$sub-section-filename}">
31-
<xsl:value-of select="@id" />
32-
</div>
44+
<!-- We are removing the content from the main document and putting it into a new one -->
3345
<xsl:result-document href="{$sub-section-filename}" format="sub-section">
3446
<topic id="{@id}">
3547
<xsl:copy-of select="title" />

0 commit comments

Comments
 (0)