Readme.rst 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. Summary
  2. -------
  3. This plugin allows easy, variable length summaries directly embedded into the
  4. body of your articles. It introduces two new settings: ``SUMMARY_BEGIN_MARKER``
  5. and ``SUMMARY_END_MARKER``: strings which can be placed directly into an article
  6. to mark the beginning and end of a summary. When found, the standard
  7. ``SUMMARY_MAX_LENGTH`` setting will be ignored. The markers themselves will also
  8. be removed from your articles before they are published. The default values
  9. are ``<!-- PELICAN_BEGIN_SUMMARY -->`` and ``<!-- PELICAN_END_SUMMARY -->``.
  10. For example::
  11. Title: My super title
  12. Date: 2010-12-03 10:20
  13. Tags: thats, awesome
  14. Category: yeah
  15. Slug: my-super-post
  16. Author: Alexis Metaireau
  17. This is the content of my super blog post.
  18. <!-- PELICAN_END_SUMMARY -->
  19. and this content occurs after the summary.
  20. Here, the summary is taken to be the first line of the post. Because no
  21. beginning marker was found, it starts at the top of the body. It is possible
  22. to leave out the end marker instead, in which case the summary will start at the
  23. beginning marker and continue to the end of the body.
  24. If no beginning or end marker is found, and if ``SUMMARY_USE_FIRST_PARAGRAPH``
  25. is enabled in the settings, the summary will be the first paragraph of the post.
  26. The plugin also sets a ``has_summary`` attribute on every article. It is True
  27. for articles with an explicitly-defined summary, and False otherwise. (It is
  28. also False for an article truncated by ``SUMMARY_MAX_LENGTH``.) Your templates
  29. can use this e.g. to add a link to the full text at the end of the summary.
  30. reST example
  31. ~~~~~~~~~~~~
  32. Inserting the markers into a reStructuredText document makes use of the
  33. comment directive, because raw HTML is automatically escaped. The reST equivalent of the above Markdown example looks like this::
  34. My super title
  35. ##############
  36. :date: 2010-12-03 10:20
  37. :tags: thats, awesome
  38. :category: yeah
  39. :slug: my-super-post
  40. :author: Alexis Metaireau
  41. This is the content of my super blog post.
  42. .. PELICAN_END_SUMMARY
  43. and this content occurs after the summary.