Commits

Anonymous committed ce5c105

Expand URLs in feed descriptions

  • Participants
  • Parent commits 272cf6a

Comments (0)

Files changed (10)

File example-site/content/whats-new.text

 tags: python, lorem ipsum
 
 <summary>
-This article explains the new features in Python 2.6, released on October 1
+This article (not [this article](loremipsum.html)) explains the new features in
+Python 2.6, released on October 1
 2008. The release schedule is described in [PEP 361][pep361].
 
 [pep361]: http://www.python.org/dev/peps/pep-0361

File example-site/deploy/2008/whats-new.html

     (posted  6 December 2009)
 </p>
 
-<p>This article explains the new features in Python 2.6, released on October 1
+<p>This article (not <a href="loremipsum.html">this article</a>) explains the new features in
+Python 2.6, released on October 1
 2008. The release schedule is described in <a href="http://www.python.org/dev/peps/pep-0361">PEP 361</a>.</p>
 <p>The major theme of Python 2.6 is preparing the migration path to Python 3.0, a
 major redesign of the language. Whenever possible, Python 2.6 incorporates new
     <a href="/pilcrow/2008.html">2008</a>
 
 
+      <p>Last modified: 2009-12-14
+
     </div>
 
   </div>

File example-site/deploy/2009/lorem-ipsum.html

     <a href="/pilcrow/2009.html">2009</a>
 
 
+      <p>Last modified: 2009-12-13
+
     </div>
 
   </div>

File example-site/deploy/2009/turritopsis-nutricula.html

       <span class="sep">|</span>
       <a href="/pilcrow/2009/lorem-ipsum.html">Lorem ipsum &rarr;</a>
 
+      <p>Last modified: 2009-12-13
+
     </div>
 
   </div>

File example-site/deploy/feed.rss

 Suspendisse lectus mi, sollicitudin at cursus non, congue at tortor.&lt;/p&gt;
 &lt;p&gt;Integer lacinia, dolor ac consequat mollis, neque ante sodales odio, eget
 semper quam est eu quam. Quisque et nisl sit amet urna condimentum gravida.
-Nam euismod ante at orci blandit pharetra.&lt;/p&gt;</description><category domain="http://inky.github.com/pilcrow/">loremipsum</category><category domain="http://inky.github.com/pilcrow/">typography</category><guid isPermaLink="true">http://inky.github.com/pilcrow/2009/lorem-ipsum.html</guid><pubDate>Mon, 07 Dec 2009 21:21:00 GMT</pubDate></item><item><title>What's new in Python 2.6 [2008-10-01]</title><link>http://inky.github.com/pilcrow/2008/whats-new.html</link><description>&lt;p&gt;This article explains the new features in Python 2.6, released on October 1
+Nam euismod ante at orci blandit pharetra.&lt;/p&gt;</description><category domain="http://inky.github.com/pilcrow/">loremipsum</category><category domain="http://inky.github.com/pilcrow/">typography</category><guid isPermaLink="true">http://inky.github.com/pilcrow/2009/lorem-ipsum.html</guid><pubDate>Mon, 07 Dec 2009 21:21:00 GMT</pubDate></item><item><title>What's new in Python 2.6 [2008-10-01]</title><link>http://inky.github.com/pilcrow/2008/whats-new.html</link><description>&lt;p&gt;This article (not &lt;a href="http://inky.github.com/pilcrow/2008/loremipsum.html"&gt;this article&lt;/a&gt;) explains the new features in
+Python 2.6, released on October 1
 2008. The release schedule is described in &lt;a href="http://www.python.org/dev/peps/pep-0361"&gt;PEP 361&lt;/a&gt;.&lt;/p&gt;
 &lt;p&gt;The major theme of Python 2.6 is preparing the migration path to Python 3.0, a
 major redesign of the language. Whenever possible, Python 2.6 incorporates new

File example-site/deploy/loremipsum.html

     <a href="/pilcrow/2008/whats-new.html">What's new in Python 2.6</a>
     (2009-Dec-06)
   </h2>
-    <div class="summary">This article explains the new features in Python 2.6, released on October 1
+    <div class="summary">This article (not this article) explains the new features in
+Python 2.6, released on October 1
 2008. The release schedule is described in PEP 361.</div>
 
     </div>

File example-site/deploy/python.html

     <a href="/pilcrow/2008/whats-new.html">What's new in Python 2.6</a>
     (2009-Dec-06)
   </h2>
-    <div class="summary">This article explains the new features in Python 2.6, released on October 1
+    <div class="summary">This article (not this article) explains the new features in
+Python 2.6, released on October 1
 2008. The release schedule is described in PEP 361.</div>
 
     </div>

File example-site/templates/entry.html

       <span class="sep">|</span>
       <a href="${nextpost.url}">${nextpost.title or 'Untitled'} &rarr;</a>
     % endif
+
+    % if modified:
+      <p>Last modified: ${modified.strftime('%Y-%m-%d')}
+    % endif
 </%def>

File pilcrow/core.py

 
     def join_url(self, *parts, **kwargs):
         ext = (kwargs.get('ext', 1) and not self['clean_urls']) and '.html' or ''
-        return re.sub('//+', '/', '/'.join(str(s) for s in parts if s)) + ext
+        url = re.sub('//+', '/', '/'.join(str(s) for s in parts if s))
+        if ext and url.endswith(ext):
+            url = url[:-len(ext)]
+        return url + ext
 
     def build(self, clean=False):
         base_path = path.realpath(os.curdir)

File pilcrow/pages.py

 
 """
 import re
+import urlparse
 from collections import defaultdict
 from datetime import datetime
 from os import path
         if self.backposted():
             title += ' [%s]' % self.date.strftime('%Y-%m-%d')
         tags = [rss2.Category(tag, self._site['home']) for tag in self.tags]
+
+        content = BeautifulSoup(self.content)
+        for link in content.findAll('a'):
+            link['href'] = urlparse.urljoin(self.full_url, link['href'])
+
         return rss2.RSSItem(title=title, link=url, guid=rss2.Guid(url),
-            description=self.content, pubDate=self.posted or self.date,
+            description=str(content), pubDate=self.posted or self.date,
             categories=tags, enclosure=self.get('enclosure', None))