aboutsummaryrefslogtreecommitdiffhomepage
path: root/markup/org
diff options
context:
space:
mode:
authorNiklas Fasching <[email protected]>2021-01-02 20:52:37 +0100
committerBjørn Erik Pedersen <[email protected]>2021-01-02 22:29:06 +0100
commit212e5e554284bc9368e52a512ed09be5a0224d3e (patch)
treee7fc0df35c57f144eda5258150de620d095f44d7 /markup/org
parent4fdec67b1155ae1cdf051582d9ab387286b71a07 (diff)
downloadhugo-212e5e554284bc9368e52a512ed09be5a0224d3e.tar.gz
hugo-212e5e554284bc9368e52a512ed09be5a0224d3e.zip
deps: Update go-org to v1.4.0
- Add support for pretty urls [1]. Rewrite file links: 1. replace the `.org` extension with `/` (`/foo.org` -> `/foo/`) 2. prefix unrooted links with `../` as relative links start in the fake subdirectory `/foo/` rather than `/` - Fix case-sensitivity of org drawer `:end:` [1] https://gohugo.io/content-management/urls/#pretty-urls
Diffstat (limited to 'markup/org')
-rw-r--r--markup/org/convert.go1
-rw-r--r--markup/org/convert_test.go6
2 files changed, 6 insertions, 1 deletions
diff --git a/markup/org/convert.go b/markup/org/convert.go
index 34043e18d..845ee3f3b 100644
--- a/markup/org/convert.go
+++ b/markup/org/convert.go
@@ -52,6 +52,7 @@ func (c *orgConverter) Convert(ctx converter.RenderContext) (converter.Result, e
return afero.ReadFile(c.cfg.ContentFs, filename)
}
writer := org.NewHTMLWriter()
+ writer.PrettyRelativeLinks = !c.cfg.Cfg.GetBool("uglyURLs")
writer.HighlightCodeBlock = func(source, lang string, inline bool) string {
highlightedSource, err := c.cfg.Highlight(source, lang, "")
if err != nil {
diff --git a/markup/org/convert_test.go b/markup/org/convert_test.go
index 9fc946ca6..96c388457 100644
--- a/markup/org/convert_test.go
+++ b/markup/org/convert_test.go
@@ -17,6 +17,7 @@ import (
"testing"
"github.com/gohugoio/hugo/common/loggers"
+ "github.com/spf13/viper"
"github.com/gohugoio/hugo/markup/converter"
@@ -25,7 +26,10 @@ import (
func TestConvert(t *testing.T) {
c := qt.New(t)
- p, err := Provider.New(converter.ProviderConfig{Logger: loggers.NewErrorLogger()})
+ p, err := Provider.New(converter.ProviderConfig{
+ Logger: loggers.NewErrorLogger(),
+ Cfg: viper.New(),
+ })
c.Assert(err, qt.IsNil)
conv, err := p.New(converter.DocumentContext{})
c.Assert(err, qt.IsNil)