コード例 #1
0
 def get_terms(self):
   if self.image_caption:
     md = util.markdown_convert(self.image_caption, self.build.synonyms)[1]
     terms = md.terms + self.terms
     return terms
   else:
     return self.terms
コード例 #2
0
 def get_terms(self):
     if self.image_caption:
         md = util.markdown_convert(self.image_caption,
                                    self.build.synonyms)[1]
         terms = md.terms + self.terms
         return terms
     else:
         return self.terms
コード例 #3
0
 def get_html_text(self):
   md = util.markdown_convert(self.text, self.build.synonyms)
   self.md = md[1]
   try:
     self.images = [image.Image(self.build, i) for i in self.md.images]
   except util.GenException as e:
     raise util.GenException(str(e) + ' (wanted by "' + self.get_local_path() + '")')
   return md[0]
コード例 #4
0
  def generate_html(self, template_list):
    page_variables = {}
    variables = {}
    
    variables['shortname'] = self.shortname
    
    variables['title'] = self.title
    variables['authors'] = self.get_html_authors(template_list)
    
    variables['category'] = self.category
    
    variables['text'] = self.get_html_text()
    
    variables['publish-date'] = time.strftime('%b %d, %Y %I %p (UTC)', time.gmtime(self.publish_date))
    variables['publish-date-epoch'] = self.publish_date
    
    variables['header-classes'] = ''
    
    if self.hero.image_used:
      variables['hero'] = self.hero.get_output_path()
      variables['hero-thumb'] = self.hero.get_output_path_thumb()
      variables['hero-caption'] = util.markdown_convert(self.hero.image_caption or '')[0]
      variables['hero-credit'] = util.markdown_convert(self.hero.image_credit or '')[0]
      if self.hero.image_caption:
        variables['header-classes'] += ' has-caption'
      variables['header'] = template_list.get_raw('post-header-hero', variables)
    else:
      variables['header'] = template_list.get_raw('post-header', variables)

    variables['shortlink'] = self.get_shortlink()

    variables['text'] = self.modify_text(variables['text'])
    
    page_variables['title'] = self.title
    page_variables['pagetype'] = self.category + ' post'
    return template_list.get('post', variables, page_variables)
コード例 #5
0
  def generate_missing_terms(self):
    text = open(os.path.join(dirs.src, 'missing-term.md')).read()
    for term in self.get_missing_terms():
      title = 'The entry for "' + term + '" does not exist.'
      
      page_variables = {}
      variables = {}
      
      page_variables['title'] = title
      page_variables['pagetype'] = 'missing-term'

      variables['title'] = title
      variables['text'] = util.markdown_convert(text.format(term=term))[0]

      filename = os.path.join(util.category_dir('term'), term, 'index.html')
      util.save_to(filename, self.template_list.get('missing-term', variables, page_variables))
コード例 #6
0
    def generate_missing_terms(self):
        text = open(os.path.join(dirs.src, 'missing-term.md')).read()
        for term in self.get_missing_terms():
            title = 'The entry for "' + term + '" does not exist.'

            page_variables = {}
            variables = {}

            page_variables['title'] = title
            page_variables['pagetype'] = 'missing-term'

            variables['title'] = title
            variables['text'] = util.markdown_convert(
                text.format(term=term))[0]

            filename = os.path.join(util.category_dir('term'), term,
                                    'index.html')
            util.save_to(
                filename,
                self.template_list.get('missing-term', variables,
                                       page_variables))