Le 12/04/2013 02:33, Brian Anderson a écrit :
On 04/11/2013 03:55 PM,josh...@gmail.com wrote:
Is there a reason the file path is considered relative by default
for servo's command line? It's unexpected and there is no
indication that the path isn't valid, I just get a white rect
rendered.
It is relative so that `./servo ../src/test/about-mozilla.html`
displays the expected page. That and `./servohttp://www.google.com`
are the only two use cases I've considered. I'm sure our URL handling
is dumb, so please do submit pull requests to fill in the gaps.
Hi,
What I’m doing in WeasyPrint is:
1. If the argument is an absolute URL, use that. Check if it starts with
a scheme: ^([a-zA-Z][a-zA-Z0-9.+-]+):
2. Otherwise, it’s a file path.
2.1. Make it absolute. This is platform specific. For example on Unix, a
path that starts with '/' is absolute, otherwise joined with the current
directory.
http://docs.python.org/2/library/os.path.html#os.path.abspath
2.2. Percent-encode the path. I’m a bit fuzzy here on Unicode vs. bytes,
filesystem encodings, etc.
2.3 Prepend 'file://'. You got an URL! Or is it just 'file:' that you
should prepend ? On Windows there’s also a lot of fun with UNC paths,
but I didn’t bother.
--
Simon Sapin
_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo