Commits

Christian Jann committed a985ede

Added ".. more::" directive

Just add ".. more::" somewhere inside your blog post to crop
it and insert a "Read more..." link.

  • Participants
  • Parent commits 1956cbc

Comments (0)

Files changed (5)

File tinkerer/ext/blog.py

     CONTRIBUTORS file)
     :license: FreeBSD, see LICENSE file
 '''
-from tinkerer.ext import aggregator, author, filing, metadata, rss, uistr
+from tinkerer.ext import aggregator, author, filing, metadata, rss, uistr, directives
 import gettext
 
 
             filing.create_filing_directive("tags"))
     app.add_directive("categories", 
             filing.create_filing_directive("categories"))
+    app.add_directive("more", directives.InsertReadMoreLink)
 
     # event handlers
     app.connect("builder-inited", initialize)

File tinkerer/ext/directives.py

+'''
+    directives
+    ~~~~~~~~~~
+
+    Some extra ReStructuredText roles.
+
+    :copyright: Copyright 2012 by Christian Jann
+    :license: FreeBSD, see LICENSE file
+'''
+
+from docutils import nodes
+from sphinx.util.compat import Directive
+
+class InsertReadMoreLink(Directive):
+  """ Restructured text extension for inserting a "Read more..." link """
+
+  has_content = True
+  required_arguments = 0
+
+  def run(self):
+    return [nodes.raw('', "<!-- more -->", format='html')] 

File tinkerer/ext/patch.py

     pos=body.find(marker_more)
     if(pos>-1):
       body = body[:pos]
-      body = body + ('<a class="readmore" href="%s.html"><b>%s</b></a>' % 
+      body = body + ('<a class="readmore" href="%s.html">%s</a>' % 
         (docpath + docname, UIStr.READ_MORE))
     return body
 

File tinkerer/themes/minimal/static/minimal.css_t

     color: black;
 }
 
+a.readmore {
+  font-weight:bold;
+}
+
 /* Header */
 div.header {
     margin-bottom: 48px;

File tinkerer/themes/modern/static/modern.css_t

     text-decoration: underline;
 }
 
+a.readmore {
+  font-weight:bold;
+}
+
 /* Header */
 div.header {
     background: #074e78;