Commit 168db427 authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

cleanup

parent 9540e71e
# customized config files #
###########################
build.properties
local.build.properties
src/core/config.xql
# oxygen project file #
......@@ -12,6 +12,8 @@ cr_xq.xpr
src/repo.xml
src/expath-pkg.xml
build
dist-utils/antbuild/ivy/
dist-utils/antbuild/lib/
.DS_STORE
=======
......
[submodule "sample-projects/sade-textgrid-default-project"]
path = sample-projects/sade-textgrid-default-project
url = git@github.com:ubbo/sade-textgrid-default-project.git
About SADE
==========
# About SADE
The Scalable Architecture for Digital Editions (SADE) tries to meet the requirement for an easy to use publication system for electronic resources and Digital Editions. It is an attempt to provide a modular concept for publishing scholarly editions in a digital medium, based on open standards. Furthermore it is a distribution of open source software tools for the easy publication of Digital Editions and digitized texts in general out of the box. SADE is a scalable system that can be adapted by different projects which follow the TEI guidelines or other XML based formats.
This is the modified version for Fontane Notizbücher.
Build
=====
* Copy build.properties.default to build.properties and edit to your needs.
* Build the SADE modules for eXist with ant.
* Build the distribution zip file with build.sh from dist-utils.
Configuration
=============
The system strictly separates logic from content.
Within exist-db - following the current convention - all the code (and templates) is by default placed into
/db/apps/{app-name}
But individual projects are placed in a separate folder, which can/should be outside of the `/db/apps` collection.
By default it is:
/db/sade-projects
but it can be chosen freely, and only has to be set once in:
core/config.xql
more in docs/config.md, templating.md.
Setup steps:
1. Edit build.properties
app.name=cr-xq
app.uri=http://vronk.net/ns/cr-xq
app.version=0.3
projects.dir=cr-projects
during build they are used to generate
repo.template -> repo.xml
expath-pkg.template.xml -> expath-pkg.xml
$projects.dir + core/config.template.xql -> config.xql
2. ant generates an .xar package, that can be installed via package manager
upon installation
setup.xql is executed
which generates the projects.dir
and sets up the default project (as copy of the project.template-collection)
# Fontane-Build
* call `ant sade-dist-build` to build the latest supported eXist db and all SADE packages
* run `./dist-utils/antbuild/build/sade/bin/startup.sh`
* deploy the xar package from `SADE-Project-develop`
* deployment needs approx. 45 min due to republication of all the data. this is because the TEI documents needs to be stored from in memory, anything else will place whitespaces in the rendered xhtml output.
* there is fastdeploy build target that includes all non TEI-Data + Register and a single notebook (C07). deployment needs about 10 min.
* see http://localhost:8080/exist/apps/SADE/textgrid/index.html
## Tests
- [Markdown rendering](http://localhost:8080/exist/apps/SADE/textgrid/content.html?id=institutionen.md)
- [Dokuwiki (w/o reload)](http://localhost:8080/exist/apps/SADE/textgrid/doku.html)
- [Dokuwiki (w reload)](http://localhost:8080/exist/apps/SADE/textgrid/doku.html?id=gesamtdokumentation_ii._tei-header)
- [Image reload](http://localhost:8080/exist/apps/SADE/textgrid/doku.html?id=gesamtdokumentation_iii.3.21&reload)
- [Search](http://localhost:8080/exist/apps/SADE/textgrid/results.html?q=luther)
- [Literaturverzeichnis](http://localhost:8080/exist/apps/SADE/textgrid/literaturvz.html)
- [Register](http://localhost:8080/exist/apps/SADE/textgrid/register.html)
- [Auth on develop (see cookie)](http://localhost:8080/exist/apps/SADE/textgrid/edition.html?id=/xml/data/16b00.xml&page=)
- [TEI rendering](http://localhost:8080/exist/apps/SADE/textgrid/edition.html?id=/xml/data/16b00.xml&page=1r)
- [Cover](http://localhost:8080/exist/apps/SADE/textgrid/edition.html?id=/xml/data/16b00.xml&page=)
- [TBLE](http://localhost:8080/exist/apps/SADE/textgrid/edition.html?id=/xml/data/16b00.xml&page=60v)
- [single page]()
- [XML-View](http://localhost:8080/exist/apps/SADE/textgrid/xml.html?id=/xml/data/16b00.xml)
- [REST](http://localhost:8080/exist/apps/SADE/textgrid/rest/data/16b00.xml)
#Mon, 15 Apr 2013 13:42:45 +0200
# default build properties, create local.build.properties to override
app.name=SADE
app.uri=http://telota.de/sade
app.version=0.3
projects.dir=sade-projects
# set conf.overwrite to true if src/repo.xml, src/expath-pkg.xml and src/core/config.xql
# should be overwritten from their templates
conf.overwrite=false
<?xml version="1.0" encoding="UTF-8"?>
<project default="xar" name="packages">
<property file="local.build.properties"/>
<property file="build.properties"/>
<import file="build_docs.xml" />
<property name="build.dir" value="${basedir}/build"/>
<target name="xar">
<ant dir="src"/>
<!--ant dir="sample-projects"/-->
</target>
<target name="clean">
<delete dir="build"/>
</target>
<target name="sade-dist-build">
<ant antfile="dist-utils/antbuild/build.xml" inheritAll="false"/>
</target>
</project>
<project default="xar" name="SADE">
<xmlproperty file="expath-pkg.xml"/>
<property name="project.version" value="${package(version)}"/>
<property name="project.app" value="SADE"/>
<property name="build.dir" value="build"/>
<target name="xar">
<mkdir dir="${build.dir}"/>
<zip basedir="." destfile="${build.dir}/${project.app}-${project.version}.xar" excludes="${build.dir}/*"/>
</target>
</project>
\ No newline at end of file
<project name="gen-docs" default="init" basedir=".">
<description>
for generating various (auto)docs, jsdocs, xsl ...
</description>
<import file="build.xml" />
<!-- set global properties for this build -->
<property name="scripts.dir" location="."/>
<property name="in.dir" value="C:\Users\master\3RMA\suki\scripts"/>
<property name="in.file" location="."/>
<property name="out.file" location="out.txt"/>
<property name="temp.dir" value="zx_metares"/>
<property name="pattern" value="^[^z][^x]"/>
<property name="pattern2" value="."/>
<property name="style.dir" value="file:///C:/7utils/style"/>
<property name="other.build" location="."/>
<!-- *****************************
section: fs-management -->
<!--
perl scripts/merge_files.pl results/s2 results/s2/merged_meta_2.xml meta_.*xml mergedmeta2
-->
<target name="ay-xsl"
description="analyze set of stylesheets; status: usable except problem with NS on xinclude" >
<property name="out.dir" value="${in.dir}/${temp.dir}"/>
<property name="out.fn" value="stylesheets_xincl" />
<property name="file.prefix" value=".."/>
<mkdir dir="${out.dir}" />
<antcall target="fs2xinclude" >
<param name="pattern" value="^[^z][^x]" />
<param name="pattern2" value="^[^_].*\.xsl$" />
<param name="file.prefix" value="${file.prefix}" />
<param name="out.file" value="${out.dir}/${out.fn}_.xml" />
</antcall>
<xinclude2 in="${out.dir}/${out.fn}_.xml" out="${out.dir}/${out.fn}.xml" />
<saxon-xslt in="${out.dir}/${out.fn}.xml" out="${out.dir}/${out.fn}.html" style="${scripts.dir}/misc/xsl2xhtml.xsl" >
<param name="style_dir" expression="${style.dir}"/>
</saxon-xslt>
<!-- <param name="file_name" expression="xsl2xhtml.xsl" />-->
<antcall target="gen-dep-graph" >
<param name="work.dir" value="${out.dir}"/>
<param name="in.file" value="${out.dir}/${out.fn}.xml"/>
</antcall>
</target>
<target name="gen-dep-graph-each"
description="generate a dep-graph for each xsl separately" >
<property name="out.dir" value="${in.dir}/${temp.dir}"/>
<property name="out.fn" value="stylesheets_xincl" />
<property name="file.prefix" value=".."/>
<!-- inheritall="true"-->
<foreach target="gen-dep-graph" param="in.file" >
<fileset dir="${in.dir}" casesensitive="yes">
<include name="**/*.xsl"/>
<exclude name="zx_*"/>
</fileset>
</foreach>
</target>
<target name="gen-dep-graph" description="generate a graph of xsl file. status: started 20091218" >
<!--<ant2svg destfile="build_graph.svg"/> -->
<property name="work.dir" value="${out.dir}" />
<property name="in.file" value="${work.dir}/${in.fn}.xsl" />
<basename property="out.fn_" file="${in.file}"/>
<property name="out.fn" value="${out.fn_}" />
<property name="title" value="${in.file}" />
<!--<saxon-xslt in="${work.dir}/${in.file}" out="${work.dir}/${out.fn}.dot"-->
<saxon-xslt in="${in.file}" out="${work.dir}/${out.fn}.dot"
style="${scripts.dir}/misc/xsl2dot.xsl"
filenameparameter="fn" >
<param name="fn" expression="${out.fn}"/>
<param name="title" expression="${title}"/>
<param name="parts" expression="${parts}"/>
</saxon-xslt>
<exec executable="dot">
<arg value="${work.dir}/${out.fn}.dot" />
<arg value="-o${work.dir}/${out.fn}.png"/>
<arg value="-Tpng"/>
</exec>
</target>
<target name="gen-xq-graph-all"
description="analyze set of xq files" >
<property name="out.dir" value="${in.dir}/${temp.dir}"/>
<property name="out.fn" value="xq-call-graph" />
<property name="file.prefix" value=".."/>
<mkdir dir="${out.dir}" />
<antcall target="fs2xinclude" >
<param name="pattern" value="^[^z][^x]" />
<param name="pattern2" value="^[^_].*\.xq.?$" />
<param name="file.prefix" value="${file.prefix}" />
<param name="out.file" value="${out.dir}/${out.fn}_.xml" />
</antcall>
<xinclude2 in="${out.dir}/${out.fn}_.xml" out="${out.dir}/${out.fn}.xml" />
<antcall target="gen-xq-graph" >
<param name="in.file" value="${out.dir}/${out.fn}.xml"/>
<param name="out.fn" value="${out.fn}"/>
<param name="parts" value="imports"/>
</antcall>
</target>
<!-- expects propertY: in.file -->
<target name="gen-xq-graph"
description="analyze set of xq files" >
<property name="in.file" value="${out.dir}/${out.fn}.xml"></property>
<!-- parsing out the file name from the in.file-path -->
<propertyregex property="out.fn2" input="${in.file}" regexp="(.*)[\/\\]([^\.\/\\]*)\.?(.*)"
select="\2" defaultvalue="${out.fn}" override="true"/>
<propertyregex property="title" input="${in.file}" regexp="(.*)[\/\\]([^\.\/\\]*)\.?(.*)"
select="\2_\3" defaultvalue="${out.fn}" override="true"/>
<!--python C:/Users/m/3/7utils/autodocs/xql-calls_v2.py
C:\Users\m\3\corpus_shell\_repo\sade\docs\xqdocs\cr-xq-calls.xml
"cr-xq imports" > C:\Users\m\3\corpus_shell\_repo\sade\docs\xqdocs\cr-xq-imports.dot-->
<echo>starting python extract from: ${in.file} with parts: ${parts}</echo>
<exec executable="python" output="${out.dir}/${out.fn2}.dot" errorproperty="python-error">
<arg value="${scripts.dir}/autodocs/xql-calls_v2.py" />
<arg value="${in.file}" />
<arg value="${title}" />
<arg value="${parts}" />
</exec>
<echo>${python-error}</echo>
<echo>starting dot transform: ${out.dir}/${out.fn2}.png</echo>
<exec executable="dot">
<arg value="${out.dir}/${out.fn2}.dot" />
<arg value="-o${out.dir}/${out.fn2}.png"/>
<arg value="-Tpng"/>
</exec>
</target>
<target name="gen-xq-graph-each"
description="generate a call-graph for each xquery file separately" >
<property name="out.dir" value="${in.dir}/${temp.dir}"/>
<property name="file.prefix" value=".."/>
<!-- inheritall="true"-->
<foreach target="gen-xq-graph" param="in.file" >
<param name="parts" value="imports, calls"></param>
<fileset dir="${in.dir}" casesensitive="yes">
<include name="**/*.xq*"/>
<exclude name="zx_*"/>
</fileset>
</foreach>
</target>
<!-- problems with jsdoc-ant-tasks: https://github.com/jannon/jsdoc3-ant-task/issues/4 [2013-01-17] -->
<!--<property name="jsdoc.home" location="C:\Users\m\3\external\_repo\jsdoc\"/>
<property name="jsdoc3-task-jar" location="C:\Users\m\3\external\_repo\jsdoc3-ant-task\build\jar\jsdoc3-ant-task-1.0.jar"/>
<property name="rhino-jar" location="C:\Users\m\3\external\_repo\jsdoc3-ant-task\lib\rhino\js-1.7r3_jsdoc.jar"/> -->
<!-- <property name="jsdoc.home" value="_repo/jsdoc"/>
<property name="jsdoc3-task-jar" value="../jsdoc3-ant-task/build/jar/jsdoc3-ant-task-1.0.jar"/>
<property name="rhino-jar" value="rhino/js.jar"/>
-->
<!-- <taskdef name="jsdoc" classname="net.jannon.ant.tasks.JsDoc3" classpath="${jsdoc3-task-jar}:${rhino-jar}"/> -->
<target name="gen-jsdoc" >
<!-- <jsdoc jsdochome="${jsdoc.home}" to="${docs.dir}" dir="${src.dir}" /> -->
<property name="jsdoc-full-path"
location="C:/Users/m/3/external/_repo/jsdoc/jsdoc.cmd"/>
<exec executable="${jsdoc-full-path}" >
<arg line="-d ${docs.dir} ${src.dir}"/>
</exec>
</target>
<!--
c:\apps\Python33>python Scripts/rst2html.py C:\Users\m\3\clarin\_repo\SMC\docs\userdocs.rst C:\Users\m\3\clarin\_repo\SMC\docs\userdocs.html
-->
<target name="rst2html" >
<property name="rst2html-path"
location="Scripts\rst2html.py"/>
<exec executable="c:\apps\Python33\python.exe" dir="c:\apps\Python33\" >
<arg line="Scripts\rst2html.py --stylesheet ${stylesheet} --link-stylesheet ${src.file} ${out.file}"/>
</exec>
</target>
<target name="rst2s5" >
<property name="rst2s5-path"
location="Scripts\rst2s5.py"/>
<exec executable="c:\apps\Python33\python.exe" dir="c:\apps\Python33\" >
<arg line="Scripts\rst2s5.py --stylesheet ${stylesheet} --link-stylesheet ${src.file} ${out.file}"/>
</exec>
</target>
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
</project>
\ No newline at end of file
<?xml version="1.0"?>
<!-- ======================================================================
Date: 2013-01
Project: corpus_shell
====================================================================== -->
<project name="cr-xq autdocs" basedir=".">
<description>
targets for corpus_shell
</description>
<!-- <property name="cache.dir" value="data2" />-->
<!-- <property name="out.dir" value="output" />-->
<property name="docs.dir" value="docs" />
<property name="xsl.dir" value="xsl/" />
<property name="scripts.dir" location="build/scripts"/>
<!-- <import file="${scripts.dir}\build.xml" /> -->
<target name="gen-docs" depends="gen-build-info,gen-jsdocs">
</target>
<target name="gen-jsdocs" >
<ant antfile="${scripts.dir}\build_docs.xml" target="gen-jsdoc">
<property name="src.dir" location="scripts/js/query_input/qi.js" />
<property name="docs.dir" location="docs/js/query_input"/>
</ant>
</target>
<target name="gen-jsdocs2" >
<ant antfile="${scripts.dir}\build_docs.xml" target="gen-jsdoc">
<property name="src.dir" location="../../code/fromMDService2/scripts/" />
<property name="docs.dir" location="../../code/fromMDService2/docs"/>
</ant>
</target>
<target name="gen-xsldocs" >
<property name="out.fn" value="c_s-xsl"></property>
<ant antfile="${scripts.dir}\build_docs.xml" target="ay-xsl">
<property name="in.dir" location="${xsl.dir}" />
<property name="file.prefix" value="../.." />
<property name="title" value="${out.fn}" />
<property name="parts" value="imports, params, templates, functions" />
<property name="out.dir" location="${docs.dir}/xsltdocs"/>
<property name="out.fn" value="${out.fn}"/>
</ant>
<ant antfile="${scripts.dir}\build_docs.xml" target="gen-dep-graph">
<property name="work.dir" location="${docs.dir}/xsltdocs" />
<property name="in.file" value="${docs.dir}/xsltdocs/${out.fn}.xml"/>
<property name="title" value="${out.fn}-imports" />
<property name="parts" value="imports" />
<property name="out.fn" value="${out.fn}-imports"/>
</ant>
<ant antfile="${scripts.dir}\build_docs.xml" target="gen-dep-graph-each">
<property name="in.dir" location="${xsl.dir}" />
<property name="parts" value="imports, params, templates, functions" />
<property name="work.dir" location="${docs.dir}/xsltdocs/xslts"/>
</ant>
</target>
<target name="gen-xqdocs" >
<property name="out.fn" value="cr-xq-calls"></property>
<property name="out.dir" value="${docs.dir}/xqdocs/graph"></property>
<ant antfile="${scripts.dir}\build_docs.xml" target="gen-xq-graph-all">
<property name="in.dir" location="src" />
<property name="title" value="${out.fn}" />
<property name="file.prefix" value="../../.." />
<!-- <property name="parts" value="imports, params, templates, functions" />-->
<property name="out.dir" location="${out.dir}"/>
<property name="out.fn" value="${out.fn}"/>
</ant>
<echo>generating graph without utils</echo>
<copy file="${out.dir}/${out.fn}.dot" tofile="${out.dir}/${out.fn}_noUtils.dot" force="true">
<filterchain>
<linecontains negate="true">
<contains value="repo_utils"/>
</linecontains>
<linecontains negate="true">
<contains value="config"/>
</linecontains>
</filterchain>
</copy>
<exec executable="dot">
<arg value="${out.dir}/${out.fn}_noUtils.dot" />
<arg value="-o${out.dir}/${out.fn}_noUtils.svg"/>
<arg value="-Tsvg"/>
</exec>
<exec executable="dot">
<arg value="${out.dir}/${out.fn}_noUtils.dot" />
<arg value="-o${out.dir}/${out.fn}_noUtils.png"/>
<arg value="-Tpng"/>
</exec>
<!--
<echo>generating a separate graph for each module</echo>
<ant antfile="${scripts.dir}\build_docs.xml" target="gen-xq-graph-each">
<property name="in.dir" location="src" />
<property name="title" value="${out.fn}" />
<property name="file.prefix" value="../../.." />
<!-\- <property name="parts" value="imports, params, templates, functions" />-\->
<property name="out.dir" location="${out.dir}"/>
<property name="out.fn" value="${out.fn}"/>
</ant>
-->
</target>
<target name="gen-build-info" >
<ant antfile="${scripts.dir}\build.xml" target="gen-build-info">
<property name="in.dir" location="" />
<property name="other.build" value="build"/>
<property name="out.dir" location="docs"/>
</ant>
</target>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<collection xmlns="http://exist-db.org/collection-config/1.0">
<index xmlns:xs="http://www.w3.org/2001/XMLSchema">
<fulltext default="none" attributes="false"/>
</index>
<triggers>
<trigger class="org.exist.extensions.exquery.restxq.impl.RestXqTrigger"/>
</triggers>
</collection>
\ No newline at end of file
xquery version "3.1";
import module namespace config="http://textgrid.de/ns/SADE/config" at "modules/config/config.xqm";
import module namespace digilib="http://textgrid.info/namespaces/xquery/digilib" at "../textgrid-connect/digilibProxy.xqm";
declare variable $exist:path external;
declare variable $exist:resource external;
declare variable $exist:controller external;
declare variable $exist:prefix external;
declare variable $exist:root external;
let $project := tokenize( $exist:path, "/" )[. != ""][not(ends-with(., "html"))][1]
let $listproject := config:list-projects()[1]
return
(: forward requests without resources to index.html :)
if ($exist:path eq '') then
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<redirect url="{request:get-uri()}/"/>
</dispatch>
(: forward requests without project to the first project listed :)
else if (empty($project)) then
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<redirect url="{config:list-projects()[1]}/index.html"/>
</dispatch>
(: forward requests without resources to index.html :)
else if (ends-with($exist:path, "/") or empty($exist:resource)) then
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<redirect url="index.html"/>
</dispatch>
(: forward REST requests to data collection of the project:)
else if (tokenize($exist:path, '/') = "rest") then
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<forward url="/../sade-projects/{$project}/data/xml/{substring-after($exist:path, "/rest/")}"/>
</dispatch>
(: forward DIGILIB requests to the proxy function :)
else if (tokenize($exist:path, '/') = "digilib") then
let $path := tokenize($exist:path, '/'),
$id := $path[last()],
$if-modified-since := request:get-header("if-modified-since")
return
digilib:proxy($project, $id, $if-modified-since)
(: the important stuff :)
else if (ends-with($exist:resource, ".html")) then
let $doc-path := $config:projects-dir || $project || config:get("template") || $exist:resource
return
(: the html page is run through view.xql to expand templates :)
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<!--view-->
<forward url="{$exist:controller}/modules/view.xql" method="get">
<add-parameter name="doc-path" value="{$doc-path}"/>
</forward>
<!--/view-->
<error-handler>
<forward url="{$exist:controller}/error-page.html" method="get"/>
<forward url="{$exist:controller}/modules/view.xql"/>
</error-handler>
</dispatch>
(: resource paths starting with $shared are loaded from the shared-resources app :)
else if (contains($exist:path, "/$shared/")) then
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<forward url="/shared-resources/{substring-after($exist:path, '/$shared/')}">
<set-header name="Cache-Control" value="max-age=3600, must-revalidate"/>
</forward>
</dispatch>
else
(: check if the resource comes from the template or the data
we try to leave the template manipulation as minimal as
possible
:)
let $path := "/../sade-projects/"|| $project || "/" || config:get("data-dir") || "/" || substring-after($exist:path, $project)
let $path := if( doc-available( $path ) ) then $path else "/../sade-projects/"|| $project || config:get("template") || substring-after($exist:path, $project)
return
<dispatch xmlns="http://exist.sourceforge.net/NS/exist">
<cache-control cache="yes"/>
<forward url="{$path}">
<set-header name="Cache-Control" value="max-age=3600, must-revalidate"/>
</forward>
</dispatch>
Build script for SADE distribution
==================================
The script build.sh should assemble a SADE instance. Run "build.sh -h" for help.
The following tools need to be installed:
- wget
- tar
- unzip
- svn
- java
- sed
- maven
- ant
- zip (optional)
<?xml version="1.0" encoding="UTF-8"?>
<project
basedir="."
default="build"
name="SADE"
xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:git="antlib:com.rimerosolutions.ant.git">
<property name="build.dir" value="${basedir}/build"/>
<property name="resources.dir" value="${basedir}/resources"/>
<property name="ivy.install.version" value="2.3.0"/>
<property name="ivy.jar.dir" value="${basedir}/lib"/>
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>
<property name="exist.git" value="https://github.com/eXist-db/exist.git"/>
<property name="exist.tag" value="eXist-2.2"/>
<!-- <property name="exist.branch" value="00db4c3d9538337b705f7f30c98ba4a54bf05227" /> -->
<property name="exist.dest" value="${build.dir}/exist-git"/>
<property name="exist.dist" value="${exist.dest}/dist/eXist-db-2.2"/>
<property name="sade.src" value="../../"/>
<!-- <property name="markdown.git" value="https://github.com/wolfgangmm/exist-markdown.git"/> -->
<!-- <property name="markdown.dest" value="${build.dir}/exist-markdown"/> -->