2014-01-09 17:33:20 -05:00
|
|
|
// Copyright © 2013 Steve Francia <spf@spf13.com>.
|
|
|
|
//
|
|
|
|
// Licensed under the Simple Public License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
// http://opensource.org/licenses/Simple-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package bundle
|
|
|
|
|
|
|
|
type Tmpl struct {
|
2014-01-29 17:50:31 -05:00
|
|
|
Name string
|
|
|
|
Data string
|
2014-01-09 17:33:20 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *GoHtmlTemplate) EmbedShortcodes() {
|
2014-02-25 23:57:31 -05:00
|
|
|
t.AddInternalShortcode("highlight.html", `{{ .Get 0 | highlight .Inner }}`)
|
|
|
|
t.AddInternalShortcode("test.html", `This is a simple Test`)
|
|
|
|
t.AddInternalShortcode("figure.html", `<!-- image -->
|
|
|
|
<figure {{ with .Get "class" }}class="{{.}}"{{ end }}>
|
|
|
|
{{ with .Get "link"}}<a href="{{.}}">{{ end }}
|
|
|
|
<img src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}"{{ end }} />
|
|
|
|
{{ if .Get "link"}}</a>{{ end }}
|
|
|
|
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
|
2014-01-09 17:33:20 -05:00
|
|
|
<figcaption>{{ if isset .Params "title" }}
|
2014-02-25 23:57:31 -05:00
|
|
|
<h4>{{ .Get "title" }}</h4>{{ end }}
|
|
|
|
{{ if or (.Get "caption") (.Get "attr")}}<p>
|
|
|
|
{{ .Get "caption" }}
|
|
|
|
{{ with .Get "attrlink"}}<a href="{{.}}"> {{ end }}
|
|
|
|
{{ .Get "attr" }}
|
|
|
|
{{ if .Get "attrlink"}}</a> {{ end }}
|
2014-01-09 17:33:20 -05:00
|
|
|
</p> {{ end }}
|
|
|
|
</figcaption>
|
|
|
|
{{ end }}
|
|
|
|
</figure>
|
|
|
|
<!-- image -->`)
|
|
|
|
}
|