Re: Single CSS for multiple, nested adoc files

Posted by mojavelinux on
URL: https://discuss.asciidoctor.org/Single-CSS-for-multiple-nested-adoc-files-tp552p604.html

Christian,

I haven't thought through this issue thoroughly yet, but I want to contribute some information that should help advance things along in the meantime. Asciidoctor has a very robust, system-neutral path resolver built-in (named PathResolver). It can calculate absolute paths, jailed paths, relative paths and the like. It may need some enhancements to do direct relative calculations between two paths...the important point is that the foundation is there for chopping up and reassembling paths.

There are several utilities in Ruby for handling file path calculation, but in my experience they are all buggy in some way. That's why I wrote the PathResolver. So we're off to a good start there :)

-Dan


On Thu, Sep 12, 2013 at 1:54 AM, ChrLipp [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi Dan,

thanks for your feedback. I could live with duplicating (or multiplying) the css, I just wanted to learn if maybe there is a solution already there which I didn't notice.

Anyway, I would like to suggest another approach and you decide if you take any action:

Solution E ::

- Copy the CSS manually.
- Link to the stylesheet with stylesdir and linkcss
- Provide an additional flag like useRelativeCssLinking which takes the adoc path and the css path and tries to compute a relative path. If this is possible, use it. If not, stick to the absolute path.

Of course the path has to be converted to / directory seperators if it is a file path and used under windows. If under window that upper case / lower case handling might also be an issue.

I don't know Ruby, but in Java this is done with http://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html#relativize(java.nio.file.Path)

Solution F ::

Don't use nested dirs, put everything in the root dir :-)

What do you say?
Kind regards, Christian


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Single-CSS-for-multiple-nested-adoc-files-tp552p574.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | http://google.com/profiles/dan.j.allen