forked from dita-ot/dita-ot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into fix/save-mapref-metadata
- Loading branch information
Showing
97 changed files
with
1,384 additions
and
1,015 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* This file is part of the DITA Open Toolkit project. | ||
* | ||
* Copyright 2024 Jarno Elovirta | ||
* | ||
* See the accompanying LICENSE file for applicable license. | ||
*/ | ||
|
||
package org.dita.dost.module; | ||
|
||
import static org.dita.dost.util.Constants.ANT_INVOKER_EXT_PARAM_STYLE; | ||
import static org.dita.dost.util.Constants.ANT_INVOKER_EXT_PARAM_TRANSTYPE; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Paths; | ||
import org.dita.dost.pipeline.AbstractPipelineInput; | ||
import org.dita.dost.pipeline.PipelineHashIO; | ||
import org.dita.dost.store.CacheStore; | ||
import org.dita.dost.store.Store; | ||
import org.dita.dost.util.Configuration; | ||
import org.dita.dost.util.Job; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.ValueSource; | ||
import org.xml.sax.SAXException; | ||
|
||
class MaprefModuleTest extends AbstractModuleTest { | ||
|
||
@Override | ||
protected AbstractPipelineInput getAbstractPipelineInput() { | ||
final AbstractPipelineInput input = new PipelineHashIO(); | ||
input.setAttribute(ANT_INVOKER_EXT_PARAM_TRANSTYPE, "html5"); | ||
input.setAttribute( | ||
ANT_INVOKER_EXT_PARAM_STYLE, | ||
new File("src/main/plugins/org.dita.base/xsl/preprocess/mapref.xsl").getAbsolutePath() | ||
); | ||
return input; | ||
} | ||
|
||
@Override | ||
protected AbstractPipelineModule getModule() { | ||
return new MaprefModule(); | ||
} | ||
|
||
@ParameterizedTest | ||
@ValueSource(strings = { "basic", "mapref_reltables", "mapref_to_conref", "mapref_topicrefID" }) | ||
public void process(String testCase) throws IOException { | ||
this.testCase = testCase; | ||
tempDir = new File(tempBaseDir, testCase); | ||
job = new Job(tempDir, createStore()); | ||
mode = Configuration.Mode.LAX; | ||
chunkModule.setProcessingMode(mode); | ||
test(); | ||
} | ||
|
||
private Store createStore() throws IOException { | ||
final CacheStore store = new CacheStore(tempDir, xmlUtils); | ||
var srcDir = Paths.get(resourceDir.getAbsolutePath(), "src", testCase); | ||
Files | ||
.walk(srcDir) | ||
.filter(Files::isRegularFile) | ||
.filter(file -> !file.getFileName().toString().equals(".job.xml")) | ||
.forEach(src -> { | ||
try { | ||
var dst = tempDir.toPath().resolve(srcDir.relativize(src)).toUri(); | ||
var doc = builder.parse(src.toFile()); | ||
doc.insertBefore( | ||
doc.createProcessingInstruction("workdir-uri", dst.resolve(".").toString()), | ||
doc.getDocumentElement() | ||
); | ||
store.writeDocument(doc, dst); | ||
} catch (IOException | SAXException e) { | ||
throw new RuntimeException(e); | ||
} | ||
}); | ||
return store; | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
...est/resources/MaprefModuleTest/exp/basic/58807f59213f621bdceb4ea06ea7c2fc86ffc349.ditamap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<map xmlns:dita-ot="http://dita-ot.sourceforge.net/ns/201007/dita-ot" | ||
xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/" audience="novice" cascade="nomerge" | ||
class="- map/map " ditaarch:DITAArchVersion="1.3" | ||
domains="(map mapgroup-d) (topic abbrev-d) (topic delay-d) a(props deliveryTarget) (map ditavalref-d) (map glossref-d) (topic hazard-d) (topic hi-d) (topic indexing-d) (topic markup-d) (topic pr-d) (topic relmgmt-d) (topic sw-d) (topic ui-d) (topic ut-d) (topic markup-d xml-d)" | ||
specializations="@props/deliveryTarget"> | ||
<topicgroup class="+ map/topicref mapgroup-d/topicgroup "> | ||
<submap class="+ map/topicref mapgroup-d/topicgroup ditaot-d/submap " | ||
dita-ot:orig-class="+ map/topicref mapgroup-d/mapref " dita-ot:orig-format="ditamap" | ||
dita-ot:orig-href="f1de8cb986a52d8ed0133cb2cc44d4823f150e93.ditamap" dita-ot:submap-DITAArchVersion="1.3" | ||
dita-ot:submap-cascade="nomerge" dita-ot:submap-class="- map/map " | ||
dita-ot:submap-domains="(map mapgroup-d) (topic abbrev-d) (topic delay-d) a(props deliveryTarget) (map ditavalref-d) (map glossref-d) (topic hazard-d) (topic hi-d) (topic indexing-d) (topic markup-d) (topic pr-d) (topic relmgmt-d) (topic sw-d) (topic ui-d) (topic ut-d) (topic markup-d xml-d)" | ||
dita-ot:submap-otherprops="other" dita-ot:submap-specializations="@props/deliveryTarget" product="osx"> | ||
<submap-topicmeta class="+ map/topicmeta ditaot-d/submap-topicmeta "> | ||
<submap-title class="+ topic/navtitle ditaot-d/submap-title " dita-ot:submap-class="- topic/title ">DITA Topic | ||
Map | ||
</submap-title> | ||
</submap-topicmeta> | ||
<topicref class="- map/topicref " href="93cd2060f88749614d44c00dade0e78c437afbc8.dita" otherprops="other" | ||
props="props"/> | ||
</submap> | ||
<keydef class="+ map/topicref mapgroup-d/keydef ditaot-d/keydef " format="ditamap" | ||
href="f1de8cb986a52d8ed0133cb2cc44d4823f150e93.ditamap" keys="A" processing-role="resource-only"/> | ||
<submap class="+ map/topicref mapgroup-d/topicgroup ditaot-d/submap " | ||
dita-ot:orig-class="+ map/topicref mapgroup-d/mapref " dita-ot:orig-format="ditamap" | ||
dita-ot:orig-href="f1de8cb986a52d8ed0133cb2cc44d4823f150e93.ditamap" dita-ot:submap-DITAArchVersion="1.3" | ||
dita-ot:submap-cascade="nomerge" dita-ot:submap-class="- map/map " | ||
dita-ot:submap-domains="(map mapgroup-d) (topic abbrev-d) (topic delay-d) a(props deliveryTarget) (map ditavalref-d) (map glossref-d) (topic hazard-d) (topic hi-d) (topic indexing-d) (topic markup-d) (topic pr-d) (topic relmgmt-d) (topic sw-d) (topic ui-d) (topic ut-d) (topic markup-d xml-d)" | ||
dita-ot:submap-otherprops="other" dita-ot:submap-specializations="@props/deliveryTarget"> | ||
<submap-topicmeta class="+ map/topicmeta ditaot-d/submap-topicmeta "> | ||
<submap-title class="+ topic/navtitle ditaot-d/submap-title " dita-ot:submap-class="- topic/title ">DITA Topic | ||
Map | ||
</submap-title> | ||
</submap-topicmeta> | ||
<topicref class="- map/topicref " href="93cd2060f88749614d44c00dade0e78c437afbc8.dita" otherprops="other" | ||
props="props"/> | ||
</submap> | ||
<mapref class="+ map/topicref mapgroup-d/mapref " format="ditamap" keyref="A"/> | ||
<keydef class="+ map/topicref mapgroup-d/keydef ditaot-d/keydef " format="ditamap" | ||
href="f1de8cb986a52d8ed0133cb2cc44d4823f150e93.ditamap" keys="B" processing-role="resource-only"/> | ||
<submap class="+ map/topicref mapgroup-d/topicgroup ditaot-d/submap " | ||
dita-ot:orig-class="+ map/topicref mapgroup-d/mapref " dita-ot:orig-format="ditamap" | ||
dita-ot:orig-href="f1de8cb986a52d8ed0133cb2cc44d4823f150e93.ditamap" dita-ot:submap-DITAArchVersion="1.3" | ||
dita-ot:submap-cascade="nomerge" dita-ot:submap-class="- map/map " | ||
dita-ot:submap-domains="(map mapgroup-d) (topic abbrev-d) (topic delay-d) a(props deliveryTarget) (map ditavalref-d) (map glossref-d) (topic hazard-d) (topic hi-d) (topic indexing-d) (topic markup-d) (topic pr-d) (topic relmgmt-d) (topic sw-d) (topic ui-d) (topic ut-d) (topic markup-d xml-d)" | ||
dita-ot:submap-otherprops="other" dita-ot:submap-specializations="@props/deliveryTarget"> | ||
<submap-topicmeta class="+ map/topicmeta ditaot-d/submap-topicmeta "> | ||
<submap-title class="+ topic/navtitle ditaot-d/submap-title " dita-ot:submap-class="- topic/title ">DITA Topic | ||
Map | ||
</submap-title> | ||
</submap-topicmeta> | ||
<topicref class="- map/topicref " href="93cd2060f88749614d44c00dade0e78c437afbc8.dita" otherprops="other" | ||
props="props"/> | ||
</submap> | ||
<submap class="+ map/topicref mapgroup-d/topicgroup ditaot-d/submap " | ||
dita-ot:orig-class="+ map/topicref mapgroup-d/mapref " dita-ot:orig-format="ditamap" | ||
dita-ot:orig-href="907876965ae3c4f4a6a10fd90639d07d5b82d618.ditamap" dita-ot:submap-DITAArchVersion="1.3" | ||
dita-ot:submap-cascade="nomerge" dita-ot:submap-class="- map/map " | ||
dita-ot:submap-domains="(map mapgroup-d) (topic abbrev-d) (topic delay-d) a(props deliveryTarget) (map ditavalref-d) (map glossref-d) (topic hazard-d) (topic hi-d) (topic indexing-d) (topic markup-d) (topic pr-d) (topic relmgmt-d) (topic sw-d) (topic ui-d) (topic ut-d) (topic markup-d xml-d)" | ||
dita-ot:submap-specializations="@props/deliveryTarget" keyref="B"> | ||
<submap-topicmeta class="+ map/topicmeta ditaot-d/submap-topicmeta "> | ||
<submap-title class="+ topic/navtitle ditaot-d/submap-title " dita-ot:submap-class="- topic/title ">DITA Topic | ||
Map | ||
</submap-title> | ||
</submap-topicmeta> | ||
<topicref class="- map/topicref " href="37661754edbfa28e7abc3f45365e412f3e0a14cd.dita"/> | ||
</submap> | ||
<mapref class="+ map/topicref mapgroup-d/mapref " format="ditamap" href="peer.ditamap" scope="peer"/> | ||
</topicgroup> | ||
</map> |
8 changes: 8 additions & 0 deletions
8
...est/resources/MaprefModuleTest/exp/basic/907876965ae3c4f4a6a10fd90639d07d5b82d618.ditamap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<map | ||
xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/" ditaarch:DITAArchVersion="1.3" | ||
domains="(map mapgroup-d) (topic abbrev-d) (topic delay-d) a(props deliveryTarget) (map ditavalref-d) (map glossref-d) (topic hazard-d) (topic hi-d) (topic indexing-d) (topic markup-d) (topic pr-d) (topic relmgmt-d) (topic sw-d) (topic ui-d) (topic ut-d) (topic markup-d xml-d)" | ||
class="- map/map " cascade="nomerge" specializations="@props/deliveryTarget"> | ||
<title class="- topic/title ">DITA Topic Map</title> | ||
<topicref href="37661754edbfa28e7abc3f45365e412f3e0a14cd.dita" class="- map/topicref "/> | ||
</map> |
8 changes: 8 additions & 0 deletions
8
...est/resources/MaprefModuleTest/exp/basic/f1de8cb986a52d8ed0133cb2cc44d4823f150e93.ditamap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<map | ||
xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/" otherprops="other" ditaarch:DITAArchVersion="1.3" | ||
domains="(map mapgroup-d) (topic abbrev-d) (topic delay-d) a(props deliveryTarget) (map ditavalref-d) (map glossref-d) (topic hazard-d) (topic hi-d) (topic indexing-d) (topic markup-d) (topic pr-d) (topic relmgmt-d) (topic sw-d) (topic ui-d) (topic ut-d) (topic markup-d xml-d)" | ||
class="- map/map " cascade="nomerge" specializations="@props/deliveryTarget"> | ||
<title class="- topic/title ">DITA Topic Map</title> | ||
<topicref href="93cd2060f88749614d44c00dade0e78c437afbc8.dita" props="props" class="- map/topicref "/> | ||
</map> |
Oops, something went wrong.