-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only working task so far is to generate a preview version of a given article.
- Loading branch information
Showing
3 changed files
with
77 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<build> | ||
<!-- The directory to which the static site content is written. --> | ||
<toDir>../dhq-static</toDir> | ||
|
||
<!-- The directory in which HTML articles are saved for previewing. Note that if | ||
you change this value, you may also have to change the "assets-path" parameter | ||
value in build.xml's "previewArticle" target. --> | ||
<previewDir>dhq-preview</previewDir> | ||
|
||
<!-- The XSLT processor to use. --> | ||
<processor> | ||
<name>net.sf.saxon.TransformerFactoryImpl</name> | ||
<location>common/lib/saxon-he-11.5.jar</location> | ||
</processor> | ||
|
||
</build> |
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,59 @@ | ||
<project xmlns:if="ant:if" xmlns:unless="ant:unless" | ||
default="previewArticle" | ||
name="dhq"> | ||
|
||
<!-- | ||
Apache Ant buildfile for Digital Humanities Quarterly. | ||
--> | ||
|
||
<!-- | ||
PROPERTIES | ||
--> | ||
<!-- See build-properties.xml for the settings used in this file. When referenced, | ||
properties look like this: | ||
${toDir} | ||
For more information, see https://ant.apache.org/manual/Tasks/xmlproperty.html --> | ||
<xmlproperty file="build-properties.xml" keepRoot="false"/> | ||
|
||
|
||
<!-- | ||
ANT TASKS | ||
--> | ||
|
||
<!-- Generate a static version of the website. --> | ||
<target name="generateSite"><!-- TODO --> | ||
<mkdir dir="${toDir}"/> | ||
<echo message="${toDir}"/> | ||
</target> | ||
|
||
<target name="previewArticle"> | ||
<!-- If the 'article.id' property wasn't already set using the command line, Ant | ||
will prompt for it. --> | ||
<input unless:set="article.id" | ||
message="Please give the ID of the article you want to view:" | ||
addproperty="article.id"/> | ||
<!-- Test the 'article.id' property to make sure it has 6 digits and doesn't | ||
start with '9'. --> | ||
<condition property="article.id.ok" value="${article.id}"> | ||
<matches string="${article.id}" pattern="^[0-8]\d{5,5}$"/> | ||
</condition> | ||
<fail unless="article.id.ok" | ||
message="An article ID must be 6 digits long. It must not start with '9'"/> | ||
<!-- If it doesn't exist yet, create the preview directory specified in | ||
build-properties.xml. --> | ||
<mkdir dir="${previewDir}"/> | ||
<!-- Transform the article with XSLT. --> | ||
<xslt in="articles/${article.id}/${article.id}.xml" | ||
out="${previewDir}/${article.id}.html" | ||
style="common/xslt/template_article.xsl" | ||
classpath="${processor.location}" | ||
force="true" | ||
failonerror="false"> | ||
<factory name="${processor.name}"/> | ||
<param name="context" expression="dhq"/> | ||
<param name="assets-path" expression="../"/> | ||
</xslt> | ||
<echo message="Created article preview at ${previewDir}/${article.id}.html"/> | ||
</target> | ||
|
||
</project> |