Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dfad7b8

Browse files
author
Kevin Renskers
committed
1.4.0: if an example's type is explicitly set to 'string' then don't syntax highlight it
1 parent 3991e35 commit dfad7b8

File tree

6 files changed

+31
-9
lines changed

6 files changed

+31
-9
lines changed

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
1.4.0 - January 30, 2015
2+
- If an example's type is explicitly set to 'string' then don't syntax highlight it
3+
14
1.3.1 - January 28, 2015
25
- Fixed the id's of the tabs (#108)
36

examples/example.html

Lines changed: 6 additions & 6 deletions
Large diffs are not rendered by default.

examples/example.raml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,12 @@ traits:
224224
get:
225225
is: [ paged ]
226226
description: Get a list of all users
227+
queryParameters:
228+
from:
229+
description: Limit results to those created after from.
230+
example: '2014-12-31T00:00:00.000Z'
231+
type: string
232+
required: false
227233

228234
post:
229235
description: Creates a new user

lib/item.handlebars

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323

2424
{{#if this.example}}
2525
<p><strong>Example</strong>:</p>
26-
<pre><code>{{this.example}}</code></pre>
26+
{{#ifTypeIsString}}
27+
<pre>{{this.example}}</pre>
28+
{{else}}
29+
<pre><code>{{this.example}}</code></pre>
30+
{{/ifTypeIsString}}
2731
{{/if}}
2832
</li>

lib/raml2html.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ function _emptyRequestCheckHelper(options) {
5151
}
5252
}
5353

54+
function _ifTypeIsString(options) {
55+
if (this.type && this.type === 'string') {
56+
return options.fn(this)
57+
} else {
58+
return options.inverse(this);
59+
}
60+
}
61+
5462
/*
5563
The config object can contain the following keys and values:
5664
template: string or Handlebars object containing the main template (required)
@@ -114,7 +122,8 @@ function getDefaultConfig(https, mainTemplate, resourceTemplate, itemTemplate) {
114122
emptyResourceCheck: _emptyResourceCheckHelper,
115123
emptyRequestCheckHelper: _emptyRequestCheckHelper,
116124
md: _markDownHelper,
117-
lock: _lockIconHelper
125+
lock: _lockIconHelper,
126+
ifTypeIsString: _ifTypeIsString
118127
},
119128
partials: {
120129
resource: resourceTemplate,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "raml2html",
33
"description": "RAML to HTML documentation generator",
4-
"version": "1.3.1",
4+
"version": "1.4.0",
55
"author": {
66
"name": "Kevin Renskers",
77
"email": "[email protected]"

0 commit comments

Comments
 (0)