Include directive broken #932

Closed
laurivosandi opened this Issue Nov 25, 2013 · 9 comments

3 participants

@laurivosandi

Hi,

docutils says that include directive argument is the path to the file to be included, relative to the document containing the directive.

http://docutils.sourceforge.net/docs/ref/rst/directives.html#including-an-external-document-fragment

Currently include directives fail because nikola attempts to look up referenced files from the current working directory.

How to reproduce:

  1. Create file foo.rst in posts/
  2. Create bar.rst in posts/ and insert .. include:: foo.rst
  3. Issue nikola build
@ralsina
Nikola, a static site generator member

I am hesitant to "fix" this since it's an incompatible change in behaviour (plus, it means bad things happen when you chain includes). I may document it instead.

@laurivosandi

Current .. import:: directive behaviour is incompatible with docutils. Sphinx and others follow that convention, you're effectively making Nikola incompatible with Sphinx, docutils and others aswell.

@laurivosandi

Consider this usecase: I have bunch of blogposts in one VCS tracked directory and stories are stored in multiple VCS tracked directories. Within one directory I need to keep the .. import:: directives intact and relative to the document that includes others, because I also want to generate PDF from those stories and that requires compatiliblity with docutils.

@ralsina
Nikola, a static site generator member

Since sphinx and docutils don't work the same as each other, I can only improve that slightly. Also, compatibility to older versions of Nikola is sort of more important.

I am sorry that I can't magically fix it for you straight away, but indeed I can't.

@ralsina
Nikola, a static site generator member

Not sure what to do about this one. Maybe discuss it in the mailing list, I guess.

@ralsina ralsina added this to the Whenever milestone Apr 18, 2014
@Kwpolska
Nikola, a static site generator member

@ralsina any resolution on this one? IMO just documenting our behavior should suffice; any changes will break tons of blogs…

On a side note: does docutils have any sort of “if nikola/if sphinx” facility?

@Kwpolska Kwpolska modified the milestone: 7.5.2, Whenever Jun 11, 2015
@ralsina ralsina was assigned by Kwpolska Jun 11, 2015
@ralsina
Nikola, a static site generator member

@Kwpolska I think documenting is enough, yes. I don't understand the question, tho.

@Kwpolska
Nikola, a static site generator member

pseudocode:

.. if:: nikola

   Nikola-specific reST goes here, like the include directive with site-root-relative paths

.. if:: sphinx

   Sphinx-specific reST goes here, like the include directive with input-file-relative paths

(very unlikely to be a thing)

@ralsina
Nikola, a static site generator member

Actually, sphinx has such a thing. I could add it to Nikola :-)

@Kwpolska Kwpolska assigned Kwpolska and unassigned ralsina Jun 11, 2015
@Kwpolska Kwpolska added a commit that closed this issue Jun 11, 2015
@Kwpolska Kwpolska fix #932
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
cf33d84
@Kwpolska Kwpolska closed this in cf33d84 Jun 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment