Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency problems with XSL filter and xsl:include #924

Closed
draconx opened this issue Aug 2, 2016 · 9 comments · Fixed by #996
Closed

Dependency problems with XSL filter and xsl:include #924

draconx opened this issue Aug 2, 2016 · 9 comments · Fixed by #996

Comments

@draconx
Copy link

draconx commented Aug 2, 2016

Hi,

When using an XSL layout, nanoc does not seem to recognize included stylesheets as dependencies, and will not rebuild output files when the included stylesheets change.

I'd be happy with listing dependencies manually but as far as I can tell there is no way to do this; actually, I can't find anything in the documentation about how nanoc decides whether or not to rebuild a particular output file.

Attached example site. Build the site with nanoc, which generates output/index.xhtml. Then edit layouts/snippet.xsl (for example, change the page title). Expected behaviour is that rebuilding the site will update output/index.xhtml, but this does not happen.

Cheers,
Nick

xsltdemo.tar.gz: https://github.com/nanoc/nanoc/files/397694/xsltdemo.tar.gz

@denisdefreyne
Copy link
Member

Nanoc indeed currently doesn’t handle dependencies xsl:include. It needs to be done manually, and I fear that this might not be an easy task, since it needs to handle transitive dependencies as well.

Marking as a bug, although it’s arguably perhaps a lacking feature.

@denisdefreyne
Copy link
Member

As a workaround, you can delete the tmp directory in between builds. That directory stores dependency information, and lack of dependency information means that Nanoc will do a full rebuild. For sure not ideal, but it’ll help.

@denisdefreyne
Copy link
Member

Ohh, I got this wrong. The problem is that there is not even a dependency from the item on the layout. A fix is coming up.

@denisdefreyne
Copy link
Member

#996 has a fix for this issue.

@denisdefreyne
Copy link
Member

Ack, nevermind—I’ve discovered a related issue, but the xsl:include elements not generating a dependency is still an open issue.

@denisdefreyne denisdefreyne removed this from the 4.4.1 milestone Nov 20, 2016
denisdefreyne added a commit that referenced this issue Nov 20, 2016
Make DocumentViewMixin#raw_content generate dependency
@denisdefreyne denisdefreyne reopened this Nov 22, 2016
@denisdefreyne
Copy link
Member

Accidentally automatically closed via a Git commit, sorry!

@denisdefreyne
Copy link
Member

This issue is still relevant, but I believe that there is no way to fix this in a nice way. I have two ideas:

  • Make the xsl filter depend on all items that have an xsl extension (either /**/*.xsl or item[:extension] == 'xsl'. This isn’t nice because it might tax Nanoc’s dependency generator a bit much.

  • Mark the xsl filter as always needing to be run, skipping the outdatedness check. This also isn’t super nice, and requires some changes in Nanoc to support this.

A proper solution might not be possible with Nokogiri (Nanoc would have to be able to generate the dependency graph of xsl:includes, which I don’t think is possible).

@denisdefreyne
Copy link
Member

I have a fix in #1127. This fix marks the xsl filter always needing to be run (always marking the item rep as outdated). This isn’t ideal, but I couldn’t find a simple way to make Nokogiri report its dependencies (finding all xsl:include/xsl:import).

The fix will be in Nanoc 4.7.1.

@denisdefreyne
Copy link
Member

Fixing this also closed the last known open issue in Nanoc!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants