org_reader.py 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # Copyright (C) 2017 Sébastien Gendre
  2. # This program is free software: you can redistribute it and/or modify
  3. # it under the terms of the GNU General Public License as published by
  4. # the Free Software Foundation, either version 3 of the License, or
  5. # (at your option) any later version.
  6. # This program is distributed in the hope that it will be useful,
  7. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. # GNU General Public License for more details.
  10. # You should have received a copy of the GNU General Public License
  11. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  12. import re
  13. from orgpython import org_to_html
  14. from pelican import signals
  15. from pelican.readers import BaseReader
  16. from pelican.utils import pelican_open
  17. class OrgReader(BaseReader):
  18. """Reader for Org files"""
  19. enabled = True
  20. file_extensions = ['org']
  21. def _separate_header_and_content(self, text_lines):
  22. """
  23. From a given Org text, return the header separate from the content.
  24. The given text must be separate line by line and be a list.
  25. The return is a list of two items: header and content.
  26. Theses two items are text separate line by line in format of a list
  27. Keyword Arguments:
  28. text_lines -- A list, each item is a line of the texte
  29. Return:
  30. [
  31. header -- A list, each item is a line of the texte
  32. content -- A list, each item is a line of the texte
  33. ]
  34. """
  35. pass
  36. def _parse_metadata(self, text_lines):
  37. """
  38. From a given Org text, return the metadatas
  39. Keyword Arguments:
  40. text_lines -- A list, each item is a line of the texte
  41. Return:
  42. A dict containing metadatas
  43. """
  44. pass