summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--go.mod4
-rw-r--r--go.sum22
-rw-r--r--hugolib/case_insensitive_test.go16
-rw-r--r--hugolib/template_engines_test.go18
-rw-r--r--magefile.go2
-rw-r--r--output/layout_base.go13
-rw-r--r--scripts/fork_go_templates/.gitignore1
-rw-r--r--scripts/fork_go_templates/main.go207
-rw-r--r--tpl/cast/cast_test.go1
-rw-r--r--tpl/collections/collections.go1
-rw-r--r--tpl/collections/collections_test.go1
-rw-r--r--tpl/internal/go_templates/fmtsort/export_test.go11
-rw-r--r--tpl/internal/go_templates/fmtsort/sort.go216
-rw-r--r--tpl/internal/go_templates/fmtsort/sort_test.go246
-rw-r--r--tpl/internal/go_templates/htmltemplate/attr.go175
-rw-r--r--tpl/internal/go_templates/htmltemplate/attr_string.go16
-rw-r--r--tpl/internal/go_templates/htmltemplate/clone_test.go282
-rw-r--r--tpl/internal/go_templates/htmltemplate/content.go102
-rw-r--r--tpl/internal/go_templates/htmltemplate/content_test.go461
-rw-r--r--tpl/internal/go_templates/htmltemplate/context.go258
-rw-r--r--tpl/internal/go_templates/htmltemplate/css.go260
-rw-r--r--tpl/internal/go_templates/htmltemplate/css_test.go283
-rw-r--r--tpl/internal/go_templates/htmltemplate/delim_string.go16
-rw-r--r--tpl/internal/go_templates/htmltemplate/doc.go196
-rw-r--r--tpl/internal/go_templates/htmltemplate/element_string.go16
-rw-r--r--tpl/internal/go_templates/htmltemplate/error.go234
-rw-r--r--tpl/internal/go_templates/htmltemplate/escape.go891
-rw-r--r--tpl/internal/go_templates/htmltemplate/escape_test.go1973
-rw-r--r--tpl/internal/go_templates/htmltemplate/example_test.go184
-rw-r--r--tpl/internal/go_templates/htmltemplate/examplefiles_test.go229
-rw-r--r--tpl/internal/go_templates/htmltemplate/html.go266
-rw-r--r--tpl/internal/go_templates/htmltemplate/html_test.go99
-rw-r--r--tpl/internal/go_templates/htmltemplate/hugo_template.go33
-rw-r--r--tpl/internal/go_templates/htmltemplate/js.go418
-rw-r--r--tpl/internal/go_templates/htmltemplate/js_test.go425
-rw-r--r--tpl/internal/go_templates/htmltemplate/jsctx_string.go16
-rw-r--r--tpl/internal/go_templates/htmltemplate/state_string.go16
-rw-r--r--tpl/internal/go_templates/htmltemplate/template.go491
-rw-r--r--tpl/internal/go_templates/htmltemplate/template_test.go166
-rw-r--r--tpl/internal/go_templates/htmltemplate/transition.go592
-rw-r--r--tpl/internal/go_templates/htmltemplate/transition_test.go62
-rw-r--r--tpl/internal/go_templates/htmltemplate/url.go219
-rw-r--r--tpl/internal/go_templates/htmltemplate/url_test.go171
-rw-r--r--tpl/internal/go_templates/htmltemplate/urlpart_string.go16
-rw-r--r--tpl/internal/go_templates/texttemplate/doc.go456
-rw-r--r--tpl/internal/go_templates/texttemplate/example_test.go112
-rw-r--r--tpl/internal/go_templates/texttemplate/examplefiles_test.go184
-rw-r--r--tpl/internal/go_templates/texttemplate/examplefunc_test.go56
-rw-r--r--tpl/internal/go_templates/texttemplate/exec.go980
-rw-r--r--tpl/internal/go_templates/texttemplate/exec_test.go1624
-rw-r--r--tpl/internal/go_templates/texttemplate/funcs.go741
-rw-r--r--tpl/internal/go_templates/texttemplate/helper.go130
-rw-r--r--tpl/internal/go_templates/texttemplate/hugo_exec.go38
-rw-r--r--tpl/internal/go_templates/texttemplate/hugo_template.go85
-rw-r--r--tpl/internal/go_templates/texttemplate/multi_test.go425
-rw-r--r--tpl/internal/go_templates/texttemplate/option.go74
-rw-r--r--tpl/internal/go_templates/texttemplate/parse/lex.go666
-rw-r--r--tpl/internal/go_templates/texttemplate/parse/lex_test.go556
-rw-r--r--tpl/internal/go_templates/texttemplate/parse/node.go841
-rw-r--r--tpl/internal/go_templates/texttemplate/parse/parse.go736
-rw-r--r--tpl/internal/go_templates/texttemplate/parse/parse_test.go557
-rw-r--r--tpl/internal/go_templates/texttemplate/template.go228
-rw-r--r--tpl/internal/go_templates/texttemplate/testdata/file1.tmpl2
-rw-r--r--tpl/internal/go_templates/texttemplate/testdata/file2.tmpl2
-rw-r--r--tpl/internal/go_templates/texttemplate/testdata/tmpl1.tmpl3
-rw-r--r--tpl/internal/go_templates/texttemplate/testdata/tmpl2.tmpl3
-rw-r--r--tpl/partials/partials.go3
-rw-r--r--tpl/safe/safe_test.go1
-rw-r--r--tpl/strings/strings.go1
-rw-r--r--tpl/strings/strings_test.go1
-rw-r--r--tpl/strings/truncate.go1
-rw-r--r--tpl/strings/truncate_test.go1
-rw-r--r--tpl/template.go7
-rw-r--r--tpl/template_test.go1
-rw-r--r--tpl/tplimpl/ace.go71
-rw-r--r--tpl/tplimpl/amber_compiler.go47
-rw-r--r--tpl/tplimpl/template.go82
-rw-r--r--tpl/tplimpl/template_ast_transformers.go8
-rw-r--r--tpl/tplimpl/template_ast_transformers_test.go3
-rw-r--r--tpl/transform/transform_test.go1
-rw-r--r--tpl/urls/urls.go1
82 files changed, 17792 insertions, 264 deletions
diff --git a/.gitignore b/.gitignore
index e71fe6c00..75d85e8d0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,4 +22,5 @@ dist
resources/sunset.jpg
-vendor \ No newline at end of file
+vendor
+
diff --git a/go.mod b/go.mod
index ef2806323..163cf7b07 100644
--- a/go.mod
+++ b/go.mod
@@ -16,7 +16,6 @@ require (
github.com/disintegration/gift v1.2.1
github.com/dlclark/regexp2 v1.2.0 // indirect
github.com/dustin/go-humanize v1.0.0
- github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385
github.com/fortytw2/leaktest v1.3.0
github.com/frankban/quicktest v1.6.0
github.com/fsnotify/fsnotify v1.4.7
@@ -53,8 +52,7 @@ require (
github.com/spf13/pflag v1.0.3
github.com/spf13/viper v1.4.0
github.com/tdewolff/minify/v2 v2.6.1
- github.com/yosssi/ace v0.0.5
- github.com/yuin/goldmark v1.1.14
+ github.com/yuin/goldmark v1.1.11
github.com/yuin/goldmark-highlighting v0.0.0-20191202084645-78f32c8dd6d5
go.opencensus.io v0.22.0 // indirect
gocloud.dev v0.15.0
diff --git a/go.sum b/go.sum
index 85784880e..6911fbce3 100644
--- a/go.sum
+++ b/go.sum
@@ -108,8 +108,6 @@ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25Kn
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
-github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 h1:clC1lXBpe2kTj2VHdaIu9ajZQe4kcEY9j0NsnDDBZ3o=
-github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM=
github.com/fortytw2/leaktest v1.2.0 h1:cj6GCiwJDH7l3tMHLjZDo0QqPtrXJiWSI9JgpeQKw+Q=
github.com/fortytw2/leaktest v1.2.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
@@ -322,16 +320,10 @@ github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
-github.com/tdewolff/minify/v2 v2.5.2 h1:If/q1brvT+91oWiWnIMEGuFcwWtpB6AtLTxba78tvMs=
-github.com/tdewolff/minify/v2 v2.5.2/go.mod h1:Q6mWHrmspbdRX0ZuUUoKIT8bDjVVXpIJ73ux7p7HZGg=
github.com/tdewolff/minify/v2 v2.6.1 h1:UJLhbs2Q/iDrqA79EEyKE48uYHeAMPVdiUzdtKsatJ8=
github.com/tdewolff/minify/v2 v2.6.1/go.mod h1:l9hbQnH096st77OkscoRUvKdd23oUM6pDZpYx381sPo=
-github.com/tdewolff/parse/v2 v2.3.9 h1:d8/K6XOLy5JVpLTG9Kx+SxA72rlm5OowFmVSVgtOlmM=
-github.com/tdewolff/parse/v2 v2.3.9/go.mod h1:HansaqmN4I/U7L6/tUp0NcwT2tFO0F4EAWYGSDzkYNk=
github.com/tdewolff/parse/v2 v2.3.14 h1:Tzam5YoUXx7gybFEfR/zcuR74PXADnrfUqYUXL+K5oA=
github.com/tdewolff/parse/v2 v2.3.14/go.mod h1:+V2lSZ93xpH2Csfs/vtNY1Fjr8kcFMsZKjyLoSkZbM0=
-github.com/tdewolff/test v1.0.0 h1:jOwzqCXr5ePXEPGJaq2ivoR6HOCi+D5TPfpoyg8yvmU=
-github.com/tdewolff/test v1.0.0/go.mod h1:DiQUlutnqlEvdvhSn2LPGy4TFwRauAaYDsL+683RNX4=
github.com/tdewolff/test v1.0.4 h1:ih38SXuQJ32Hng5EtSW32xqEsVeMnPp6nNNRPhBBDE8=
github.com/tdewolff/test v1.0.4/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE=
github.com/tidwall/pretty v0.0.0-20190325153808-1166b9ac2b65/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
@@ -349,24 +341,10 @@ github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhe
github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
-github.com/yosssi/ace v0.0.5 h1:tUkIP/BLdKqrlrPwcmH0shwEEhTRHoGnc1wFIWmaBUA=
-github.com/yosssi/ace v0.0.5/go.mod h1:ALfIzm2vT7t5ZE7uoIZqF3TQ7SAOyupFZnkrF5id+K0=
-github.com/yuin/goldmark v1.1.5 h1:JJy3EDke+PMI2WcFIU6SdaeiP6FgRGK5NKAiPZHiOoE=
-github.com/yuin/goldmark v1.1.5/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.7 h1:XiwWADvxJeIM1JbXqthrEhDc19hTMui+o+QaY1hGXlk=
github.com/yuin/goldmark v1.1.7/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
-github.com/yuin/goldmark v1.1.8 h1:d0m8Ac9JaetYjPZLC4P4W32ac7I0lpJpQbvxZtFqBoM=
-github.com/yuin/goldmark v1.1.8/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
-github.com/yuin/goldmark v1.1.10 h1:bg3TC1aj4DbjGdhvjSSffGfAgVUdBEIpccuCozwOYWo=
-github.com/yuin/goldmark v1.1.10/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.11 h1:OO08ilczi3F4swaYWPB99s08WRxP9DdLBemiLFQ6vCo=
github.com/yuin/goldmark v1.1.11/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
-github.com/yuin/goldmark v1.1.14 h1:9/OvYI+gdtQ5EAZY0y4kuVnuKjlE03BRqTw/njWYRNo=
-github.com/yuin/goldmark v1.1.14/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
-github.com/yuin/goldmark-highlighting v0.0.0-20191124122839-ede94e40cc3a h1:L7FTUnbc0WEBqGWgjbx4sPNAOX1/q5W/3KCD6g8XkKo=
-github.com/yuin/goldmark-highlighting v0.0.0-20191124122839-ede94e40cc3a/go.mod h1:1gshkGdH4gcrIH5MGSScGH42rOOCO+4Ks6acjAkA9C0=
-github.com/yuin/goldmark-highlighting v0.0.0-20191126180129-d7a4bf4d7ea4 h1:vI4Jv29V1cMPqetuLPMW1CMB9xNgxsHVBo8Mid6bwH8=
-github.com/yuin/goldmark-highlighting v0.0.0-20191126180129-d7a4bf4d7ea4/go.mod h1:4QGn5rJFOASBa2uK4Q2h3BRTyJqRfsAucPFIipSTcaM=
github.com/yuin/goldmark-highlighting v0.0.0-20191202084645-78f32c8dd6d5 h1:QbH7ca1qtgZHrzvcVAEoiJIwBqrXxMOfHYfwZIniIK0=
github.com/yuin/goldmark-highlighting v0.0.0-20191202084645-78f32c8dd6d5/go.mod h1:4QGn5rJFOASBa2uK4Q2h3BRTyJqRfsAucPFIipSTcaM=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
diff --git a/hugolib/case_insensitive_test.go b/hugolib/case_insensitive_test.go
index 4a6b8f3a0..a8616ab06 100644
--- a/hugolib/case_insensitive_test.go
+++ b/hugolib/case_insensitive_test.go
@@ -16,7 +16,6 @@ package hugolib
import (
"fmt"
"path/filepath"
- "strings"
"testing"
"github.com/gohugoio/hugo/hugofs"
@@ -234,6 +233,7 @@ Page2: {{ $page2.Params.ColoR }}
)
}
+// TODO1
func TestCaseInsensitiveConfigurationForAllTemplateEngines(t *testing.T) {
t.Parallel()
@@ -241,23 +241,13 @@ func TestCaseInsensitiveConfigurationForAllTemplateEngines(t *testing.T) {
return s
}
- amberFixer := func(s string) string {
- fixed := strings.Replace(s, "{{ .Site.Params", "{{ Site.Params", -1)
- fixed = strings.Replace(fixed, "{{ .Params", "{{ Params", -1)
- fixed = strings.Replace(fixed, ".Content", "Content", -1)
- fixed = strings.Replace(fixed, "{{", "#{", -1)
- fixed = strings.Replace(fixed, "}}", "}", -1)
-
- return fixed
- }
-
for _, config := range []struct {
suffix string
templateFixer func(s string) string
}{
- {"amber", amberFixer},
+ //{"amber", amberFixer},
{"html", noOp},
- {"ace", noOp},
+ //{"ace", noOp},
} {
doTestCaseInsensitiveConfigurationForTemplateEngine(t, config.suffix, config.templateFixer)
diff --git a/hugolib/template_engines_test.go b/hugolib/template_engines_test.go
index ebfb0b428..ea0fca0b6 100644
--- a/hugolib/template_engines_test.go
+++ b/hugolib/template_engines_test.go
@@ -18,34 +18,22 @@ import (
"path/filepath"
"testing"
- "strings"
-
"github.com/gohugoio/hugo/deps"
)
+// TODO1
func TestAllTemplateEngines(t *testing.T) {
noOp := func(s string) string {
return s
}
- amberFixer := func(s string) string {
- fixed := strings.Replace(s, "{{ .Title", "{{ Title", -1)
- fixed = strings.Replace(fixed, ".Content", "Content", -1)
- fixed = strings.Replace(fixed, ".IsNamedParams", "IsNamedParams", -1)
- fixed = strings.Replace(fixed, "{{", "#{", -1)
- fixed = strings.Replace(fixed, "}}", "}", -1)
- fixed = strings.Replace(fixed, `title "hello world"`, `title("hello world")`, -1)
-
- return fixed
- }
-
for _, config := range []struct {
suffix string
templateFixer func(s string) string
}{
- {"amber", amberFixer},
+ //{"amber", amberFixer},
{"html", noOp},
- {"ace", noOp},
+ //{"ace", noOp},
} {
config := config
t.Run(config.suffix,
diff --git a/magefile.go b/magefile.go
index a888fb78d..38e8e057d 100644
--- a/magefile.go
+++ b/magefile.go
@@ -320,7 +320,7 @@ func runCmd(env map[string]string, cmd string, args ...string) error {
}
func isGoLatest() bool {
- return strings.Contains(runtime.Version(), "1.12")
+ return strings.Contains(runtime.Version(), "1.13")
}
func isCI() bool {
diff --git a/output/layout_base.go b/output/layout_base.go
index b8930df82..772002e68 100644
--- a/output/layout_base.go
+++ b/output/layout_base.go
@@ -26,8 +26,7 @@ const (
)
var (
- aceTemplateInnerMarkers = [][]byte{[]byte("= content")}
- goTemplateInnerMarkers = [][]byte{[]byte("{{define"), []byte("{{ define"), []byte("{{- define"), []byte("{{-define")}
+ goTemplateInnerMarkers = [][]byte{[]byte("{{define"), []byte("{{ define"), []byte("{{- define"), []byte("{{-define")}
)
// TemplateNames represents a template naming scheme.
@@ -110,8 +109,8 @@ func CreateTemplateNames(d TemplateLookupDescriptor) (TemplateNames, error) {
id.Name = "_text/" + id.Name
}
- // Ace and Go templates may have both a base and inner template.
- if ext == "amber" || isShorthCodeOrPartial(name) {
+ // Go templates may have both a base and inner template.
+ if isShorthCodeOrPartial(name) {
// No base template support
return id, nil
}
@@ -128,10 +127,6 @@ func CreateTemplateNames(d TemplateLookupDescriptor) (TemplateNames, error) {
baseFilename = fmt.Sprintf("%s.%s", baseFileBase, ext)
}
- if ext == "ace" {
- innerMarkers = aceTemplateInnerMarkers
- }
-
// This may be a view that shouldn't have base template
// Have to look inside it to make sure
needsBase, err := d.ContainsAny(d.RelPath, innerMarkers)