I have the following addition in the `conf.py`:

def setup(app):
    """Build the index entries."""
    app.connect("builder-inited", hooks.render_output)

which runs some code when I make  call to sphinx with 

sphinx-build -M html source build -


the function in that hook is simply the following: 

*import json*

*import os*

*import string*


*from pathlib import Path*


*from jinja2 import Template*


*template = """:orphan:*


*{% for p in projects %}*

*  {% set name = p.name %}*

*  {{ name }}*

*  {{ "-" * name|length }}*


*.. raw:: html*


*   <div>*

*      <p>{{ p.description }}</p>*

*   </div>*

   


*{% endfor %}*

*"""*



*def render_output(app):*

*    """Render the templated output."""*

*    root_dir = Path(app.confdir)*

*    page_template = Template(template)*

*    context = {"projects": [{'name': 'test', 'description': 'first 
line\n\rsecond line'}]}*

*    with open(os.path.join(root_dir, "test.rst"), "wb") as file_:*

*        file_.write(page_template.render(**context).encode("utf-8"))*


But when I look at the output html file I see some tags in the rendered 
output: 

*first line*

*second line</p>*

*</div>*


What is going on? Why do I see these extra tags RENDERED(!) on the html 
page? What is going wrong here?

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/eab411dc-3e89-4be5-bd1f-255068e38b04n%40googlegroups.com.

Reply via email to