diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-04-02 14:20:34 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-04-02 14:20:34 +0200 |
commit | 7eb71ee06419f9ceedfd701ab2a27513ef448829 (patch) | |
tree | 254ba6c75575e067df76b4abe4e566936619adcb /output/layout.go | |
parent | c97dae40d9cd24c467f5b8cfbe2ac06f3cdef1d2 (diff) |
Revert "tpl: Rework to handle both text and HTML templates"
Will have to take another stab at this ...
This reverts commit 5c5efa03d2512749950b0d05a7d4bde35ecbdc37.
Closes #3260
Diffstat (limited to 'output/layout.go')
-rw-r--r-- | output/layout.go | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/output/layout.go b/output/layout.go index 6dba7f3b4..a2bfd7717 100644 --- a/output/layout.go +++ b/output/layout.go @@ -152,11 +152,9 @@ func (l *LayoutHandler) For(d LayoutDescriptor, layoutOverride string, f Format) } } - layouts = layoutsWithThemeLayouts + return layoutsWithThemeLayouts, nil } - layouts = prependTextPrefixIfNeeded(f, layouts...) - l.mu.Lock() l.cache[key] = layouts l.mu.Unlock() @@ -186,26 +184,10 @@ func resolveListTemplate(d LayoutDescriptor, f Format, } func resolveTemplate(templ string, d LayoutDescriptor, f Format) []string { - layouts := strings.Fields(replaceKeyValues(templ, + return strings.Fields(replaceKeyValues(templ, "SUFFIX", f.MediaType.Suffix, "NAME", strings.ToLower(f.Name), "SECTION", d.Section)) - - return layouts -} - -func prependTextPrefixIfNeeded(f Format, layouts ...string) []string { - if !f.IsPlainText { - return layouts - } - - newLayouts := make([]string, len(layouts)) - - for i, l := range layouts { - newLayouts[i] = "_text/" + l - } - - return newLayouts } func replaceKeyValues(s string, oldNew ...string) string { @@ -213,9 +195,7 @@ func replaceKeyValues(s string, oldNew ...string) string { return replacer.Replace(s) } -func regularPageLayouts(types string, layout string, f Format) []string { - var layouts []string - +func regularPageLayouts(types string, layout string, f Format) (layouts []string) { if layout == "" { layout = "single" } @@ -239,5 +219,5 @@ func regularPageLayouts(types string, layout string, f Format) []string { layouts = append(layouts, fmt.Sprintf("_default/%s.%s.%s", layout, name, suffix)) layouts = append(layouts, fmt.Sprintf("_default/%s.%s", layout, suffix)) - return layouts + return } |