<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Templates on Companionway</title>
    <link>http://localhost:1313/tags/templates/</link>
    <description>Recent content in Templates on Companionway</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Sun, 15 Jul 2018 14:00:00 +0000</lastBuildDate>
    <atom:link href="http://localhost:1313/tags/templates/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Vim Scriptable Templates</title>
      <link>http://localhost:1313/post/vim_scriptable_templates/</link>
      <pubDate>Sun, 15 Jul 2018 14:00:00 +0000</pubDate>
      <guid>http://localhost:1313/post/vim_scriptable_templates/</guid>
      <description>&lt;h3 id=&#34;dynamic-vim-templates&#34;&gt;Dynamic vim Templates&lt;/h3&gt;&#xA;&lt;p&gt;Vim (or vi in the anceint past) has been my partner in getting things done. Like an rich tool it&#xA;has lots of features that go untapped or undiscovered. A few days ago I decided I wanted a script within&#xA;a tempate to help build the &amp;ldquo;front matter&amp;rdquo; to my markdown (.md) files.&lt;/p&gt;&#xA;&lt;p&gt;The front matter looks like this:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;+++&#xA;author = &amp;#34;&amp;#34;&#xA;comments = true&#xA;date = &amp;#34;2018-07-15 14:45:19&amp;#34;&#xA;draft = false&#xA;image = &amp;#34;&amp;#34;&#xA;share = true&#xA;# slug = &#xA;# tags = [ &amp;#34;tag1&amp;#34;, &amp;#34;tag2&amp;#34; ]&#xA;title = &amp;#34;vim_scriptable_templates&amp;#34;&#xA;&#xA;+++&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The challenge was to have vim write in the date for me in the needed format. And if you use hugo as your static web site generator as I do&#xA;you may have found that it will silently ignore a new markdown file if the date is not formated correctly. It some testing to discover that&#xA;but the bottom line is that I needed a way to script it for to avoid mistakes.&lt;/p&gt;&#xA;&lt;p&gt;Research to me to this tip source: &lt;a href=&#34;http://vim.wikia.com/wiki/Use_eval_to_create_dynamic_templates&#34;&gt; vim embedded scripts &lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Vim Scriptable Templates</title>
      <link>http://localhost:1313/search/post/vim_scriptable_templates/</link>
      <pubDate>Sun, 15 Jul 2018 14:00:00 +0000</pubDate>
      <guid>http://localhost:1313/search/post/vim_scriptable_templates/</guid>
      <description>&lt;h3 id=&#34;dynamic-vim-templates&#34;&gt;Dynamic vim Templates&lt;/h3&gt;&#xA;&lt;p&gt;Vim (or vi in the anceint past) has been my partner in getting things done. Like an rich tool it&#xA;has lots of features that go untapped or undiscovered. A few days ago I decided I wanted a script within&#xA;a tempate to help build the &amp;ldquo;front matter&amp;rdquo; to my markdown (.md) files.&lt;/p&gt;&#xA;&lt;p&gt;The front matter looks like this:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;+++&#xA;author = &amp;#34;&amp;#34;&#xA;comments = true&#xA;date = &amp;#34;2018-07-15 14:45:19&amp;#34;&#xA;draft = false&#xA;image = &amp;#34;&amp;#34;&#xA;share = true&#xA;# slug = &#xA;# tags = [ &amp;#34;tag1&amp;#34;, &amp;#34;tag2&amp;#34; ]&#xA;title = &amp;#34;vim_scriptable_templates&amp;#34;&#xA;&#xA;+++&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The challenge was to have vim write in the date for me in the needed format. And if you use hugo as your static web site generator as I do&#xA;you may have found that it will silently ignore a new markdown file if the date is not formated correctly. It some testing to discover that&#xA;but the bottom line is that I needed a way to script it for to avoid mistakes.&lt;/p&gt;&#xA;&lt;p&gt;Research to me to this tip source: &lt;a href=&#34;http://vim.wikia.com/wiki/Use_eval_to_create_dynamic_templates&#34;&gt; vim embedded scripts &lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I use autocommands in vim to load templates. The strategy here is to have vim recognize and respond when I start to write a new&#xA;markdown (.md) file and run vim scripts where needed to dynamically fill in needed data. I will start here with writing the&#xA;template. All my templates are in a directory I call &lt;code&gt;~/vinrc-files/&lt;/code&gt;.  Here is the contents of my .md file template named&#xA;&lt;code&gt;~/vimrc-files/vimrc-md.tem&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;+++&#xA;# author = &amp;#34;-g-&amp;#34;&#xA;comments = true&#xA;date = &amp;#34;[:VIM_EVAL:]strftime(&amp;#34;%Y-%m-%d %T&amp;#34;)[:END_EVAL:]&amp;#34;&#xA;draft = false&#xA;# image = &amp;#34;img/myimage&amp;#34;&#xA;share = true&#xA;# slug = &#xA;# tags = [ &amp;#34;tag1&amp;#34;, &amp;#34;tag2&amp;#34; ]&#xA;# Watch the title below and change as you desire&#xA;title = &amp;#34;[:VIM_EVAL:]expand(&amp;#34;%:t:r&amp;#34;)[:END_EVAL:]&amp;#34;&#xA;&#xA;+++&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For what it is worth, the inclusion of `&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
