def replacements_for(self, original, data):
        """Replace all instances of graphics with an img tag"""
        context = {'url': data['url'], 'alt': data['alt']}
        if 'thumb_url' in data:
            context['thumb_url'] = data['thumb_url']

        yield utils.render_template(self.template, context)
 def replacements_for(self, original, data):
     key_term = {
         'key_term': original,
         'phrase': self.remove_punctuation(original)
     }
     context = {'key_term': key_term}
     yield utils.render_template(self.template, context)
Example #3
0
 def replacement_for(self, original, data):
     """ Create the link that takes you to the definition of the term. """
     citation = data['ref']
     # term = term w/o pluralization
     term = self.layer['referenced'][citation]['term']
     citation = self.layer['referenced'][citation]['reference_split']
     key = (original, tuple(citation))
     if key not in self.rendered:
         context = {'citation': {
             'url': self.rev_urls.fetch(citation, self.version,
                                        self.sectional),
             'label': original,
             'term': term,
             'definition_reference': '-'.join(to_markup_id(citation))}}
         rendered = utils.render_template(self.template, context)
         self.rendered[key] = rendered
     return self.rendered[key]
Example #4
0
 def replacement_for(self, original, data):
     """ Create the link that takes you to the definition of the term. """
     citation = data['ref']
     # term = term w/o pluralization
     term = self.layer['referenced'][citation]['term']
     citation = self.layer['referenced'][citation]['reference_split']
     key = (original, tuple(citation))
     if key not in self.rendered:
         context = {
             'citation': {
                 'url':
                 self.rev_urls.fetch(citation, self.version,
                                     self.sectional),
                 'label':
                 original,
                 'term':
                 term,
                 'definition_reference':
                 '-'.join(to_markup_id(citation))
             }
         }
         rendered = utils.render_template(self.template, context)
         self.rendered[key] = rendered
     return self.rendered[key]
Example #5
0
 def replacements_for(self, original, data):
     key_term = {'key_term': original,
                 'phrase': self.remove_punctuation(original)}
     context = {'key_term': key_term}
     yield utils.render_template(self.template, context)
Example #6
0
 def replacements_for(self, original, data):
     context = {'paragraph': original}
     yield utils.render_template(self.template, context)
Example #7
0
    def replacements_for(self, original, data):
        stripped = self.TO_STRIP_RE.sub('', original)

        context = {'paragraph': original, 'paragraph_stripped': stripped}
        yield utils.render_template(self.template, context)
 def replacements_for(self, original, data):
     context = {'paragraph': original}
     yield utils.render_template(self.template, context)
    def replacements_for(self, original, data):
        stripped = self.TO_STRIP_RE.sub('', original)

        context = {'paragraph': original, 'paragraph_stripped': stripped}
        yield utils.render_template(self.template, context)
Example #10
0
 def replacements_for(self, text, data):
     yield utils.render_template(self.template, data)
    def replacements_for(self, original, data):
        stripped = original.replace('(', '').replace(')', '').replace('.', '')

        context = {'paragraph': original, 'paragraph_stripped': stripped}
        yield utils.render_template(self.template, context)