Commit 2ddd716b authored by thorsten.vitt's avatar thorsten.vitt
Browse files

Merge branch 'release/1.4.2'

parents d55afd10 c228aac2
......@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>info.textgrid.services</groupId>
<artifactId>aggregator</artifactId>
<version>1.4.1</version>
<version>1.4.2</version>
<packaging>war</packaging>
<name>TextGrid Aggregator Service</name>
......
......@@ -200,13 +200,7 @@
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="desc">
<xsl:comment>
<xsl:apply-templates/>
</xsl:comment>
</xsl:template>
<xsl:template name="copyrightStatement">
<xsl:choose>
<xsl:when test="/*/teiHeader/fileDesc/publicationStmt/availability">
......
......@@ -32,5 +32,35 @@
</xsl:if>
<xsl:apply-templates mode="plain"/>
</xsl:template>
<!--
desc/title is used for headings from <lem> elements, which we suspected to be zeno.org navigation only.
The contents is usually supressed in HTML output, however we construct an artificial title from it
iff its string contents is different from the first following head for cases where the original heading
from the text has _not_ been explicitely encoded by zeno.org ...
-->
<xsl:template match="desc">
<xsl:choose>
<xsl:when test="normalize-space(.) = normalize-space(following::head[1])">
<xsl:comment>
<xsl:apply-templates/>
</xsl:comment>
</xsl:when>
<xsl:otherwise>
<xsl:comment>unsupressed desc content</xsl:comment>
<xsl:apply-templates/>
<xsl:comment>/unsupressed desc content</xsl:comment>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="desc/title">
<xsl:param name="Depth" select="2 + count(ancestor::div)"/>
<xsl:element name="h{if ($Depth > 6) then 6 else $Depth}">
<xsl:attribute name="class">desc</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
......@@ -39,25 +39,25 @@
* {@linkplain XMLUnit#setIgnoreDiffBetweenTextAndCDATA(boolean) ignoring the
* difference between CDATA segments and text}, and
* {@linkplain XMLUnit#setNormalizeWhitespace(boolean) normalizing whitespace}.
*
*
* If you modified or upgraded the stylesheets and you are sure the differences are ok,
* you can run {@code mvn -Dregression.outputdir=src/test/resources test} to generate new
* versions of the reference documents, and check them in.
*
*
* @author Thorsten Vitt <thorsten.vitt@uni-wuerzburg.de>
*/
public class HtmlRegressionTest extends XMLTestCase {
private static final String OUTPUTDIR_PROPERTY = "regression.outputdir";
private ITextGridRep rep = TextGridRepProvider.getInstance();
private StylesheetManager stylesheets = new StylesheetManager(null,
private final ITextGridRep rep = TextGridRepProvider.getInstance();
private final StylesheetManager stylesheets = new StylesheetManager(null,
TextGridRepProvider.getInstance());
protected void writeHtmlTo(final String uris, final OutputStream target)
throws WebApplicationException, IOException, ObjectNotFoundFault,
MetadataParseFault, IoFault, ProtocolNotImplementedFault,
AuthFault, SaxonApiException {
HTMLWriter htmlWriter = new HTMLWriter(rep, stylesheets, uris, null,
final HTMLWriter htmlWriter = new HTMLWriter(rep, stylesheets, uris, null,
false, false, false, null, null, null, null, null);
htmlWriter.createResponse();
htmlWriter.write(target);
......@@ -72,18 +72,18 @@ public void compareHtml(final String uris, final String compareFilename)
XMLUnit.setIgnoreDiffBetweenTextAndCDATA(true);
XMLUnit.setNormalizeWhitespace(true);
Optional<String> outputPath = Optional.<String> fromNullable(System
final Optional<String> outputPath = Optional.<String> fromNullable(System
.getProperty(OUTPUTDIR_PROPERTY));
if (outputPath.isPresent()) {
File targetFile = new File(outputPath.get(), compareFilename);
FileOutputStream target = new FileOutputStream(targetFile);
final File targetFile = new File(outputPath.get(), compareFilename);
final FileOutputStream target = new FileOutputStream(targetFile);
System.out.println(MessageFormat.format(
"### Writing the current result for {0} to {1}", uris,
targetFile));
writeHtmlTo(uris, target);
target.close();
} else {
FileBackedOutputStream target = new FileBackedOutputStream(
final FileBackedOutputStream target = new FileBackedOutputStream(
1048 * 1048);
System.out
.println(MessageFormat
......@@ -93,12 +93,12 @@ public void compareHtml(final String uris, final String compareFilename)
writeHtmlTo(uris, target);
target.close();
InputSource control = new InputSource(getClass().getClassLoader()
final InputSource control = new InputSource(getClass().getClassLoader()
.getResourceAsStream(compareFilename));
InputSource test = new InputSource(target.getSupplier().getInput());
final InputSource test = new InputSource(target.getSupplier().getInput());
Diff diff = new Diff(control, test);
DetailedDiff detailedDiff = new DetailedDiff(diff);
final Diff diff = new Diff(control, test);
final DetailedDiff detailedDiff = new DetailedDiff(diff);
assertTrue(MessageFormat.format("HTML Regression for {0} / {1}\n", uris, compareFilename) + detailedDiff.toString(), diff.identical());
}
}
......@@ -107,7 +107,7 @@ public void compareHtml(final String uris, final String compareFilename)
public void testPoem() throws WebApplicationException, IOException, SAXException, ObjectNotFoundFault, MetadataParseFault, IoFault, ProtocolNotImplementedFault, AuthFault, SaxonApiException {
compareHtml("textgrid:mr47.0", "mr47.0.html");
}
@Test
public void testDrama() throws WebApplicationException, IOException, SAXException, ObjectNotFoundFault, MetadataParseFault, IoFault, ProtocolNotImplementedFault, AuthFault, SaxonApiException {
compareHtml("textgrid:msdd.0", "msdd.0.html");
......@@ -117,20 +117,25 @@ public void testDrama() throws WebApplicationException, IOException, SAXExceptio
public void testNovel() throws WebApplicationException, IOException, SAXException, ObjectNotFoundFault, MetadataParseFault, IoFault, ProtocolNotImplementedFault, AuthFault, SaxonApiException {
compareHtml("textgrid:mr23.0", "mr23.0.html");
}
@Test
public void testPoems() throws WebApplicationException, IOException, SAXException, ObjectNotFoundFault, MetadataParseFault, IoFault, ProtocolNotImplementedFault, AuthFault, SaxonApiException {
compareHtml("textgrid:mjr3.0", "mjr3.0.html");
}
@Test
public void testBiography() throws WebApplicationException, IOException, SAXException, ObjectNotFoundFault, MetadataParseFault, IoFault, ProtocolNotImplementedFault, AuthFault, SaxonApiException {
compareHtml("textgrid:nbvb.0", "nbvb.0.html");
}
@Test
public void testDescs() throws WebApplicationException, IOException, SAXException, ObjectNotFoundFault, MetadataParseFault, IoFault, ProtocolNotImplementedFault, AuthFault, SaxonApiException {
compareHtml("textgrid:n2kf.0", "n2kf.0.html");
}
@Test
public void testLetter() throws WebApplicationException, IOException, SAXException, ObjectNotFoundFault, MetadataParseFault, IoFault, ProtocolNotImplementedFault, AuthFault, SaxonApiException {
compareHtml("textgrid:11sqw.0", "11sqw.0.html");
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="UTF-8"?>
<project version="15.2">
<project version="16.0">
<meta>
<filters directoryPatterns="" filePatterns="" positiveFilePatterns="" showHiddenFiles="false"/>
<options>
<serialized version="15.2" xml:space="preserve">
<map>
<serialized version="16.0" xml:space="preserve">
<serializableOrderedMap>
<entry>
<String>enable.project.master.files.support</String>
<Boolean>true</Boolean>
......@@ -14,16 +14,18 @@
<scenarioAssociation-array>
<scenarioAssociation>
<field name="url">
<String>src/main/webapp/WEB-INF/stylesheets/corpus2groups.xsl</String>
<String>src/main/webapp/WEB-INF/stylesheets/db2xhtml.xsl</String>
</field>
<field name="scenarioIds">
<list>
<String>corpus2groups</String>
<String>db2xhtml</String>
<String>db2xhtml-soll-haben</String>
</list>
</field>
<field name="scenarioTypes">
<list>
<String>XML</String>
<String>XML</String>
</list>
</field>
</scenarioAssociation>
......@@ -44,11 +46,11 @@
</scenarioAssociation>
<scenarioAssociation>
<field name="url">
<String>src/main/webapp/WEB-INF/stylesheets/db2xhtml.xsl</String>
<String>src/main/webapp/WEB-INF/tei-stylesheets/html/html.xsl</String>
</field>
<field name="scenarioIds">
<list>
<String>db2xhtml</String>
<String>epub – Anakreon flat</String>
</list>
</field>
<field name="scenarioTypes">
......@@ -59,11 +61,11 @@
</scenarioAssociation>
<scenarioAssociation>
<field name="url">
<String>src/main/webapp/WEB-INF/tei-stylesheets/html/html.xsl</String>
<String>src/main/webapp/WEB-INF/stylesheets/corpus2groups.xsl</String>
</field>
<field name="scenarioIds">
<list>
<String>epub – Anakreon flat</String>
<String>corpus2groups</String>
</list>
</field>
<field name="scenarioTypes">
......@@ -77,6 +79,89 @@
<entry>
<String>scenarios</String>
<scenario-array>
<scenario>
<field name="advancedOptionsMap">
<null/>
</field>
<field name="name">
<String>corpus2groups</String>
</field>
<field name="baseURL">
<String></String>
</field>
<field name="footerURL">
<String></String>
</field>
<field name="fOPMethod">
<String>pdf</String>
</field>
<field name="fOProcessorName">
<String>Apache FOP</String>
</field>
<field name="headerURL">
<String></String>
</field>
<field name="inputXSLURL">
<String>${pdu}/src/main/webapp/WEB-INF/stylesheets/corpus2groups.xsl</String>
</field>
<field name="inputXMLURL">
<String>${pdu}/Die_Gedichte_Anakreons.jmzg.0.xml</String>
</field>
<field name="defaultScenario">
<Boolean>false</Boolean>
</field>
<field name="isFOPPerforming">
<Boolean>false</Boolean>
</field>
<field name="type">
<String>XML</String>
</field>
<field name="saveAs">
<Boolean>true</Boolean>
</field>
<field name="openInBrowser">
<Boolean>false</Boolean>
</field>
<field name="outputFile">
<File>${pd}/target/anakreon-groups.xml</File>
</field>
<field name="openOtherLocationInBrowser">
<Boolean>false</Boolean>
</field>
<field name="locationToOpenInBrowserURL">
<null/>
</field>
<field name="openInEditor">
<Boolean>true</Boolean>
</field>
<field name="showInHTMLPane">
<Boolean>false</Boolean>
</field>
<field name="showInXMLPane">
<Boolean>true</Boolean>
</field>
<field name="showInSVGPane">
<Boolean>false</Boolean>
</field>
<field name="showInResultSetPane">
<Boolean>false</Boolean>
</field>
<field name="useXSLTInput">
<Boolean>true</Boolean>
</field>
<field name="xsltParams">
<list/>
</field>
<field name="cascadingStylesheets">
<String-array/>
</field>
<field name="xslTransformer">
<String>Saxon-PE</String>
</field>
<field name="extensionURLs">
<String-array/>
</field>
</scenario>
<scenario>
<field name="advancedOptionsMap">
<null/>
......@@ -414,7 +499,7 @@
<null/>
</field>
<field name="name">
<String>corpus2groups</String>
<String>db2xhtml-soll-haben</String>
</field>
<field name="baseURL">
<String></String>
......@@ -432,10 +517,10 @@
<String></String>
</field>
<field name="inputXSLURL">
<String>${pdu}/src/main/webapp/WEB-INF/stylesheets/corpus2groups.xsl</String>
<String>${pdu}/src/main/webapp/WEB-INF/stylesheets/db2xhtml.xsl</String>
</field>
<field name="inputXMLURL">
<String>${pdu}/Die_Gedichte_Anakreons.jmzg.0.xml</String>
<String>${pdu}/src/test/resources/n2kf.0.xml</String>
</field>
<field name="defaultScenario">
<Boolean>false</Boolean>
......@@ -450,10 +535,10 @@
<Boolean>true</Boolean>
</field>
<field name="openInBrowser">
<Boolean>false</Boolean>
<Boolean>true</Boolean>
</field>
<field name="outputFile">
<File>${pd}/target/anakreon-groups.xml</File>
<File>${pdu}/src/test/resources/n2kf.0.html</File>
</field>
<field name="openOtherLocationInBrowser">
<Boolean>false</Boolean>
......@@ -462,10 +547,10 @@
<null/>
</field>
<field name="openInEditor">
<Boolean>true</Boolean>
<Boolean>false</Boolean>
</field>
<field name="showInHTMLPane">
<Boolean>false</Boolean>
<Boolean>true</Boolean>
</field>
<field name="showInXMLPane">
<Boolean>true</Boolean>
......@@ -494,7 +579,7 @@
</scenario>
</scenario-array>
</entry>
</map>
</serializableOrderedMap>
</serialized>
</options>
</meta>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment