From: David G. <go...@us...> - 2002-08-21 22:57:03
|
Kenichi Sato wrote: > I have the same problem and it is even worth for me because the > driver letter (yes, I'm trying on Windows!) is put in front of the > stylesheet path when it becomes the absolute one > (e.g. href="z:/default.css"). This is not what I expected and > totally useless if I want to publish the html pages through a web > server. In my case, the trick found by Adam (specifying "../..." > path) doesn't help either. You must be writing the HTML to a different disk than the one containing the source file or stylesheet. Is this so? I hadn't thought about that case. If that's not the case, please show us the command you use (and any config files) which result in ``href="z:/default.css"``. > I understand the benefit of modifying the pathname to relative > one, but it would be better if we had an option to turn it off. I agree. I'm not certain of the best approach as yet. Here are the latest notes: Fix the absolute/relative path handling. All references to files (stylesheet, source file [in footer], PEP template) are interpreted relative to the current working directory, and adjusted relative to the destination directory. For example:: cd /work html.py -s --stylesheet=default.css /src/test.txt /dst/text.html This will interpret the stylesheet as "/work/default.css", so the stylesheet link in the HTML (which is written to the /dst dir) will read "../work/default.css", and the source link (-s option) will read "../src/test.txt". - Perhaps the current behavior should be optional ("--relative-paths" or something). The default could be not to process paths at all, just use them verbatim. - We could add an "--verbatim-paths" option, which indicates that paths should not be modified at all. - Use variant options, such as "--stylesheet-url=URL", which wouldn't be interpreted as paths. Or leave "--stylesheet=URL" uninterpreted, and add an interpreted "--stylesheet-path=PATH". Paths and URLs should be treated differently. Sometimes a relative path can be treated as the equivalent of a relative URL, but that's not the case for absolute paths/URLs. The "--pep-template" value is *not* a URL, but a local file. "--stylesheet" could be either. Source links (generated in the footer) may depend on how the HTML is installed. I've been putting .html files in the same directories as the source .txt files, but there are other ways to do it, and the directory layout used at runtime may be different from the installed layout. I'd like to come up with a consistent, clean solution. Comments are welcome. 佐藤さん、フィードバックをいただいて、どうもありがとうございました。 -- David Goodger <go...@us...> Open-source projects: - Python Docutils: http://docutils.sourceforge.net/ (includes reStructuredText: http://docutils.sf.net/rst.html) - The Go Tools Project: http://gotools.sourceforge.net/ |