예제 #1
0
 def _process_markup(self):
     """
     Returns the entry with content elements processed by markup and typogrify.
     """
     self.summary_processed = typogrify(formatter(self.summary))
     self.body_processed = typogrify(formatter(self.body))
     self.footnotes_processed = typogrify(formatter(self.footnotes))
     return self
예제 #2
0
def apply_markup(value, arg=None):
    """
    Applies text-to-HTML conversion.
    
    Takes an optional argument to specify the name of a filter to use.
    
    """
    if arg is not None:
        return mark_safe(formatter(value, filter_name=arg))
    return formatter(value)
예제 #3
0
def apply_markup(value, arg=None):
    """
    Applies text-to-HTML conversion.
    
    Takes an optional argument to specify the name of a filter to use.
    
    """
    if arg is not None:
        return mark_safe(formatter(value, filter_name=arg))
    return formatter(value)
예제 #4
0
 def save(self):
     """
     A custom save method to transform and store the text-to-HTML conversions.
     
     """
     if self.summary_txt:
         self.summary = formatter(self.summary_txt)
     self.body = formatter(self.body_txt)
     super(Entry, self).save()
     self.tags = self.tag_list
예제 #5
0
파일: models.py 프로젝트: jpbougie/blog
   def save(self, force_insert=False, force_update=False):
       if self.summary:
           self.summary_html = formatter(self.summary, filter_name=self.format)
           if typogrify:
               self.summary_html = typogrify(self.summary_html)
 
       self.body_html = formatter(self.body, filter_name=self.format)
       if typogrify:
           self.body_html = typogrify(self.body_html)
       super(Entry, self).save(force_insert, force_update)
예제 #6
0
 def save(self):
     if not self.id and self.post_elsewhere:
         import pydelicious
         try:
             pydelicious.add(settings.DELICIOUS_USER, settings.DELICIOUS_PASSWORD, smart_str(self.url), smart_str(self.title), smart_str(self.tags))
         except:
             pass # TODO: don't just silently quash a bad del.icio.us post
     if self.description:
         self.description_html = formatter(self.description)
     super(Link, self).save()
예제 #7
0
 def _process_markup(self):
     self.html_teaser =  typogrify(formatter(self.teaser))
     self.html_summary =  typogrify(formatter(self.summary))
     self.html_body =  typogrify(formatter(self.body))
     self.html_pull_quote =  typogrify(formatter(self.pull_quote))
     self.html_lead_caption =  typogrify(formatter(self.lead_caption))
     self.html_sidebar_caption =  typogrify(formatter(self.sidebar_caption))
     self.html_inline_caption =  typogrify(formatter(self.inline_caption))
     return self
예제 #8
0
    def save(self, *args, **kwargs):
        current_timestamp = datetime.datetime.now()
        self.rendered_text = formatter(self.raw_text)

        if not self.pk and not settings.DEBUG:
            from django.contrib.sitemaps import ping_google
            try:
                ping_google()
            except:
                pass

        if not self.is_draft:
            if not self.published_on:
                self.published_on = current_timestamp
            self.updated_on = current_timestamp

        super(Post, self).save(*args, **kwargs)
예제 #9
0
 def save(self, force_insert=False, force_update=False):
     if self.markup <> self.NO_MARKUP:
         if self.markup == self.RAW_MARKUP:
             markup_formatter = None
         else:
             markup_formatter = self.markup
        
         media_url = self.get_media_url()
     
         parts = publish_parts(self.body,markup_formatter,media_url=media_url)
         self.toc = parts['toc']
         if self.abstract:
             self.abstract_html = formatter(self.abstract,filter_name=markup_formatter,
                             **settings.MARKUP_SETTINGS[markup_formatter])
         else:
             if parts['summary']:
                 self.abstract_html = parts['summary']
         self.body_html = parts['body']
         
     super(CommonArticleInfo,self).save(force_insert, force_update)
예제 #10
0
 def save(self):
     self.description_html = formatter(self.description)
     super(Category, self).save()
예제 #11
0
 def save(self, force_insert=False, force_update=False):
     self.description_html = formatter(self.description)
     super(Part, self).save(force_insert, force_update)
예제 #12
0
 def save(self):
     self.position_summary = formatter(self.position_summary_txt)
     self.position = formatter(self.position_txt)
     super(Issue, self).save()
     self.tags = self.tag_list
예제 #13
0
 def save(self, force_insert=False, force_update=False):
     self.description_html = formatter(self.description)
     super(Part, self).save(force_insert, force_update)
예제 #14
0
def process(html, filter_name):
    html = formatter(html, filter_name=filter_name,
                     **MARKUP_FILTER_OPTS.get(filter_name, {}))
    if html:
        return clean_html(html, **LXML_CLEAN_OPTS)
    return u''
예제 #15
0
 def save(self,force_insert=False, force_update=False, *args, **kwargs):
     self.changes_html = formatter(self.changes or ' ')
     super(Build, self).save(force_insert, force_update, *args, **kwargs)
예제 #16
0
 def save(self):
     self.description_html = formatter(self.description)
     super(Category, self).save()
예제 #17
0
 def save(self):
     if self.description:
         self.description_html =  typogrify(formatter(self.description))
     super(Category, self).save()
예제 #18
0
 def save(self, force_insert=False, force_update=False):
     self.description_html = formatter(self.description)
     self.instructions_html = formatter(self.instructions)
     super(Project, self).save(force_insert, force_update)
예제 #19
0
 def _process_markup(self):
     self.html_description = typogrify(formatter(self.description))
     self.html_commentary = typogrify(formatter(self.commentary))
     return self
예제 #20
0
 def save(self, *args, **kwargs):
     if self.excerpt:
         self.excerpt_html = formatter(self.excerpt)
     if self.body:
         self.body_html = formatter(self.body)
     super(HTMLFormattableEntryMixin, self).save(*args, **kwargs)
예제 #21
0
 def save(self):
     kwargs = self._config_formatter()
     if self.excerpt:
         self.excerpt_html = formatter(self.excerpt,**kwargs)
     self.body_html = formatter(self.body,**kwargs)
     super(Entry, self).save()
예제 #22
0
 def save(self):
     if self.excerpt:
         self.excerpt_html = formatter(self.excerpt)
     self.body_html = formatter(self.body)
     super(Entry, self).save()
예제 #23
0
 def _process_markup(self):
     self.html_image_caption =  typogrify(formatter(self.image_caption))
     return self
예제 #24
0
 def save(self, force_insert=False, force_update=False):
     self.description_html = formatter(self.description)
     self.instructions_html = formatter(self.instructions)
     super(Project, self).save(force_insert, force_update)
예제 #25
0
 def _process_markup(self):
     self.html_text =  typogrify(formatter(self.text))