Updated pandoc task.

This commit is contained in:
Erik C. Thauvin 2016-06-29 23:35:38 -07:00
parent 93a579d5fb
commit e90927d177
2 changed files with 35 additions and 64 deletions

View file

@ -6,83 +6,60 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title></title>
<style type="text/css">code{white-space: pre;}</style>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style type="text/css">
div.sourceCode { overflow-x: auto; }
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
code > span.dt { color: #902000; } /* DataType */
code > span.dv { color: #40a070; } /* DecVal */
code > span.bn { color: #40a070; } /* BaseN */
code > span.fl { color: #40a070; } /* Float */
code > span.ch { color: #4070a0; } /* Char */
code > span.st { color: #4070a0; } /* String */
code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
code > span.ot { color: #007020; } /* Other */
code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
code > span.fu { color: #06287e; } /* Function */
code > span.er { color: #ff0000; font-weight: bold; } /* Error */
code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
code > span.cn { color: #880000; } /* Constant */
code > span.sc { color: #4070a0; } /* SpecialChar */
code > span.vs { color: #4070a0; } /* VerbatimString */
code > span.ss { color: #bb6688; } /* SpecialString */
code > span.im { } /* Import */
code > span.va { color: #19177c; } /* Variable */
code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code > span.op { color: #666666; } /* Operator */
code > span.bu { } /* BuiltIn */
code > span.ex { } /* Extension */
code > span.pp { color: #bc7a00; } /* Preprocessor */
code > span.at { color: #7d9029; } /* Attribute */
code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code > span.kw { color: #007020; font-weight: bold; }
code > span.dt { color: #902000; }
code > span.dv { color: #40a070; }
code > span.bn { color: #40a070; }
code > span.fl { color: #40a070; }
code > span.ch { color: #4070a0; }
code > span.st { color: #4070a0; }
code > span.co { color: #60a0b0; font-style: italic; }
code > span.ot { color: #007020; }
code > span.al { color: #ff0000; font-weight: bold; }
code > span.fu { color: #06287e; }
code > span.er { color: #ff0000; font-weight: bold; }
</style>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
</head>
<body>
<h1 id="semantic-version-annotation-processor">Semantic Version Annotation Processor</h1>
<p><a href="http://opensource.org/licenses/BSD-3-Clause"><img src="https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square" alt="License (3-Clause BSD)" /></a> <a href="https://www.versioneye.com/user/projects/56a680101b78fd00390001d2"><img src="https://www.versioneye.com/user/projects/56a680101b78fd00390001d2/badge.svg?style=flat" alt="Dependency Status" /></a> <a href="https://travis-ci.org/ethauvin/semver"><img src="https://travis-ci.org/ethauvin/semver.svg?branch=master" alt="Build Status" /></a> <a href="https://ci.appveyor.com/project/ethauvin/semver"><img src="https://ci.appveyor.com/api/projects/status/nbv4mxd1gpxtx69o?svg=true" alt="Build status" /></a> <a href="https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/semver"><img src="https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/semver/badge.svg" alt="Maven Central" /></a> <a href="https://bintray.com/ethauvin/maven/SemVer/_latestVersion"><img src="https://api.bintray.com/packages/ethauvin/maven/SemVer/images/download.svg" alt="Download" /></a></p>
<p><a href="http://opensource.org/licenses/BSD-3-Clause"><embed src="https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square" /></a> <a href="https://www.versioneye.com/user/projects/56a680101b78fd00390001d2"><embed src="https://www.versioneye.com/user/projects/56a680101b78fd00390001d2/badge.svg?style=flat" /></a> <a href="https://travis-ci.org/ethauvin/semver"><embed src="https://travis-ci.org/ethauvin/semver.svg?branch=master" /></a> <a href="https://ci.appveyor.com/project/ethauvin/semver"><img src="https://ci.appveyor.com/api/projects/status/nbv4mxd1gpxtx69o?svg=true" alt="Build status" /></a> <a href="https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/semver"><img src="https://maven-badges.herokuapp.com/maven-central/net.thauvin.erik/semver/badge.svg" alt="Maven Central" /></a> <a href="https://bintray.com/ethauvin/maven/SemVer/_latestVersion"><img src="https://api.bintray.com/packages/ethauvin/maven/SemVer/images/download.svg" alt="Download" /></a></p>
<p>An <a href="https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/Processor.html">annotation processor</a> that automatically generates a <code>GeneratedVersion</code> class containing the <a href="http://semver.org/">semantic version</a> (major, minor, patch, etc.) that is read from a <code>Properties</code> file or defined in the <a href="https://docs.oracle.com/javase/tutorial/java/annotations/basics.html">annotation</a>.</p>
<p>This processor was inspired by Cédric Beust's <a href="https://github.com/cbeust/version-processor">version-processor</a>.</p>
<h2 id="examples">Examples</h2>
<ul>
<li>Using annotation elements:</li>
</ul>
<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java"><span class="fu">@Version</span>(major = <span class="dv">1</span>, minor = <span class="dv">0</span>, patch = <span class="dv">0</span>, prerelease = <span class="st">&quot;beta&quot;</span>)
<pre class="sourceCode java"><code class="sourceCode java"><span class="fu">@Version</span>(major = <span class="dv">1</span>, minor = <span class="dv">0</span>, patch = <span class="dv">0</span>, prerelease = <span class="st">&quot;beta&quot;</span>)
<span class="kw">public</span> <span class="kw">class</span> A {
<span class="co">// ...</span></code></pre></div>
<span class="co">// ...</span></code></pre>
<ul>
<li>Or using a <a href="https://docs.oracle.com/javase/tutorial/essential/environment/properties.html">properties</a> file:</li>
</ul>
<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java"><span class="fu">@Version</span>(properties = <span class="st">&quot;version.properties&quot;</span>)
<pre class="sourceCode java"><code class="sourceCode java"><span class="fu">@Version</span>(properties = <span class="st">&quot;version.properties&quot;</span>)
<span class="kw">public</span> <span class="kw">class</span> A {
<span class="co">// ...</span></code></pre></div>
<div class="sourceCode"><pre class="sourceCode ini"><code class="sourceCode ini"><span class="co"># version.properties</span>
<span class="co">// ...</span></code></pre>
<pre class="sourceCode ini"><code class="sourceCode ini"><span class="co"># version.properties</span>
<span class="dt">version.major</span><span class="ot">=</span><span class="dv">1</span>
<span class="dt">version.minor</span><span class="ot">=</span><span class="dv">0</span>
<span class="dt">version.patch</span><span class="ot">=</span><span class="dv">0</span>
<span class="dt">version.prerelease</span><span class="ot">=</span><span class="st">beta</span></code></pre></div>
<span class="dt">version.prerelease</span><span class="ot">=</span><span class="st">beta</span></code></pre>
<h2 id="template">Template</h2>
<p>Upon running the annotator processor, a source file <a href="https://github.com/ethauvin/semver/blob/master/example/src/generated/java/net/thauvin/erik/semver/example/GeneratedVersion.java"><code>GeneratedVersion.java</code></a> is automatically generated with static methods to access the semantic version data. The source is based on a fully customizable <a href="http://velocity.apache.org/">Velocity</a> template.</p>
<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java"><span class="fu">@Version</span>(template = <span class="st">&quot;myversion.vm&quot;</span>)
<pre class="sourceCode java"><code class="sourceCode java"><span class="fu">@Version</span>(template = <span class="st">&quot;myversion.vm&quot;</span>)
<span class="kw">public</span> <span class="kw">class</span> A {
<span class="co">// ...</span></code></pre></div>
<span class="co">// ...</span></code></pre>
<h3 id="default-template">Default Template</h3>
<p>The <a href="https://github.com/ethauvin/semver/blob/master/src/main/resources/version.vm">default template</a> implements the following static methods:</p>
<table style="width:101%;">
<colgroup>
<col style="width: 26%" />
<col style="width: 48%" />
<col style="width: 26%" />
</colgroup>
<table>
<thead>
<tr class="header">
<th style="text-align: left;">Method</th>
@ -135,7 +112,7 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
</table>
<h3 id="custom-template">Custom Template</h3>
<p>A very simple custom template might look something like:</p>
<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java"><span class="co">/* myversion.vm */</span>
<pre class="sourceCode java"><code class="sourceCode java"><span class="co">/* myversion.vm */</span>
<span class="kw">package</span> ${packageName}
<span class="kw">import java.util.Date;</span>
@ -148,17 +125,11 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
<span class="kw">public</span> <span class="dt">final</span> <span class="dt">static</span> <span class="dt">int</span> PATCH = ${patch};
<span class="kw">public</span> <span class="dt">final</span> <span class="dt">static</span> String PRERELEASE = <span class="st">&quot;${prerelease}&quot;</span>;
<span class="kw">public</span> <span class="dt">final</span> <span class="dt">static</span> String PROJECT = <span class="st">&quot;${project}&quot;</span>;
}</code></pre></div>
}</code></pre>
<p>The Velocity variables are automatically filled in by the processor.</p>
<h2 id="elements-properties">Elements &amp; Properties</h2>
<p>The following annotation elements and properties are available:</p>
<table style="width:119%;">
<colgroup>
<col style="width: 19%" />
<col style="width: 31%" />
<col style="width: 48%" />
<col style="width: 19%" />
</colgroup>
<table>
<thead>
<tr class="header">
<th style="text-align: left;">Element</th>
@ -221,7 +192,7 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
</tbody>
</table>
<p>In order to easily incorporate with existing projects, the property keys may be assigned custom values:</p>
<div class="sourceCode"><pre class="sourceCode java"><code class="sourceCode java"><span class="fu">@Version</span>(
<pre class="sourceCode java"><code class="sourceCode java"><span class="fu">@Version</span>(
properties = <span class="st">&quot;example.properties&quot;</span>,
majorKey = <span class="st">&quot;example.major&quot;</span>,
minorKey = <span class="st">&quot;example.minor&quot;</span>,
@ -231,21 +202,21 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
projectKey = <span class="st">&quot;example.project&quot;</span>
)
<span class="kw">public</span> <span class="kw">class</span> Example {
<span class="co">// ...</span></code></pre></div>
<div class="sourceCode"><pre class="sourceCode ini"><code class="sourceCode ini"><span class="co"># example.properties</span>
<span class="co">// ...</span></code></pre>
<pre class="sourceCode ini"><code class="sourceCode ini"><span class="co"># example.properties</span>
<span class="dt">example.project</span><span class="ot">=</span><span class="st">Example</span>
<span class="dt">example.major</span><span class="ot">=</span><span class="dv">1</span>
<span class="dt">example.minor</span><span class="ot">=</span><span class="dv">0</span>
<span class="dt">example.patch</span><span class="ot">=</span><span class="dv">0</span>
<span class="co"># ...</span></code></pre></div>
<span class="co"># ...</span></code></pre>
<h2 id="usage-with-maven-grail-and-kobalt">Usage with Maven, Grail and Kobalt</h2>
<h3 id="maven">Maven</h3>
<p>To install and run from <a href="http://maven.apache.org/">Maven</a>, configure an artifact as follows:</p>
<div class="sourceCode"><pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw">&lt;dependency&gt;</span>
<pre class="sourceCode xml"><code class="sourceCode xml"><span class="kw">&lt;dependency&gt;</span>
<span class="kw">&lt;groupId&gt;</span>net.thauvin.erik<span class="kw">&lt;/groupId&gt;</span>
<span class="kw">&lt;artifactId&gt;</span>semver<span class="kw">&lt;/artifactId&gt;</span>
<span class="kw">&lt;version&gt;</span>0.9.5-beta<span class="kw">&lt;/version&gt;</span>
<span class="kw">&lt;/dependency&gt;</span></code></pre></div>
<span class="kw">&lt;/dependency&gt;</span></code></pre>
<h3 id="gradle">Gradle</h3>
<h4 id="class-generation">Class Generation</h4>
<p>To install and run from <a href="https://gradle.org/">Gradle</a>, add the following to the <code>build.gradle</code> file:</p>

View file

@ -206,7 +206,7 @@ task pandoc(type: Exec) {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine(['cmd', '/c', 'pandoc'] + pandoc_args)
} else {
executable '/usr/local/bin/pandoc'
executable 'pandoc'
args pandoc_args
}
standardOutput = new ByteArrayOutputStream()