summaryrefslogtreecommitdiffstats
path: root/org/madore/damlengine
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2011-08-26 16:53:03 +0200
committerDavid A. Madore <david+git@madore.org>2011-08-26 16:53:03 +0200
commit961bdfc66151b9aef46149e4730110ef409e5587 (patch)
tree4b6ad9a0e8253905af8d8f838ef2668fec4bfc0e /org/madore/damlengine
parent7d3f4db185f5499160228afb228ecac6c6d22476 (diff)
downloaddamlengine-961bdfc66151b9aef46149e4730110ef409e5587.tar.gz
damlengine-961bdfc66151b9aef46149e4730110ef409e5587.tar.bz2
damlengine-961bdfc66151b9aef46149e4730110ef409e5587.zip
Move most of the context to a "general context" substructure.
This is so as to make sure that cloning (which does a shallow copy) gives us references to the same mutable content.
Diffstat (limited to 'org/madore/damlengine')
-rw-r--r--org/madore/damlengine/Context.java34
-rw-r--r--org/madore/damlengine/TodoBodyElement.java6
-rw-r--r--org/madore/damlengine/TodoComments.java10
-rw-r--r--org/madore/damlengine/TodoDamlElement.java60
-rw-r--r--org/madore/damlengine/TodoEmailAtOrDotElement.java2
-rw-r--r--org/madore/damlengine/TodoEntryElement.java2
-rw-r--r--org/madore/damlengine/TodoExtraStyleOrScriptElement.java4
-rw-r--r--org/madore/damlengine/TodoFooter.java4
-rw-r--r--org/madore/damlengine/TodoNavbar.java6
-rw-r--r--org/madore/damlengine/TodoSmileyElement.java2
-rw-r--r--org/madore/damlengine/TodoStyleOrScript.java8
-rw-r--r--org/madore/damlengine/TodoSubtitleElement.java10
-rw-r--r--org/madore/damlengine/TodoTitleElement.java14
-rw-r--r--org/madore/damlengine/TodoTitleOrSubtitle.java4
-rw-r--r--org/madore/damlengine/TodoTranslationElement.java6
-rw-r--r--org/madore/damlengine/TodoTranslations.java6
16 files changed, 92 insertions, 86 deletions
diff --git a/org/madore/damlengine/Context.java b/org/madore/damlengine/Context.java
index 22912a7..f5d12bf 100644
--- a/org/madore/damlengine/Context.java
+++ b/org/madore/damlengine/Context.java
@@ -6,19 +6,24 @@ import org.w3c.dom.*;
public class Context implements Cloneable {
public final Document doc;
- public Element htmlNode;
- public Element headNode;
- public String uriToTop;
- public String fileName;
- public StringBuffer styleContent;
- public StringBuffer scriptContent;
- public DocumentFragment title;
- public String titleStr;
- public String titleLang;
- public DocumentFragment subtitle;
- public String subtitleStr;
- public String subtitleLang;
- public ArrayList<String> translations;
+
+ public static class GeneralContext {
+ public Element htmlNode;
+ public Element headNode;
+ public String uriToTop;
+ public String fileName;
+ public StringBuffer styleContent;
+ public StringBuffer scriptContent;
+ public DocumentFragment title;
+ public String titleStr;
+ public String titleLang;
+ public DocumentFragment subtitle;
+ public String subtitleStr;
+ public String subtitleLang;
+ public ArrayList<String> translations;
+ }
+
+ public GeneralContext gc;
public static class EntryContext {
public String year;
@@ -37,10 +42,11 @@ public class Context implements Cloneable {
}
}
- public EntryContext entryCtx;
+ public EntryContext ent;
public Context(Document doc) {
this.doc = doc;
+ this.gc = new GeneralContext();
}
public Context clone() {
diff --git a/org/madore/damlengine/TodoBodyElement.java b/org/madore/damlengine/TodoBodyElement.java
index fd75b89..4286aa0 100644
--- a/org/madore/damlengine/TodoBodyElement.java
+++ b/org/madore/damlengine/TodoBodyElement.java
@@ -36,7 +36,7 @@ public final class TodoBodyElement extends TodoDefaultElement {
ArrayList<Node> childList = getChildList(this.node);
ArrayList<TodoElement> toProcess = new ArrayList<TodoElement>(childList.size()+8);
if ( node.getAttributeNS(null, "notitle").equals("")
- && ctx.title != null ) {
+ && ctx.gc.title != null ) {
Element token = ctx.doc.createElementNS(DamlEngine.DAML_NS,
"d:implicit-do-title");
bodyNode.appendChild(ctx.doc.createTextNode("\n"));
@@ -45,7 +45,7 @@ public final class TodoBodyElement extends TodoDefaultElement {
token, this.ctx, this));
}
if ( node.getAttributeNS(null, "nosubtitle").equals("")
- && ctx.subtitle != null ) {
+ && ctx.gc.subtitle != null ) {
Element token = ctx.doc.createElementNS(DamlEngine.DAML_NS,
"d:implicit-do-subtitle");
bodyNode.appendChild(ctx.doc.createTextNode("\n"));
@@ -61,7 +61,7 @@ public final class TodoBodyElement extends TodoDefaultElement {
toProcess.add(new TodoNavbar(token, this.ctx, this));
}
if ( node.getAttributeNS(null, "notranslations").equals("")
- && ctx.translations != null ) {
+ && ctx.gc.translations != null ) {
Element token = ctx.doc.createElementNS(DamlEngine.DAML_NS,
"d:implicit-do-translations");
bodyNode.appendChild(ctx.doc.createTextNode("\n"));
diff --git a/org/madore/damlengine/TodoComments.java b/org/madore/damlengine/TodoComments.java
index e1dd027..85ce7d3 100644
--- a/org/madore/damlengine/TodoComments.java
+++ b/org/madore/damlengine/TodoComments.java
@@ -37,20 +37,20 @@ public final class TodoComments extends TodoElement {
p.setAttributeNS(null, "class", "talkback-link");
node.getParentNode().replaceChild(p, node);
Element a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a");
- if ( ctx.entryCtx == null )
+ if ( ctx.ent == null )
throw new IllegalStateException("entry context not defined in comments element");
String commentURL = "http://www.madore.org/cgi-bin/comment.pl/"
+ "showcomments?href=http%3a%2f%2fwww.madore.org%2f"
+ "%7edavid%2fweblog%2f"
- + ctx.entryCtx.yandm + ".html%23d." + ctx.entryCtx.date
- + "." + ctx.entryCtx.number;
+ + ctx.ent.yandm + ".html%23d." + ctx.ent.date
+ + "." + ctx.ent.number;
a.setAttributeNS(null, "href", commentURL);
p.appendChild(a);
a.appendChild(ctx.doc.createTextNode(linkNameTable.get(lang)));
Element span = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "span");
span.setAttributeNS(null, "id",
- "d." + ctx.entryCtx.date + "."
- + ctx.entryCtx.number + ".numcomments");
+ "d." + ctx.ent.date + "."
+ + ctx.ent.number + ".numcomments");
p.appendChild(span);
span.appendChild(ctx.doc.createComment(" EMPTY "));
}
diff --git a/org/madore/damlengine/TodoDamlElement.java b/org/madore/damlengine/TodoDamlElement.java
index 7e0faee..31e7357 100644
--- a/org/madore/damlengine/TodoDamlElement.java
+++ b/org/madore/damlengine/TodoDamlElement.java
@@ -31,44 +31,44 @@ public final class TodoDamlElement extends TodoDefaultElement {
throw new IllegalArgumentException("daml node can only be root node");
final String uriToTopName = "uri-to-top";
if ( node.hasAttributeNS(null, uriToTopName) )
- ctx.uriToTop = node.getAttributeNS(null, uriToTopName);
+ ctx.gc.uriToTop = node.getAttributeNS(null, uriToTopName);
final String fileNameName = "file.name";
if ( node.hasAttributeNS(null, fileNameName) )
- ctx.fileName = node.getAttributeNS(null, fileNameName);
+ ctx.gc.fileName = node.getAttributeNS(null, fileNameName);
- if ( ctx.htmlNode != null )
+ if ( ctx.gc.htmlNode != null )
throw new IllegalStateException("html node already defined at daml node");
- ctx.htmlNode = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "html");
+ ctx.gc.htmlNode = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "html");
String lang = LangHelper.getLangNorec(node);
if ( lang != null )
- LangHelper.setLangNorec(ctx.htmlNode, lang);
- node.getParentNode().replaceChild(ctx.htmlNode, node);
- ctx.htmlNode.appendChild(ctx.doc.createTextNode("\n"));
- ctx.htmlNode.appendChild(ctx.doc.createComment(" This file is automatically generated. Do not edit! "));
- ctx.htmlNode.appendChild(ctx.doc.createTextNode("\n"));
- if ( ctx.headNode != null )
+ LangHelper.setLangNorec(ctx.gc.htmlNode, lang);
+ node.getParentNode().replaceChild(ctx.gc.htmlNode, node);
+ ctx.gc.htmlNode.appendChild(ctx.doc.createTextNode("\n"));
+ ctx.gc.htmlNode.appendChild(ctx.doc.createComment(" This file is automatically generated. Do not edit! "));
+ ctx.gc.htmlNode.appendChild(ctx.doc.createTextNode("\n"));
+ if ( ctx.gc.headNode != null )
throw new IllegalStateException("head node already defined at daml node");
- ctx.headNode = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "head");
- ctx.htmlNode.appendChild(ctx.headNode);
- ctx.htmlNode.appendChild(ctx.doc.createTextNode("\n"));
- ctx.headNode.appendChild(ctx.doc.createTextNode("\n"));
+ ctx.gc.headNode = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "head");
+ ctx.gc.htmlNode.appendChild(ctx.gc.headNode);
+ ctx.gc.htmlNode.appendChild(ctx.doc.createTextNode("\n"));
+ ctx.gc.headNode.appendChild(ctx.doc.createTextNode("\n"));
- ctx.styleContent = new StringBuffer();
+ ctx.gc.styleContent = new StringBuffer();
try {
Reader rd = new BufferedReader(new InputStreamReader(DamlEngine.class.getResourceAsStream("included.css"), "UTF-8"));
int ch;
while ((ch = rd.read()) > -1)
- ctx.styleContent.append((char)ch);
+ ctx.gc.styleContent.append((char)ch);
rd.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
- ctx.scriptContent = new StringBuffer();
+ ctx.gc.scriptContent = new StringBuffer();
try {
Reader rd = new BufferedReader(new InputStreamReader(DamlEngine.class.getResourceAsStream("included.js"), "UTF-8"));
int ch;
while ((ch = rd.read()) > -1)
- ctx.scriptContent.append((char)ch);
+ ctx.gc.scriptContent.append((char)ch);
rd.close();
} catch (IOException e) {
throw new RuntimeException(e);
@@ -78,33 +78,33 @@ public final class TodoDamlElement extends TodoDefaultElement {
meta = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "meta");
meta.setAttributeNS(null, "http-equiv", "Content-Type");
meta.setAttributeNS(null, "content", "text/html; charset=utf-8");
- ctx.headNode.appendChild(meta);
- ctx.headNode.appendChild(ctx.doc.createTextNode("\n"));
+ ctx.gc.headNode.appendChild(meta);
+ ctx.gc.headNode.appendChild(ctx.doc.createTextNode("\n"));
if ( lang != null ) {
meta = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "meta");
meta.setAttributeNS(null, "http-equiv", "Content-Language");
meta.setAttributeNS(null, "content", lang);
- ctx.headNode.appendChild(meta);
- ctx.headNode.appendChild(ctx.doc.createTextNode("\n"));
+ ctx.gc.headNode.appendChild(meta);
+ ctx.gc.headNode.appendChild(ctx.doc.createTextNode("\n"));
}
meta = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "link");
meta.setAttributeNS(null, "rel", "Shortcut Icon");
- meta.setAttributeNS(null, "href", (((ctx.uriToTop!=null)?ctx.uriToTop:"")
+ meta.setAttributeNS(null, "href", (((ctx.gc.uriToTop!=null)?ctx.gc.uriToTop:"")
+"favicon.ico"));
- ctx.headNode.appendChild(meta);
- ctx.headNode.appendChild(ctx.doc.createTextNode("\n"));
+ ctx.gc.headNode.appendChild(meta);
+ ctx.gc.headNode.appendChild(ctx.doc.createTextNode("\n"));
ArrayList<Node> childList = getChildList(this.node);
ArrayList<TodoElement> toProcess = new ArrayList<TodoElement>(childList.size());
for ( Node child : childList ) {
if ( child.getNodeType() == Node.ELEMENT_NODE ) {
if ( child.getLocalName().equals("body") ) {
- ctx.htmlNode.appendChild(ctx.doc.createTextNode("\n"));
- ctx.htmlNode.appendChild(child);
- ctx.htmlNode.appendChild(ctx.doc.createTextNode("\n"));
+ ctx.gc.htmlNode.appendChild(ctx.doc.createTextNode("\n"));
+ ctx.gc.htmlNode.appendChild(child);
+ ctx.gc.htmlNode.appendChild(ctx.doc.createTextNode("\n"));
} else {
- ctx.headNode.appendChild(child);
- ctx.headNode.appendChild(ctx.doc.createTextNode("\n"));
+ ctx.gc.headNode.appendChild(child);
+ ctx.gc.headNode.appendChild(ctx.doc.createTextNode("\n"));
}
TodoElement it
= TodoElement.getTodoElement((Element)child, this.ctx, this);
diff --git a/org/madore/damlengine/TodoEmailAtOrDotElement.java b/org/madore/damlengine/TodoEmailAtOrDotElement.java
index 8e3eed3..6597291 100644
--- a/org/madore/damlengine/TodoEmailAtOrDotElement.java
+++ b/org/madore/damlengine/TodoEmailAtOrDotElement.java
@@ -64,7 +64,7 @@ public final class TodoEmailAtOrDotElement extends TodoDefaultElement {
span0.appendChild(span1);
Element img = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "img");
img.setAttributeNS(null, "src",
- (ctx.uriToTop==null?"":ctx.uriToTop)+"images/"+t.imgName);
+ (ctx.gc.uriToTop==null?"":ctx.gc.uriToTop)+"images/"+t.imgName);
img.setAttributeNS(null, "alt", "["+(lang.equals("fr")?t.frName:t.enName)+"]");
img.setAttributeNS(null, "height", "15");
img.setAttributeNS(null, "width", "16");
diff --git a/org/madore/damlengine/TodoEntryElement.java b/org/madore/damlengine/TodoEntryElement.java
index 14560a5..4853a9a 100644
--- a/org/madore/damlengine/TodoEntryElement.java
+++ b/org/madore/damlengine/TodoEntryElement.java
@@ -70,7 +70,7 @@ public final class TodoEntryElement extends TodoDefaultElement {
header.appendChild(ctx.doc.createTextNode(" ("+entryDowStr+")"));
Context ctx2 = ctx.clone();
- ctx2.entryCtx
+ ctx2.ent
= new Context.EntryContext(entryYearStr, entryMonthStr, entryDayStr,
entryNumberStr, entryDowStr);
diff --git a/org/madore/damlengine/TodoExtraStyleOrScriptElement.java b/org/madore/damlengine/TodoExtraStyleOrScriptElement.java
index a475863..9b4a6c6 100644
--- a/org/madore/damlengine/TodoExtraStyleOrScriptElement.java
+++ b/org/madore/damlengine/TodoExtraStyleOrScriptElement.java
@@ -33,9 +33,9 @@ public final class TodoExtraStyleOrScriptElement extends TodoDefaultElement {
public void handleNodeOnly() {
String content = node.getTextContent();
if ( t == TodoStyleOrScript.Type.SCRIPT )
- ctx.scriptContent.append(content);
+ ctx.gc.scriptContent.append(content);
else
- ctx.styleContent.append(content);
+ ctx.gc.styleContent.append(content);
Node ws = node.getNextSibling();
if ( ( ws.getNodeType() == Node.TEXT_NODE
|| ws.getNodeType() == Node.CDATA_SECTION_NODE )
diff --git a/org/madore/damlengine/TodoFooter.java b/org/madore/damlengine/TodoFooter.java
index 8c45eeb..c47c951 100644
--- a/org/madore/damlengine/TodoFooter.java
+++ b/org/madore/damlengine/TodoFooter.java
@@ -26,8 +26,8 @@ public final class TodoFooter extends TodoElement {
toProcess.add(TodoElement.getTodoElement(addr, this.ctx, this));
Element a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a");
a.setAttributeNS(null, "href",
- (ctx.uriToTop==null)?"http://www.madore.org/~david/"
- :ctx.uriToTop);
+ (ctx.gc.uriToTop==null)?"http://www.madore.org/~david/"
+ :ctx.gc.uriToTop);
addr.appendChild(a);
a.appendChild(ctx.doc.createTextNode("David Madore"));
addr.appendChild(ctx.doc.createTextNode(" ("));
diff --git a/org/madore/damlengine/TodoNavbar.java b/org/madore/damlengine/TodoNavbar.java
index 5108a33..4b05180 100644
--- a/org/madore/damlengine/TodoNavbar.java
+++ b/org/madore/damlengine/TodoNavbar.java
@@ -36,20 +36,20 @@ public final class TodoNavbar extends TodoElement {
:"Prof. site"));
p.appendChild(ctx.doc.createElementNS(DamlEngine.XHTML_NS, "br"));
a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a");
- a.setAttributeNS(null, "href", (ctx.uriToTop==null)?"./":ctx.uriToTop);
+ a.setAttributeNS(null, "href", (ctx.gc.uriToTop==null)?"./":ctx.gc.uriToTop);
p.appendChild(a);
a.appendChild(ctx.doc.createTextNode(lang.equals("fr")?"Racine du site"
:"Site Root"));
p.appendChild(ctx.doc.createElementNS(DamlEngine.XHTML_NS, "br"));
a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a");
- a.setAttributeNS(null, "href", (((ctx.uriToTop==null)?"":ctx.uriToTop)
+ a.setAttributeNS(null, "href", (((ctx.gc.uriToTop==null)?"":ctx.gc.uriToTop)
+"sitemap.html"));
p.appendChild(a);
a.appendChild(ctx.doc.createTextNode(lang.equals("fr")?"Plan du site"
:"Site Map"));
p.appendChild(ctx.doc.createElementNS(DamlEngine.XHTML_NS, "br"));
a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a");
- a.setAttributeNS(null, "href", (((ctx.uriToTop==null)?"":ctx.uriToTop)
+ a.setAttributeNS(null, "href", (((ctx.gc.uriToTop==null)?"":ctx.gc.uriToTop)
+"weblog/"));
p.appendChild(a);
a.appendChild(ctx.doc.createTextNode("WebLog"));
diff --git a/org/madore/damlengine/TodoSmileyElement.java b/org/madore/damlengine/TodoSmileyElement.java
index bd3fbc6..90f848a 100644
--- a/org/madore/damlengine/TodoSmileyElement.java
+++ b/org/madore/damlengine/TodoSmileyElement.java
@@ -59,7 +59,7 @@ public final class TodoSmileyElement extends TodoDefaultElement {
String lang = LangHelper.getLangRec(node);
Element img = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "img");
img.setAttributeNS(null, "src",
- (ctx.uriToTop==null?"":ctx.uriToTop)+"images/smileys/"+t.emotion+".png");
+ (ctx.gc.uriToTop==null?"":ctx.gc.uriToTop)+"images/smileys/"+t.emotion+".png");
img.setAttributeNS(null, "class",
"smiley");
img.setAttributeNS(null, "alt", t.altText);
diff --git a/org/madore/damlengine/TodoStyleOrScript.java b/org/madore/damlengine/TodoStyleOrScript.java
index dcec137..cc00e11 100644
--- a/org/madore/damlengine/TodoStyleOrScript.java
+++ b/org/madore/damlengine/TodoStyleOrScript.java
@@ -31,18 +31,18 @@ public final class TodoStyleOrScript extends TodoItem {
@Override
public void handle() {
- if ( ctx.headNode == null )
+ if ( ctx.gc.headNode == null )
throw new IllegalStateException("head node is null when doing style or script");
Element node
= ctx.doc.createElementNS(DamlEngine.XHTML_NS, t.eltName);
node.setAttributeNS(null, "type", t.mimeType);
if ( t==Type.SCRIPT )
node.setAttributeNS(null, "defer", "defer");
- ctx.headNode.appendChild(node);
- ctx.headNode.appendChild(ctx.doc.createTextNode("\n"));
+ ctx.gc.headNode.appendChild(node);
+ ctx.gc.headNode.appendChild(ctx.doc.createTextNode("\n"));
node.appendChild(ctx.doc.createTextNode("\n"+t.preCdata));
StringBuffer content
- = (t==Type.SCRIPT)?ctx.scriptContent:ctx.styleContent;
+ = (t==Type.SCRIPT)?ctx.gc.scriptContent:ctx.gc.styleContent;
node.appendChild(ctx.doc.
createCDATASection(t.postCdata+content
+t.preCdata));
diff --git a/org/madore/damlengine/TodoSubtitleElement.java b/org/madore/damlengine/TodoSubtitleElement.java
index 05c17fc..361bcfc 100644
--- a/org/madore/damlengine/TodoSubtitleElement.java
+++ b/org/madore/damlengine/TodoSubtitleElement.java
@@ -23,14 +23,14 @@ public final class TodoSubtitleElement extends TodoDefaultElement {
@Override
public void handleNodeOnly() {
- if ( ctx.subtitle != null )
+ if ( ctx.gc.subtitle != null )
throw new IllegalArgumentException("attempting to redefine subtitle");
- ctx.subtitle = ctx.doc.createDocumentFragment();
- ctx.subtitleStr = node.getTextContent();
- ctx.subtitleLang = LangHelper.getLangRec(node);
+ ctx.gc.subtitle = ctx.doc.createDocumentFragment();
+ ctx.gc.subtitleStr = node.getTextContent();
+ ctx.gc.subtitleLang = LangHelper.getLangRec(node);
ArrayList<Node> childList = getChildList(node);
for ( Node child : childList ) {
- ctx.subtitle.appendChild(child);
+ ctx.gc.subtitle.appendChild(child);
}
Node ws = node.getNextSibling();
if ( ( ws.getNodeType() == Node.TEXT_NODE
diff --git a/org/madore/damlengine/TodoTitleElement.java b/org/madore/damlengine/TodoTitleElement.java
index 31659e0..bfa1949 100644
--- a/org/madore/damlengine/TodoTitleElement.java
+++ b/org/madore/damlengine/TodoTitleElement.java
@@ -22,26 +22,26 @@ public final class TodoTitleElement extends TodoDefaultElement {
@Override
public void handleNodeOnly() {
- if ( ctx.title != null )
+ if ( ctx.gc.title != null )
throw new IllegalArgumentException("attempting to redefine title");
- ctx.title = ctx.doc.createDocumentFragment();
- ctx.titleStr = node.getTextContent();
- ctx.titleLang = LangHelper.getLangRec(node);
+ ctx.gc.title = ctx.doc.createDocumentFragment();
+ ctx.gc.titleStr = node.getTextContent();
+ ctx.gc.titleLang = LangHelper.getLangRec(node);
String lang = LangHelper.getLangNorec(node);
ArrayList<Node> childList = getChildList(node);
for ( Node child : childList ) {
- ctx.title.appendChild(child);
+ ctx.gc.title.appendChild(child);
}
Element tit = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "title");
if ( lang != null )
LangHelper.setLangNorec(tit, lang);
node.getParentNode().replaceChild(tit, node);
- tit.appendChild(ctx.doc.createTextNode(ctx.titleStr));
+ tit.appendChild(ctx.doc.createTextNode(ctx.gc.titleStr));
Element meta = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "meta");
if ( lang != null )
LangHelper.setLangNorec(meta, lang);
meta.setAttributeNS(null, "name", "Title");
- meta.setAttributeNS(null, "content", ctx.titleStr);
+ meta.setAttributeNS(null, "content", ctx.gc.titleStr);
if ( tit.getNextSibling() != null )
tit.getParentNode().insertBefore(meta, tit.getNextSibling());
else
diff --git a/org/madore/damlengine/TodoTitleOrSubtitle.java b/org/madore/damlengine/TodoTitleOrSubtitle.java
index 5e92f41..1640b93 100644
--- a/org/madore/damlengine/TodoTitleOrSubtitle.java
+++ b/org/madore/damlengine/TodoTitleOrSubtitle.java
@@ -29,13 +29,13 @@ public final class TodoTitleOrSubtitle extends TodoElement {
@Override
public void handle() {
Element elt = ctx.doc.createElementNS(DamlEngine.XHTML_NS, t.eltName);
- String expLang = (t==Type.TITLE)?ctx.titleLang:ctx.subtitleLang;
+ String expLang = (t==Type.TITLE)?ctx.gc.titleLang:ctx.gc.subtitleLang;
if ( expLang != null )
LangHelper.setLangNorec(node, expLang);
elt.setAttributeNS(null, "class", t.eltClass);
node.getParentNode().replaceChild(elt, node);
ArrayList<Node> childList
- = TodoDefaultElement.getChildList((t==Type.TITLE)?ctx.title:ctx.subtitle);
+ = TodoDefaultElement.getChildList((t==Type.TITLE)?ctx.gc.title:ctx.gc.subtitle);
for ( Node child : childList )
elt.appendChild(child.cloneNode(true));
TodoElement it
diff --git a/org/madore/damlengine/TodoTranslationElement.java b/org/madore/damlengine/TodoTranslationElement.java
index 943f7a7..90a44a7 100644
--- a/org/madore/damlengine/TodoTranslationElement.java
+++ b/org/madore/damlengine/TodoTranslationElement.java
@@ -23,12 +23,12 @@ public final class TodoTranslationElement extends TodoDefaultElement {
@Override
public void handleNodeOnly() {
- if ( ctx.translations == null )
- ctx.translations = new ArrayList<String>(8);
+ if ( ctx.gc.translations == null )
+ ctx.gc.translations = new ArrayList<String>(8);
String lang = LangHelper.getLangNorec(node);
if ( lang == null )
throw new IllegalArgumentException("translation element must have an xml:lang attribute");
- ctx.translations.add(lang);
+ ctx.gc.translations.add(lang);
Node ws = node.getNextSibling();
if ( ( ws.getNodeType() == Node.TEXT_NODE
|| ws.getNodeType() == Node.CDATA_SECTION_NODE )
diff --git a/org/madore/damlengine/TodoTranslations.java b/org/madore/damlengine/TodoTranslations.java
index 5cb63a2..95f1ab7 100644
--- a/org/madore/damlengine/TodoTranslations.java
+++ b/org/madore/damlengine/TodoTranslations.java
@@ -14,8 +14,8 @@ public final class TodoTranslations extends TodoElement {
@Override
public void handle() {
- ArrayList<TodoElement> toProcess = new ArrayList<TodoElement>(ctx.translations.size()+8);
- for ( String trlang : ctx.translations ) {
+ ArrayList<TodoElement> toProcess = new ArrayList<TodoElement>(ctx.gc.translations.size()+8);
+ for ( String trlang : ctx.gc.translations ) {
Element p = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "p");
LangHelper.setLangNorec(p, trlang);
p.setAttributeNS(null, "class", "translation-offer");
@@ -29,7 +29,7 @@ public final class TodoTranslations extends TodoElement {
p.appendChild(ctx.doc.createTextNode(str));
Element a = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a");
p.appendChild(a);
- a.setAttributeNS(null, "href", ctx.fileName+"."+trlang);
+ a.setAttributeNS(null, "href", ctx.gc.fileName+"."+trlang);
a.setAttributeNS(null, "hreflang", trlang);
str = trlang;
if ( trlang.equals("en") )