diff --git a/org/html_writer.go b/org/html_writer.go index d66e6ef..561067a 100644 --- a/org/html_writer.go +++ b/org/html_writer.go @@ -342,6 +342,9 @@ func (w *HTMLWriter) WriteRegularLink(l RegularLink) { if l.Protocol == "file" { url = url[len("file:"):] } + if (l.Protocol == "file" || l.Protocol == "") && strings.HasSuffix(url, ".org") { + url = strings.TrimSuffix(url, ".org") + ".html" + } if prefix := w.document.Links[l.Protocol]; prefix != "" { url = html.EscapeString(prefix) + strings.TrimPrefix(url, l.Protocol+":") } diff --git a/org/testdata/inline.html b/org/testdata/inline.html index 0df8ec5..a58f2ab 100644 --- a/org/testdata/inline.html +++ b/org/testdata/inline.html @@ -67,6 +67,9 @@ not emphasized/

regular link to a file (image) my-img.png

  • +

    regular link to an org file (extension replaced with html) inline.html / ../testdata/inline.html

    +
  • +
  • regular link to a file (video)

  • diff --git a/org/testdata/inline.org b/org/testdata/inline.org index a81e24c..5d66de5 100644 --- a/org/testdata/inline.org +++ b/org/testdata/inline.org @@ -25,12 +25,13 @@ 1. regular link [[https://example.com]] link without description 2. regular link [[https://example.com][example.com]] link with description 3. regular link to a file (image) [[file:my-img.png]] - 4. regular link to a file (video) [[my-video.mp4]] - 5. regular link to http (image) [[http://placekitten.com/200/200#.png]] - 6. regular link to https (image) [[https://placekitten.com/200/200#.png]] - 7. regular link with image as description [[https://placekitten.com][https://placekitten.com/200/200#.png]] - 8. regular link enclosed in [] [[[https://www.example.com]]] [[[https://www.example.com][example.com]]] - 9. auto link, i.e. not inside =\[[square brackets]\]= https://www.example.com + 4. regular link to an org file (extension replaced with html) [[file:inline.org]] / [[../testdata/inline.org]] + 5. regular link to a file (video) [[my-video.mp4]] + 6. regular link to http (image) [[http://placekitten.com/200/200#.png]] + 7. regular link to https (image) [[https://placekitten.com/200/200#.png]] + 8. regular link with image as description [[https://placekitten.com][https://placekitten.com/200/200#.png]] + 9. regular link enclosed in [] [[[https://www.example.com]]] [[[https://www.example.com][example.com]]] + 10. auto link, i.e. not inside =\[[square brackets]\]= https://www.example.com - timestamps - <2019-01-06> - <2019-01-06 Sun> diff --git a/org/testdata/inline.pretty_org b/org/testdata/inline.pretty_org index acf70d6..c9841a9 100644 --- a/org/testdata/inline.pretty_org +++ b/org/testdata/inline.pretty_org @@ -25,12 +25,13 @@ 1. regular link [[https://example.com]] link without description 2. regular link [[https://example.com][example.com]] link with description 3. regular link to a file (image) [[file:my-img.png]] - 4. regular link to a file (video) [[my-video.mp4]] - 5. regular link to http (image) [[http://placekitten.com/200/200#.png]] - 6. regular link to https (image) [[https://placekitten.com/200/200#.png]] - 7. regular link with image as description [[https://placekitten.com][https://placekitten.com/200/200#.png]] - 8. regular link enclosed in [] [[[https://www.example.com]]] [[[https://www.example.com][example.com]]] - 9. auto link, i.e. not inside =\[[square brackets]\]= https://www.example.com + 4. regular link to an org file (extension replaced with html) [[file:inline.org]] / [[../testdata/inline.org]] + 5. regular link to a file (video) [[my-video.mp4]] + 6. regular link to http (image) [[http://placekitten.com/200/200#.png]] + 7. regular link to https (image) [[https://placekitten.com/200/200#.png]] + 8. regular link with image as description [[https://placekitten.com][https://placekitten.com/200/200#.png]] + 9. regular link enclosed in [] [[[https://www.example.com]]] [[[https://www.example.com][example.com]]] + 10. auto link, i.e. not inside =\[[square brackets]\]= https://www.example.com - timestamps - <2019-01-06 Sun> - <2019-01-06 Sun>