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 ''
def stories_index (full):
  import blog
  import category_pages
  
  def info (story):
    words = story["word_count"]
    return " [" + (story ["word_count_override"] if "word_count_override" in story else str(((words + 50)//100)*100) + " words") + "]"
  
  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 ''
  
  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)
    
  def group (name, contents):
    return category_pages.exhibit (None, "", None, '<h1>' + name + '</h1>' + contents, None) if full else '<div class="index_page_entry">' + name +'</div>' + contents
  
  return (
  big_story ("ravelling_wrath") +
  big_story ("Not What I Am") +
  big_story ("Time Travelers and How to Kill Them: a Practical Guide") +
  group ("Short stories",
    small_story ("Capitalism Sat") + 
    small_story ("It Was All A Dream") + 
    small_story ("Will You Try to Escape?") +
    small_story ("The Sieve") +
    small_story ("Nothing Is Wrong In This World") +
    ""
  ) +
  big_story ("The 23 Days Cult") +
  (category_pages.exhibit ("/blog/tags/story-ideas", "", None, '''<p>Finally, I share <span class="restore_link">additional story ideas on my blog</span> when they are clever enough to be worth sharing, but not compelling enough that I want to write them up in full.</p>''', None) if full else '<div class=" big_story"><div class=" index_entry"> <a href="/blog/tags/story-ideas">Story ideas</a> </div> </div> ')
  )
 def group (name, contents):
   return category_pages.exhibit (None, "", None, '<h1>' + name + '</h1>' + contents, None) if full else '<div class="index_page_entry">' + name +'</div>' + contents