diff options
author | David A. Madore <david+git@madore.org> | 2014-10-10 21:21:14 +0200 |
---|---|---|
committer | David A. Madore <david+git@madore.org> | 2014-10-10 21:21:14 +0200 |
commit | d6b9db7926af4dc6d7df5af55d261731bd623c23 (patch) | |
tree | d8f289bdfb30202a92404d4be7608a0230c19242 /org/madore/damlengine/TodoCategories.java | |
parent | 5b15f489d9793afdfe5dde2a2934c975b61567bd (diff) | |
download | damlengine-d6b9db7926af4dc6d7df5af55d261731bd623c23.tar.gz damlengine-d6b9db7926af4dc6d7df5af55d261731bd623c23.tar.bz2 damlengine-d6b9db7926af4dc6d7df5af55d261731bd623c23.zip |
Introduce a WeblogLink class to refactor a lot of code on how links are written.
Diffstat (limited to 'org/madore/damlengine/TodoCategories.java')
-rw-r--r-- | org/madore/damlengine/TodoCategories.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/org/madore/damlengine/TodoCategories.java b/org/madore/damlengine/TodoCategories.java index cc104e8..5d1a175 100644 --- a/org/madore/damlengine/TodoCategories.java +++ b/org/madore/damlengine/TodoCategories.java @@ -40,20 +40,21 @@ public final class TodoCategories extends TodoElement { if ( ctx.ent == null ) throw new IllegalStateException("entry context not defined in categories element"); for ( String cat : ctx.ent.catList ) { + WeblogLink lk = new WeblogLink(ctx.ent.year, ctx.ent.month, + ctx.ent.day, ctx.ent.number, "", + ctx.ent.doSinglePage); + lk.setTypeCat(cat); + String baseDir = ((ctx.gc.uriToTop==null)?"":(ctx.gc.uriToTop+"weblog/")); p.appendChild(ctx.doc.createTextNode(" ")); Element a1 = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a"); - String target1URL = ((ctx.gc.uriToTop==null)?"":(ctx.gc.uriToTop+"weblog/")) - + cat + ".html"; - a1.setAttributeNS(null, "href", target1URL); + a1.setAttributeNS(null, "href", lk.getFile(baseDir)); a1.setAttributeNS(null, "title", TodoWeblogSelectionElement.categoryName(cat, lang)); p.appendChild(a1); a1.appendChild(ctx.doc.createTextNode(cat)); p.appendChild(ctx.doc.createTextNode("(")); Element a2 = ctx.doc.createElementNS(DamlEngine.XHTML_NS, "a"); - String target2URL = target1URL - + "#d." + ctx.ent.date + "." + ctx.ent.number; - a2.setAttributeNS(null, "href", target2URL); + a2.setAttributeNS(null, "href", lk.getTarget(baseDir)); p.appendChild(a2); a2.appendChild(ctx.doc.createTextNode("\u2022")); p.appendChild(ctx.doc.createTextNode(")")); |