-
Notifications
You must be signed in to change notification settings - Fork 1
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
Links URL and Relative Paths #73
Comments
I agree 100% with everything mentioned in your post. These limitations will be removed in the next PML version (the version I'm currently working on, written in Java). Absolute and relative URLs and file paths will be supported for all media assets, and the paths and URLs will no more be validated by PMLC (unless explicitly asked for). |
Wonderful! I could then finally start using PML in executable ebooks (which all use custom protocols like
The idea of allowing validation on demand is good. How are you going to implement it, via CLI option or per element via node attributes? That's actually a feature I've been pondering on in my free time, when I try to think of missing features in the various markup languages which could be added to PML. A draft idea I had in mind was the ability to enable gathering info on an image at conversion time, e.g. to calculate its width and height and inject them in the final HTML in order to ensure that its placeholder (while loading) is of the correct size. E.g. it could be something like:
where the special value <img src="pear.png" width="300"> The idea is that the special
i.e. assuming that Surely, the ability to extract metadata and info for all the various possible assets would require implementing a dedicated function for each asset type, and knowing where and how the data is stored. But maybe if PMLC could expose a public API for the This feature would be very useful when creating catalogues of assets, o handling dynamically generated html pages with lots of images (which might take time to load) which are computed at conversion time (e.g. based on the files present in a given folder), etc. |
I was already thinking of a general way that would allow to define default values for all attributes of all nodes. Default values could be defined:
Each default value can of course be explicitly overridden for each individual node in a document. Note that script nodes can also be used to define default values, as demonstrated here.
Very nice idea to optimize and automate! |
The options precedence seems good, but you should also consider introducing a precedence modifier, like the This allows to change the default precedence, e.g. by prefixing an option with the
So, if I've understood correctly, all the document options will be part of the It makes sense. Then I imagine that ultimately the nodes tree will be something like:
If end users have access to all nodes, dynamically from within the document itself (e.g. to read metadata or settings, or even change them) it could lead to very interesting use cases. E.g. conditional text could be shown depending on a metadata or setting value, and so on (e.g. omit contents if it's a sample/demo version of an eBook). |
Good point.
Yes, exactly.
Yes, meta- and config-data should be available as maps (dictionaries) in script nodes. Moreover, for each meta-data there should be an attribute (maybe named
|
That's an excellent idea. It allows to store extra info even if not actually displayed in the document. I don't like the name |
Fixed in version 3.0.0. Moreover, a shared options file, valid for all documents, as well as an |
@pml-lang, while working on the pandoc PML Writer I've started including test documents from pandoc's test suite. These are documents in various formats covering many formatting elements and their possible combinations.
Although the Lua filter is correct, many of these documents fail conversion via PMLC because they either contain images pointing to the Internet, or links with relative paths, etc., which PMLC doesn't support.
Example, a document containing a link pointing to
/url
results in the following PMLC error:I really can't understand why PMLC enforces these restrictions on links and images paths, acting like a sort of validator.
The inability to use images stored on the web, or provide links that use relative paths, or protocols others than those accepted by PMLC (from
gopher://
to MSres://
, up to custom URL Monikers) is a huge impediment in the adoption of PML for many domain specific applications:/url
link like the one from the above error message would be a normal link on a custom server.res://
protocol is essential for storing HTML documents (or images and other assets) into DLLs, and then accessing them from within an application (e.g. via the WebControl).When I think of the HTML format and it's innumerable applications (from HTML based eBook formats to software using WebComponent GUIs) I really struggle with these limitations, especially not being able to include images from the web.
Also, why should PMLC check if an image exists at all? In many documentation toolchains the images are generated on the fly, from ASCII blocks within the source document (or elsewhere), so they are deleted before each, and not available until after the conversion. Procedurally generated images are such a strong component of software documentation that I can hardly imagine working without them (think of railroad diagrams, etc.).
You should really consider either revising the way PMLC handles URL attributes, or at least provide some alternative attributes that allow handling relating paths within any URI scheme and/or custom protocols or monikers.
I fail to see the reasons for the current errors, since all of the above mentioned cases adopt the same convention for how a protocol/moniker is expressed in terms of
<name>://path/segmented/by/slashes/
.The fact that so many basic test docs from pandoc test suite are failing to build with PMLC — not due to failed pandoc to PML conversion, but because of unsupported paths/URLs in PMLC — is a strong indicator that there's something wrong with how PMLC approaches resources paths and links. All the markup syntaxes I've worked with don't attempt to validate paths and URLs (unless you specify options like embedding images as Data URIs), for they assume the author knows what he/she's doing — it could be just a document template, or the image is temporarily unreachable due to a server being done, or the HTML page is intended to be used inside a running executable app, from a DLL ... you name it, there could be hundreds of reasons why an external asset is not reachable at the specified path/URL.
I think these problems have to be solved natively, i.e. in the vanilla PML syntax, as opposed to via custom scripts or extensions.
What are the reasons behind the current way PMLC handles images paths and links? Why links are expected to be expressed via protocols, when an HTML page might simply want to link to another page in the same folder (possibly without having to resort to the
file://
protocol)?The text was updated successfully, but these errors were encountered: