summaryrefslogtreecommitdiffstats
path: root/org/madore/damlengine/WeblogRSS.java
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2011-11-12 14:33:35 +0100
committerDavid A. Madore <david+git@madore.org>2011-11-12 14:33:35 +0100
commit07f2f3c30a6e0bc811e436925dfdfcf5befdecb7 (patch)
tree823deb363f8c7449a2028bc5171bf46d7f6218eb /org/madore/damlengine/WeblogRSS.java
parent71dc0d53fcefea70ce978d305fba653cc2180a3b (diff)
downloaddamlengine-07f2f3c30a6e0bc811e436925dfdfcf5befdecb7.tar.gz
damlengine-07f2f3c30a6e0bc811e436925dfdfcf5befdecb7.tar.bz2
damlengine-07f2f3c30a6e0bc811e436925dfdfcf5befdecb7.zip
Entry single pages: handle permalinks gracefully, populate with attribute.
* A single page is generated from the single-page attribute on <entry> element (stored in database as do_single_page). * Permalink refers to the single page. Same from weblog index. Other links are subject to debate (e.g., what about internal links? now we link to single page when link has a supplement part, but this is debatable).
Diffstat (limited to 'org/madore/damlengine/WeblogRSS.java')
-rw-r--r--org/madore/damlengine/WeblogRSS.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/org/madore/damlengine/WeblogRSS.java b/org/madore/damlengine/WeblogRSS.java
index 147c8f5..0f3b296 100644
--- a/org/madore/damlengine/WeblogRSS.java
+++ b/org/madore/damlengine/WeblogRSS.java
@@ -27,7 +27,7 @@ public final class WeblogRSS {
final Connection conn = WeblogDatabaseConnection.getConnection();
final PreparedStatement selSt
- = conn.prepareStatement("SELECT id , edate , to_char(cdate,'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"') , lang , title , content FROM entries ORDER BY id DESC LIMIT 25");
+ = conn.prepareStatement("SELECT id , edate , to_char(cdate,'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"') , lang , do_single_page , title , content FROM entries ORDER BY id DESC LIMIT 25");
final ResultSet selRes = selSt.executeQuery();
@@ -97,8 +97,9 @@ public final class WeblogRSS {
String date = selRes.getString(2);
String cdate = selRes.getString(3);
String lang = selRes.getString(4);
- String title = selRes.getString(5);
- String contentXml = selRes.getString(6);
+ String doSinglePage = selRes.getString(5);
+ String title = selRes.getString(6);
+ String contentXml = selRes.getString(7);
Matcher matcher = Pattern.compile("^(\\d{4})-(\\d{2})-(\\d{2})$").matcher(date);
if ( ! matcher.matches() )
throw new IllegalArgumentException("entry "+id+" has badly formed date");
@@ -108,9 +109,15 @@ public final class WeblogRSS {
String numberStr = String.format("%04d",id);
String aboutUri = weblogBaseURI
+ "#d." + date + "." + numberStr;
- String linkUri = weblogBaseURI
- + yearStr + "-" + monthStr + ".html"
- + "#d." + date + "." + numberStr;
+ String linkUri;
+ if ( doSinglePage == null )
+ linkUri = weblogBaseURI
+ + yearStr + "-" + monthStr + ".html"
+ + "#d." + date + "." + numberStr;
+ else
+ linkUri = weblogBaseURI
+ + date + "-" + doSinglePage + ".html"
+ + "#d." + date + "." + numberStr;
Element li = rssDoc.createElementNS(DamlEngine.RDF_NS, "rdf:li");
itemsSeq.appendChild(li);
itemsSeq.appendChild(rssDoc.createTextNode("\n"));