Skip to content

Instantly share code, notes, and snippets.

View eerohele's full-sized avatar
🐺

Eero Helenius eerohele

🐺
View GitHub Profile
#!/bin/bash
main() {
local dita_home="$HOME/Git/dita-ot/src/main"
local input="$PWD/dita-1.2-specification.ditamap"
local classpath="$dita_home/lib/ant-apache-resolver-1.9.4.jar"
classpath=$classpath:"$dita_home/lib/ant-launcher.jar"
classpath=$classpath:"$dita_home/lib/ant.jar"
classpath=$classpath:"$dita_home/lib/commons-codec-1.9.jar"
@eerohele
eerohele / MySpecification.scala
Created May 30, 2016 19:00
Testing XSLT with Scala and specs2
object Fixtures {
val Stylesheet = new File("/opt/dita-ot/xsl/preprocess/conrefImpl.xsl")
}
class MySpecification extends XsltSpecification(Fixtures.Stylesheet) {
"@conref to existing element is resolved" >> {
becomes(
<p domains="(topic hi-d)" conref="a.dita#b/c"/>,
<p domains="(topic hi-d)">d</p>,
MockFile("a.dita",
@eerohele
eerohele / assert.xq
Last active May 27, 2016 21:19
"Unit testing" XSLT with XQuery and Saxon
declare namespace saxon="http://saxon.sf.net/";
declare option saxon:output "method=xml";
declare option saxon:output "indent=yes";
declare option saxon:output "omit-xml-declaration=yes";
(: Requires Saxon-PE or Saxon-EE, unfortunately. :)
declare variable $stylesheet := local:prepare-stylesheet("test.xsl");
@eerohele
eerohele / identity.xsl
Last active May 11, 2016 10:18
Saxon-J 9.1.0.8 vs Saxon-EE 9.7.0.4
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
@eerohele
eerohele / 185.log
Created March 12, 2016 22:24
Profile logs for Oxygen User Manual DITA-OT v1.8.5 vs. v2.2.2
This file has been truncated, but you can view the full file.
property: started Sun Mar 13 00:18:02 EET 2016
property: finished Sun Mar 13 00:18:03 EET 2016 (706ms)
dirname: started Sun Mar 13 00:18:03 EET 2016
dirname: finished Sun Mar 13 00:18:03 EET 2016 (2ms)
condition: started Sun Mar 13 00:18:03 EET 2016
@eerohele
eerohele / build.gradle
Last active March 4, 2016 17:14
Gradle DefaultIsolatedAntBuilder PermGen Leak
// Enable the Gradle daemon and run this until failure:
// while gradle --rerun-tasks; do :; done
import org.gradle.api.internal.ClassPathRegistry
import org.gradle.api.internal.DefaultClassPathProvider
import org.gradle.api.internal.DefaultClassPathRegistry
import org.gradle.api.internal.classpath.DefaultModuleRegistry
import org.gradle.api.internal.classpath.ModuleRegistry
import org.gradle.api.internal.project.antbuilder.DefaultIsolatedAntBuilder
import org.gradle.internal.classloader.DefaultClassLoaderFactory
@eerohele
eerohele / settings.gradle
Last active March 7, 2016 11:26
Run Gradle root project from any subdirectory
// Save this as settings.gradle in the project root directory
startParameter.setBuildFile(new File(rootDir, 'build.gradle'))
@eerohele
eerohele / prompt_lambda_setup
Last active December 7, 2015 08:52
my zprezto prompt
function prompt_lambda_precmd {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
prompt_lambda_pwd
# Get Git repository information.
if (( $+functions[git-info] )); then
git-info
fi
@eerohele
eerohele / main.xsl
Created November 24, 2015 07:58
DITA-OT issue #2146
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="*[contains(@class, ' topic/topic ')]">
<xsl:message terminate="yes">
<xsl:call-template name="getVariable">
<xsl:with-param name="id" select="'Warning'"/>
</xsl:call-template>
</xsl:message>
@eerohele
eerohele / has-class.clj
Created November 20, 2015 17:53
Defining a Saxon integrated extension function in Clojure
; Define a Saxon integrated extension function that checks whether
; the given element has the given DITA class.
;
; For example, given:
;
; <topic id="topic" class="- topic/topic "> ... </topic>
;
; This XPath function, when defined and aliased under the "dita"
; namespace prefix, will return true for that element:
;