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

[1.5.6] Warning "stylesheet does not exist or cannot be read" #2323

Closed
JBR69 opened this issue Jul 19, 2017 · 7 comments
Closed

[1.5.6] Warning "stylesheet does not exist or cannot be read" #2323

JBR69 opened this issue Jul 19, 2017 · 7 comments
Assignees
Labels
Milestone

Comments

@JBR69
Copy link

JBR69 commented Jul 19, 2017

In version 1.5.6, i have always a warning

[node-warn 12:19:38 PM] asciidoctor: WARNING: F:/Documentations/asciidoc/sources/fr/documents/Generic/a.adoc: stylesheet does not exist or cannot be read: F:/Documentations/asciidoc/sources/fr/documents/Generic/myTheme.css

Parameters of my adoc

:commonResourcesDir: ../../../resources
:linkcss:
:stylesdir: ../../../resources/css
:stylesheet: myTheme.css

Why Asciidoctor search CSS in document directory (F:/Documentations/asciidoc/sources/fr/documents/Generic)
and not in stylesdir (../../../resources/css --> F:/Documentations/asciidoc/sources/resources/css ) ?

Jérôme

@mojavelinux
Copy link
Member

Very likely you're not setting the safe mode option to unsafe when invoking Asciidoctor. That is required in order to resolve a path which is above the document directory (or base directory).

I see you are using node, so you must be using Asciidocotor.js. Can you provide more details about how Asciidoctor is being invoked?

@mojavelinux mojavelinux added this to the support milestone Jul 21, 2017
@mojavelinux mojavelinux self-assigned this Jul 21, 2017
@mojavelinux
Copy link
Member

Actually, never mind. This is definitely a regression. I don't know what's happening yet, but it is definitely new in 1.5.6.

@mojavelinux mojavelinux modified the milestones: v1.5.6.1, support Jul 21, 2017
@mojavelinux
Copy link
Member

Aha, now I see. This isn't a regression. 1.5.6 just fixed a missing warning message (#2089). The processor was always failing to copy the stylesheet in your case, it just wasn't telling you about it until now.

The reason it isn't copying the stylesheet is because you have your settings backwards. When using linkcss, the other attributes should be defined as follows:

  • stylesdir should point to the destination directory
  • stylesheet should be the name of the stylesheet
  • copycss should be the path of the source stylesheet

Thus, the settings in your case would be as follows:

:linkcss:
:stylesdir: css
:stylesheet: myTheme.css
:copycss: ../../../resources/css/{stylesheet}

That will copy the stylesheet to css/myTheme.css and link to it.

If you don't want to copy the stylesheet, then unset copycss. In that case, stylesdir and stylesheet point to the source location of the stylesheet.

@mojavelinux
Copy link
Member

Actually, there is a case to make for compatibility. Although the warning was missing before, it was still working for you. That's because the destination path already exists, so there's no need to copy. So I can add a check for that.

mojavelinux added a commit to mojavelinux/asciidoctor that referenced this issue Jul 21, 2017
…and dest already exists

- change warning to preserve legacy scenario
@mojavelinux
Copy link
Member

I changed it so that it will only warn if the destination file doesn't already exist. We'll assume that if the destination file already exists, and there is no source file to copy, that you didn't want to copy the stylesheet at all.

The workaround for you is to simply unset copycss:

:!copycss:

@JBR69
Copy link
Author

JBR69 commented Jul 21, 2017

It's Ok with :!copycss:
Thanks for your great reactivity

@mojavelinux
Copy link
Member

And thank you for reporting! I'm glad this fix could make it into 1.5.6.1.

mojavelinux added a commit to mojavelinux/asciidoctor that referenced this issue Jul 22, 2017
…and dest already exists

- change warning to preserve legacy scenario
mojavelinux added a commit to mojavelinux/asciidoctor that referenced this issue Jul 22, 2017
…and dest already exists

- change warning to preserve legacy scenario
mojavelinux added a commit to mojavelinux/asciidoctor that referenced this issue Jul 22, 2017
…and dest already exists

- change warning to preserve legacy scenario
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants