Skip to content

Latest commit

 

History

History
65 lines (45 loc) · 1.35 KB

notes.org

File metadata and controls

65 lines (45 loc) · 1.35 KB

Notes

dtext-fontify-wiki-links

Call *dtext–match-links with args: ~last nil t [nil]~[fn:1]


pattern = conditions:

  • markdown is nil
  • wiki is t
  • url-link is nil

therefore: dtext-link-wiki-regexp

Upon match

Get match groups 1 (text) and 2 (URL).

If there is match for the text, add the appropriate text properties to the characters within that range. Similarly, if there is a match for the URL, set those characters’ properties as well.

dtext–match-links

Prohibited faces:

  • dtext-code-face

Loop

Iterate through a loop with three conditions:

  1. No match found
  2. Point has not reached the end of the search region (last)
  3. Result of a regular expression search forward is non-nill

In the body of the loop, do the following:

Check if any of the characters in the range matched by said regular expression have one or more from a list of prohibited faces. If so, the match data is cleared.


[IF BLOCK 1]

If there is a match, the match data will be structured like this:

  • URL links
    1. nil
    2. URL
  • Wiki links
    1. URL
    2. text
  • DText and Markdown links
    1. text
    2. URL

But in each of these cases, the match data is modified to make group 1 the text and group 2 the URL.

At the end,

[END IF BLOCK 1]

Footnotes

[fn:1] Bracketed args are optional args that have been omitted; their defaults were used.