Skip to content

Be able to use #+LINK definitions for URL shortcuts #107

@bam93

Description

@bam93

The functionality I was most missing in lazyblorg is to be able to use tags for URL links (eg define a #+LINK: tag https://url.org/ in the org file and then use [[tag][linking to this tag]] in the actual blog text, so it is easier to check for/update dead links.

The LINK element happily also lives in a properties drawer (this is actually what I do, I have a properties drawer at the very top of the org file and put all my +LINKs in there). The way I am trying to set this up is to have one master file with all my links defined (maybe simple emacs abbreviations, I haven't quite decided) and then a couple of scripts that can easily check all my org-mode files at their top LINK definitions whether they are consistent with this master file or not (and may need to be updated/consolidated). Dead links can then easily be checked just by going through the master file.

It should in principle also be possible for the link definition not to be within the very same article they are referred to. I added a dictionary data structure to lazyblorg to manage this additional information. For now, I collect all the LINKs when URLs are parsed. In the way I implemented it, a dictionary is populated (in modified lazyblorg code) with all link definitions from all articles.

However, if there were the same tags with two different definitions, then only the last parsed would be used everywhere. That could also alternatively raise an error, if I implemented a "strict" checking. I want unique tags anyway. You mentioned that
you would not feel so optimistic about conflicting link definitions. When defining "foo" that points to site X and at a different place defining "foo" to point to site Y, this could be a big issue. So indeed that one should be able to handle with the strict checking idea, throwing an error that breaks the lazyblorg run until it is fixed in the data.

The one problem I have run into is that the parsing of [[link]] constructs and variants I have modified does not seem to apply for links in bulleted lists for instance. I haven't investigated this just yet, I guess they are maybe deferred to eg pandoc so the regexp parsing I adjusted is maybe not called in this case.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions