spacepaste

  1.  
  2. % if not len(_args):
  3. <em>mdx_thumbnail missing arguments!</em>
  4. <% return STOP_RENDERING %>
  5. % endif
  6. <%
  7. import os
  8. #
  9. # arguments: full-size image, opt. title, opt. alt-text
  10. #
  11. fig_reference = _args[0]
  12. fig_image = '.thumbnail'.join(os.path.splitext(fig_reference))
  13. if len(_args) > 1:
  14. fig_title = _args[1]
  15. else:
  16. fig_title= ''
  17. fig_caption = fig_title
  18. if len(_args) > 2:
  19. fig_alt = _args[2]
  20. else:
  21. fig_alt= fig_title
  22. %>
  23. % if fig_caption != '':
  24. <div class="figure">
  25. %endif
  26. <a class="reference external image-reference" href="${fig_reference}" title="${fig_title}"><img alt="${fig_alt}" src="${fig_image}"></a>
  27. %if fig_caption != '':
  28. <p class="caption">${fig_caption}</p>
  29. </div>
  30. %endif
  31.