예제 #1
0
    def _render(self, obj, storage, env_storage):
        if obj.numbered:
            image_counter = env_storage.get(Environment.CURRENT_IMAGE, \
              ImageCounter())
            image_counter.advance()

        figure_counter_span = u"""
      <div class="image-counter-block">
        <span class="counter image-counter">Figure {0}</span>
      </div>""".format(image_counter) if obj.numbered else ''

        caption_span = u"""
      <span class="caption-text">{0}</span>"""\
          .format(self._format_key(storage.insert(obj.description))) \
          if obj.description else ''

        caption_div = u"""
    <div class="caption">{0}{1}
    </div>""".format(figure_counter_span, caption_span) \
          if figure_counter_span or caption_span else ''

        img_center = u' style="margin: 0 auto;"' if obj.center else ''

        img_width = u' width="{}"'.format(obj.width) if obj.width else ''

        return u"""
  <div class="figure clearfix">
    <div class="img clearfix">
      <img src="{0}" alt="{1}"{3}{4} />
    </div>{2}
  </div>""".format(obj.image_url, Util.html_attribute(obj.alt_caption),
                   caption_div, img_center, img_width)
예제 #2
0
    def _render(self, obj, storage, env_storage):
        from n0ted0wn.Block.Renderer import Renderer

        block_renderer = Renderer(self.style_cls, storage, env_storage)
        markups = block_renderer.render(obj.blocks_list)
        return u"""<div style="color: {0};">{1}</div>""".format(
            Util.html_attribute(obj.color), markups)
예제 #3
0
    def _render(self, obj, storage, env_storage):
        if obj.numbered:
            image_counter = env_storage.get(Environment.CURRENT_IMAGE, ImageCounter())
            image_counter.advance()

        figure_counter_span = (
            u"""
      <div class="image-counter-block">
        <span class="counter image-counter">Figure {0}</span>
      </div>""".format(
                image_counter
            )
            if obj.numbered
            else ""
        )

        caption_span = (
            u"""
      <span class="caption-text">{0}</span>""".format(
                self._format_key(storage.insert(obj.description))
            )
            if obj.description
            else ""
        )

        caption_div = (
            u"""
    <div class="caption">{0}{1}
    </div>""".format(
                figure_counter_span, caption_span
            )
            if figure_counter_span or caption_span
            else ""
        )

        return u"""
  <div class="figure clearfix">
    <div class="img clearfix">
      <img src="{0}" alt="{1}" />
    </div>{2}
  </div>""".format(
            obj.image_url, Util.html_attribute(obj.alt_caption), caption_div
        )
예제 #4
0
 def _render(cls, inline, final_process):
     link = inline.content[0]
     if not link.startswith('http'):
         link = 'http://' + link
     return u'<a href="{0}">{1}</a>'.format(
         Util.html_attribute(link), final_process(inline.content[1]))
예제 #5
0
 def _render(cls, inline, final_process):
   link = inline.content[0]
   if not link.startswith('http'):
     link = 'http://' + link
   return u'<a href="{0}">{1}</a>'.format(
     Util.html_attribute(link), final_process(inline.content[1]))
예제 #6
0
    def _render(self, obj, storage, env_storage):
        from n0ted0wn.Block.Renderer import Renderer

        block_renderer = Renderer(self.style_cls, storage, env_storage)
        markups = block_renderer.render(obj.blocks_list)
        return u"""<div style="color: {0};">{1}</div>""".format(Util.html_attribute(obj.color), markups)