コード例 #1
0
 def big_story (story):
   if story in stories_map:
     story = stories_map [story]
     story ["listed"] = True
     return category_pages.exhibit (blog.post_permalink (story), "", None, '<h1>' + story ["title"] + '</h1>' + story ["blurb"] + info (story), "Start reading") if full else '<div class=" big_story">' + blog.index_entry_html (story) + '</div>'
   elif story in long_stories:
     story = long_stories [story]
     return category_pages.exhibit (story["url"], "", None, '<h1>' + story ["title"] + '</h1>' + story ["blurb"] + info (story), "Start reading") if full else '<div class=" big_story">' + blog.index_entry_html (story) + '</div>'
   else:
     return category_pages.exhibit (None, "", None, '<h1>' + story + '</h1>', "Coming Soon...") if full else ''
コード例 #2
0
def add_feed(page_dict):
  author = '''<author>
    <name>Eli Dupree</name>
    <'''+'e'+'m'+'a'+'i'+'l'+'>'+exmxaxixl.axdxrxexsxs+'</'+'e'+'m'+'a'+'i'+'l'+'''>
    <uri>'''+utils.canonical_scheme_and_domain+'''/</uri>
  </author>'''
  
  entries = []  
  for post in reversed ([post for post in blog.current_blog_page if "username" not in post]):
    if "comic_id" not in post:
      link = blog.post_permalink(post)
    else:
      link = comics.page_url(post)
    title = post ["title"]
    (body, head) = blog.stream_entry (post)
    post_string = head + body
    metadata = blog.post_metadata(post)
    # make internal links work in the feed
    post_string = re.sub(r'( (?:href|src)=")/', lambda match: match.group(1)+utils.canonical_scheme_and_domain+'/', post_string)
    
    entries.append('''
    <entry>
      <id>'''+utils.canonical_scheme_and_domain+link+'''</id>
      <title type="html">'''+cgi.escape(title)+'''</title>
      <published>'''+atom_time(metadata["date_posted"])+'''</published>      
      <updated>'''+atom_time(metadata["date_modified"])+'''</updated>
      '''+author+'''
      <link rel="alternate" href="'''+utils.canonical_scheme_and_domain+link+'''" />
      <content type="html">'''+cgi.escape(post_string)+'''</content>
    </entry>
    ''')
  
  utils.checked_insert(page_dict,
    '/atom.xml',
    '''<?xml version="1.0" encoding="utf-8"?>

<feed xmlns="http://www.w3.org/2005/Atom">
  <id>'''+utils.canonical_scheme_and_domain+'''/</id>
  <icon>'''+utils.canonical_scheme_and_domain +'''/site-logo.png</icon>
  <title>Eli Dupree's website</title>
  <updated>'''+atom_time(datetime.datetime.utcnow())+'''</updated>
  '''+author+'''
  <link rel="self" href="/atom.xml" />
  '''+''.join(entries)+'''
</feed>'''
  )
コード例 #3
0
 def small_story (story):
   if story not in stories_map:
     return '<a class="small_story"><h2>' + story + ": "  + '</h2><span class="blurb"> Coming eventually... </span></a>' if full else ''
   story = stories_map [story]
   story ["listed"] = True
   return '<a class="small_story" href="' + blog.post_permalink (story) +'"><h2 class=" restore_link">' + ("[NSFW] " if "NSFW" in story else "") + story ["title"]+ info (story) + ": "  + '</h2><span class="blurb">' + story ["blurb"] + '</span></a>' if full else blog.index_entry_html (story)
コード例 #4
0
 def small_story (story):
   if story not in stories_map:
     return '<a class="small_story"><h2>' + story + ": "  + '</h2><span class="blurb"> Coming soon... </span></a>' if full else ''
   story = stories_map [story]
   return '<a class="small_story" href="' + blog.post_permalink (story) +'"><h2 class=" restore_link">' + story ["title"]+ info (story) + ": "  + '</h2><span class="blurb">' + story ["blurb"] + '</span></a>' if full else blog.index_entry_html (story)