Newsbruiser atom feeds fixed
Something was wrong with the atom feed for one of my newsbruiser instances; and I think the working feed had some problems under bloglines. I'm trying to get off newsbruiser anyway, so I finally wrote an RDF exporter program for it. With an RDF version of the entries, it's really easy to make an atom feed (and hopefully I got it right).
My exporter program imports the actual newsbruiser code, fakes enough startup and config material to get going, and then adds statements about the notebook and entries to an rdflib graph. Man, does newsbruiser spend a ton of code on config and option nonsense.
My blog is currently 963 statements; and Kelsi's blog is 1011 statements. I just store them as NT files. They're about 300kB each.
The atom generator code uses rdflib but not newsbruiser. It's this SPARQL query:
SELECT ?e WHERE {
?blog sioc:links_to ?e .
?e td:modified ?mod .
} ORDER BY desc(?mod) LIMIT 5
with one more pattern if I'm trying to make a feed for a particular category. Then I use lxml's ElementMaker like the slides told me to.
tinymce patch for newsbruiser
This patch hopefully works on the new newsbruiser release 2.6.2. It lets us use the excellent TinyMCE editor widget to write blog posts. Along with this patch, you have to actually put tinymce such that it shows up at /resources/tiny_mce/tiny_mce.js.
(Coming soon: another newsbruiser patch and accompanying tools that let us send picture posts from our cell phones.)
Index: nb/CoreCGIs.py
===================================================================
RCS file: /cvs/newsbruiser/nb/CoreCGIs.py,v
retrieving revision 1.100
diff -u -r1.100 CoreCGIs.py
--- nb/CoreCGIs.py 27 Apr 2008 11:52:33 -0000 1.100
+++ nb/CoreCGIs.py 29 Apr 2008 08:16:41 -0000
@@ -271,7 +267,7 @@
self.printDisplaySnippets('aboveEntryText')
print '<table><tr><td valign="top">'
self.textArea(self.notebook.getEntryBoxLength(), 70,
- const.ENTRY_CGI_KEY)
+ const.ENTRY_CGI_KEY, html=True)
self.printDisplaySnippets('rightOfEntryText')
if showHelp:
@@ -819,7 +815,7 @@
print '<table><tr><td valign="top">'
self.textArea(self.notebook.getEntryBoxLength(), 70,
- const.ENTRY_CGI_KEY, entry.text)
+ const.ENTRY_CGI_KEY, entry.text, html=True)
self.printDisplaySnippets('rightOfEntryText')
if names:
print '</td><td valign="top">'
Index: nb/lib/LOMP.py
===================================================================
RCS file: /cvs/newsbruiser/nb/lib/LOMP.py,v
retrieving revision 1.16
diff -u -r1.16 LOMP.py
--- nb/lib/LOMP.py 5 Dec 2004 20:20:51 -0000 1.16
+++ nb/lib/LOMP.py 29 Apr 2008 08:16:59 -0000
@@ -183,9 +183,41 @@
maxlength = ''
print '<input type="text" name="%s" value="%s" size="%s"%s />' % (name, cgi.escape(str(value), 1), size, maxlength)
- def textArea(self, rows, cols, name, content=''):
- "Prints a standard multiline text box."
- print '<p><textarea wrap="virtual" rows="%s" cols="%s" name="%s">%s</textarea></p>' % (rows, cols, name, cgi.escape(str(content)))
+ def textArea(self, rows, cols, name, content='', html=False):
+ """Prints a standard multiline text box.
+
+ drewp adds html mode using tinymce
+ """
+ escContent = cgi.escape(str(content))
+ if html:
+ # it would be cool to grab recent images and put them in
+ # the external_image_list
+ # see http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/external_image_list_url
+
+ # the way i include this js probably only works if there's
+ # one html textarea on the page
+ print """
+<script type="text/javascript" src="/resources/tiny_mce/tiny_mce.js"></script>
+<script type="text/javascript">
+ tinyMCE.init({
+ mode : "exact",
+ elements : "elm1",
+ theme : "advanced",
+ table_inline_editing : true,
+ plugins : "table,emotions,style",
+ theme_advanced_blockformats : "p,pre,div,h1,h2,h3,h4,h5,h6,blockquote,dt,dd,code,samp",
+ theme_advanced_toolbar_location : "top",
+ theme_advanced_statusbar_location : "bottom",
+ theme_advanced_resizing : true,
+ theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,outdent,indent,blockquote,|,formatselect,fontselect,fontsizeselect",
+ theme_advanced_buttons2 : "undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,styleprops",
+ theme_advanced_buttons3 : "tablecontrols"
+ });
+</script>
+
+ <p><textarea id="elm1" name="%(name)s" rows="20" cols="60">%(escContent)s</textarea></p>""" % vars()
+ return
+ print '<p><textarea wrap="virtual" rows="%s" cols="%s" name="%s">%s</textarea></p>' % (rows, cols, name, escContent)
def listBox(self, boxName, names, values, defaults=None, size=1,
allowMultiple=0):
Atom feed of this blog