piranha/gostatic

[support] .Exec does not work in atom template

Opened this issue · 6 comments

Hi,

I have this code:

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0">
  <id>{{ .Site.Other.Url }}</id>
  <title>{{ .Site.Other.Title }}</title>
  {{ with .Site.Pages.Children "posts/" }}
  <updated>{{ .First.Date.Format "2006-01-02T15:04:05Z07:00" }}</updated>
  {{ end }}
  <author><name>{{ .Site.Other.Author }}</name></author>
  <link href="{{ .Site.Other.Url }}" rel="alternate"></link>
  <generator uri="http://github.com/piranha/gostatic/">gostatic</generator>

{{ with .Site.Pages.Children "posts/" }}
{{ range .Slice 0 5 }}
<entry>
  <id>{{ .Url }}</id>
  <author><name>{{ or .Other.Author .Site.Other.Author }}</name></author>
  <title type="html">{{ html .Title }}</title>
  <published>{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}</published>
  {{ range .Tags }}
  <category term="{{ . }}"></category>
  {{ end }}
  <link href="{{ .Site.Other.Url }}/{{ .Url }}" rel="alternate"></link>
  <content type="text">    
    {{ .Raw }}
  </content>
</entry>
{{ end }}
{{ end }}
</feed>

When I add .Exec part, then no results are get with .Exec and .Raw part:

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0">
  <id>{{ .Site.Other.Url }}</id>
  <title>{{ .Site.Other.Title }}</title>
  {{ with .Site.Pages.Children "posts/" }}
  <updated>{{ .First.Date.Format "2006-01-02T15:04:05Z07:00" }}</updated>
  {{ end }}
  <author><name>{{ .Site.Other.Author }}</name></author>
  <link href="{{ .Site.Other.Url }}" rel="alternate"></link>
  <generator uri="http://github.com/piranha/gostatic/">gostatic</generator>

{{ with .Site.Pages.Children "posts/" }}
{{ range .Slice 0 5 }}
<entry>
  <id>{{ .Url }}</id>
  <author><name>{{ or .Other.Author .Site.Other.Author }}</name></author>
  <title type="html">{{ html .Title }}</title>
  <published>{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}</published>
  {{ range .Tags }}
  <category term="{{ . }}"></category>
  {{ end }}
  <link href="{{ .Site.Other.Url }}/{{ .Url }}" rel="alternate"></link>
  <content type="text">
    {{ .Exec "/bin/bash" "-c" "pandoc --mathjax --smart --toc --from markdown+auto_identifiers+table_captions+simple_tables+strikeout+tex_math_dollars+raw_html+footnotes+inline_notes+citations --to html5 --biblio biblio.bib --csl=acm-mod.csl" }}

    {{ .Raw }}
  </content>
</entry>
{{ end }}
{{ end }}
</feed>

Ok, that's because .Exec does not exist. Please use exec in lower case, plus get new version (2.5) of gostatic (because it was lost somewhere when merging :-)). Should work after that. :)

There is no 2.5 for linux 64 bits

Heh, it failed to upload. It's there now.

But how to pass .Raw to pandoc?

    {{ exec "/bin/bash" "-c" "pandoc --mathjax --smart --toc --from markdown+auto_identifiers+table_captions+simple_tables+strikeout+tex_math_dollars+raw_html+footnotes+inline_notes+citations --to html5 --biblio biblio.bib --csl=acm-mod.csl" .Raw }}

does not work

That's not like it should be done.

Create a file you're going to render with pandoc, so something like that in config:

*.render-with-pandoc:
    external pandoc --mathjax --smart --toc --from markdown+auto_identifiers+table_captions+simple_tables+strikeout+tex_math_dollars+raw_html+footnotes+inline_notes+citations --to html5 --biblio biblio.bib --csl=acm-mod.csl

And then you can use content of this file in RSS, like here.

Thanks a lot,