diff options
author | defanor <defanor@uberspace.net> | 2017-12-25 19:20:40 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2017-12-25 19:20:40 +0300 |
commit | b627b6b13cf860df11efc8d1b0df75ed129f361a (patch) | |
tree | 59478e8c670bdb82d514addb7f0ec3206b5ab1bc | |
parent | 340c52572212a1918a8ac1e5faac8cb5a5cc079a (diff) |
Provide absolute URIs for pancake.el
-rw-r--r-- | Pancake/Printing.hs | 10 | ||||
-rw-r--r-- | pancake.el | 13 |
2 files changed, 13 insertions, 10 deletions
diff --git a/Pancake/Printing.hs b/Pancake/Printing.hs index 5ef3a81..6778ac8 100644 --- a/Pancake/Printing.hs +++ b/Pancake/Printing.hs @@ -110,10 +110,12 @@ showSexps uri ro = , showDenotation d , showSexp s] showDenotation :: Denotation -> String - showDenotation (Link u) = list ["link", ".", encodeSexpStr $ show u] - showDenotation (Image u) = list ["image", ".", encodeSexpStr $ show u] - showDenotation (Math m) = list ["math", ".", encodeSexpStr m] - showDenotation (Heading l) = list ["heading", ".", show l] + showDenotation (Link u) = list [ "link", encodeSexpStr $ show u + , encodeSexpStr $ show $ relativeTo u uri] + showDenotation (Image u) = list [ "image", encodeSexpStr $ show u + , encodeSexpStr $ show $ relativeTo u uri] + showDenotation (Math m) = list ["math", encodeSexpStr m] + showDenotation (Heading l) = list ["heading", show l] -- | Merge elements with the same styling. mergeStyled :: [Styled] -> [Styled] @@ -200,8 +200,7 @@ while avoiding code duplication." (defun pancake-button-action (button) "An action to be invoked on button activation." - (funcall 'browse-url (or (button-get button 'pancake-link) - (button-get button 'pancake-image)))) + (funcall 'browse-url (button-get button 'pancake-absolute-uri))) (defun pancake-print-elem (element) "Translate ELEMENT into a string." @@ -225,23 +224,25 @@ while avoiding code duplication." (`(superscript . ,rest) (pancake-print-line rest) (add-text-properties start (point) '(display (raise 0.2)))) - (`(denotation (math . ,_formula) . ,rest) + (`(denotation (math ,_formula) . ,rest) (pancake-print-line rest)) - (`(denotation (link . ,uri) . ,rest) + (`(denotation (link ,uri ,absolute-uri) . ,rest) (pancake-print-line rest) (make-text-button start (point) 'pancake-link uri + 'pancake-absolute-uri absolute-uri 'help-echo uri 'follow-link t 'action #'pancake-button-action)) - (`(denotation (image . ,uri) . ,rest) + (`(denotation (image ,uri ,absolute-uri) . ,rest) (pancake-print-line rest) (make-text-button start (point) 'pancake-image uri + 'pancake-absolute-uri absolute-uri 'help-echo uri 'follow-link t 'action #'pancake-button-action)) - (`(denotation (heading . ,level) . ,rest) + (`(denotation (heading ,level) . ,rest) (pancake-print-line rest) (add-to-list 'pancake-headings (cons (line-number-at-pos) level)) (add-text-properties start (point) |