Skip to content

Shortcodes in included rst files are not rendered #3648

Open
@orencio

Description

Environment.

$ python -V
Python 3.10.8

$ pip freeze | grep Nikola
Nikola==8.2.3

$ cat /etc/os-release
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"
PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
LOGO=archlinux-logo

$ uname -a
Linux p 6.0.11-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 02 Dec 2022 17:25:31 +0000 x86_64 GNU/Linux

Description.

Trying to include other rst file doesn't reder shorcodes:

$ grep -E 'include|example' pages/index.rst 
.. include:: ./includes/definiciones.rst
Esto es otra cosa: |example|

$ cat includes/definiciones.rst
.. |example| replace::
   {{% raw %}} <span class="logo"/> {{% /raw %}}

This doesn't render raw shortcode, only include the text as it is: {{% raw %}} <span class="logo"/> {{% /raw %}}.

I think the problem is that Nikola only render shortcodes of the main rst file and not of the included files.

Although include directive (https://docutils.sourceforge.io/docs/ref/rst/directives.html#including-an-external-document-fragment) permits specify parser parameter. If this parser may be Nikola Parser, the problem should be resolved. Something like this:

.. include::  ./includes/definiciones.rst
   :parser: nikolaParser

Is there anyway of render includes files?

Regards.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions