* Improving Org links
@ 2022-02-16 3:42 Lucas V. R.
0 siblings, 0 replies; only message in thread
From: Lucas V. R. @ 2022-02-16 3:42 UTC (permalink / raw)
To: pandoc-discuss
[-- Attachment #1.1: Type: text/plain, Size: 2688 bytes --]
Hi everyone!
Recently I contributed some little yak shavings to the Org reader. I'm
doing these changes as I learn both Haskell and Org, creating a little
static generator. Now that the shavings are a bit more significant I
decided to pandoc-discuss them here.
So, Org-mode links are complicated. Pandoc does a great job in general but
some shady cases are not handled correctly and others are unsupported. I'm
fixing some of those problems in a fork. Here is a brief summary of the
changes that I'm making:
1. Part of the link logic was duplicated along the functions
`linkToInlinesF` and `selflinkOrImage`, and as an outsider I found the code
a bit complicated to grasp. So I moved all the link logic out of the
parsing functions into a more self-contained `linkToInlines` function. This
function also handles cases like images with internal or invalid links that
were not considered before.
2. Angle links (like `<https://pandoc.org>`) should be way more flexible
than plain links (like `https://pandoc.org`), but apart from the delimiters
the previous implementation treated both the same way. I changed it so like
in org-mode, most characters are allowed, including spaces and newlines in
some situations.
3. File schema links produced invalid targets in some cases.
4. I'm trying to implement internal headline links (fixing #6916), but
this seems to require changes to the org state. Discussion below.
The fork is here, with some tests:
https://github.com/jgm/pandoc/compare/master...lucasvreis:org-links
About headline links: I thought at first that the identifiers would be
available by asking about `orgStateIdentifiers` in the Future monad. But
then I realized that the headline identifiers are created *after* the
future monad runs, so they are unavailable this way.
I see two easier ways to implement it: one would be to just walk through
the document links after the identifiers are created, adjusting targets as
necessary (like a lua filter would do. Maybe just leave it for lua
filters?). The other would be to store another field in the OrgParserState
to store some relevant information about these headlines that would allow
to link to them it in the Future monad. What do you think?
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/5f60e5bd-b10e-42e7-a4e8-fd8399894a61n%40googlegroups.com.
[-- Attachment #1.2: Type: text/html, Size: 3131 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-16 3:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16 3:42 Improving Org links Lucas V. R.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).