Exemplo n.º 1
0
    def read(self, source_path):
        """
        Parse content and metadata of Org files
        Keyword Arguments:
        source_path -- Path to the Org file to parse
        """
        with pelican_open(source_path) as text:
            text_lines = list(text.splitlines())

        header, content = self._separate_header_and_content(text_lines)
        metadatas = self._parse_metadatas(header)
        metadatas_processed = {
            key: self.process_metadata(key, value)
            for key, value in metadatas.items()
        }
        content_html = convert_html("\n".join(content),
                                    highlight=self.code_highlight)
        return content_html, metadatas_processed
    def read(self, source_path):
        """
        Parse content and metadata of Org files
        Keyword Arguments:
        source_path -- Path to the Org file to parse
        """
        with pelican_open(source_path) as text:
            text_lines = list(text.splitlines())

        header, content = self._separate_header_and_content(text_lines)
        metadatas = self._parse_metadatas(header)
        metadatas_processed = {
            key
            : self.process_metadata(key, value)
            for key, value in metadatas.items()
        }
        content_html = convert_html("\n".join(content),
                                    highlight=self.code_highlight)
        return content_html, metadatas_processed
Exemplo n.º 3
0
 def _orgco_convert(self):
     content = cgi.escape(self.raw_content, quote=True)
     html = orgco.convert_html(content)
     return html
Exemplo n.º 4
0
    def render(self, context):
        highlight = 'highlight' in self.args

        output = self.nodelist.render(context)
        output = convert_html(output, highlight=highlight)
        return output
Exemplo n.º 5
0
 def _orgco_convert(self):
     html = orgco.convert_html(self.raw_content)
     return self._escape(html)
Exemplo n.º 6
0
def test_html_with_header_shortcut():
    html = convert_html(load_data('table03.org'), header=True)
    expected = '\n'.join(load('html_with_header.html'))
    assert html == expected
Exemplo n.º 7
0
def test_html_with_highlight():
    html = convert_html(load_data('code01.org'), highlight=True)
    expected = '\n'.join(load('code01.html'))
    assert html == expected
Exemplo n.º 8
0
def test_html_shortcut():
    html = convert_html(load_data('table03.org'))
    expected = '\n'.join(load('table03.html'))
    assert html == expected