Skip to content

Commit

Permalink
Escape example output in apiExample, apiErrorExample,
Browse files Browse the repository at this point in the history
`apiSuccessExample`.
  • Loading branch information
rottmann committed Aug 8, 2014
1 parent 46c22c4 commit 57fb154
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 4 deletions.
4 changes: 2 additions & 2 deletions template/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ <h1>{{underscoreToSpace article.group}}{{#if article.title}} - {{article.title}}

{{#each article.examples}}
<h3>{{title}}</h3>
<pre class="prettyprint language-json" data-type="json"><code>{{{content}}}</code></pre>
<pre class="prettyprint language-json" data-type="json"><code>{{content}}</code></pre>
{{/each}}

{{subTemplate "article-param-block" params=article.header _hasType=_hasTypeInHeaderFields}}
Expand Down Expand Up @@ -176,7 +176,7 @@ <h2>{{__ @key}}</h2>
{{/each}}
{{#each params.examples}}
<h3>{{title}}</h3>
<pre class="prettyprint language-json" data-type="json"><code>{{{content}}}</code></pre>
<pre class="prettyprint language-json" data-type="json"><code>{{content}}</code></pre>
{{/each}}
{{/if}}
</script>
Expand Down
48 changes: 48 additions & 0 deletions test/fixtures/api_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,54 @@ define({ api: [
},
"filename": "test/fixtures/example/title_and_structure.js"
},
{
"type": "get",
"url": "/test/escape",
"title": "Escape Example",
"name": "GetEscape",
"group": "Escape",
"version": "0.6.0",
"description": "<p>Escape Example data.</p>",
"examples": [
{
"title": "Example usage:",
"content": " curl -i http://localhost/escape/text\n <b>curl -i http://localhost/escape/html</b>\n <xml>curl -i http://localhost/escape/xml</xml>\n"
}
],
"success": {
"examples": [
{
"title": "Example Response",
"content": "HTTP/1.1 200 OK {\n field_text: 'text-value',\n field_html: '<b>html-value</b>',\n field_xml: '<xml>xml-value</xml>'\n}\n"
}
]
},
"filename": "test/fixtures/example/escape.js"
},
{
"type": "get",
"url": "/test/escape",
"title": "Escape Example",
"name": "GetEscape",
"group": "Escape",
"version": "0.5.0",
"description": "<p>Escape Example data - with comparison.</p>",
"examples": [
{
"title": "Example usage:",
"content": " curl -i http://localhost/escape/text-old\n <b>curl -i http://localhost/escape/html-old</b>\n <xml>curl -i http://localhost/escape/xml-old</xml>\n"
}
],
"success": {
"examples": [
{
"title": "Example Response",
"content": "HTTP/1.1 200 OK {\n field_text: 'text-value old',\n field_html: '<b>html-value old</b>',\n field_xml: '<xml>xml-value old</xml>'\n}\n"
}
]
},
"filename": "test/fixtures/example/escape.js"
},
{
"type": "get",
"url": "/group/:id",
Expand Down
48 changes: 48 additions & 0 deletions test/fixtures/api_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,54 @@
},
"filename": "test/fixtures/example/title_and_structure.js"
},
{
"type": "get",
"url": "/test/escape",
"title": "Escape Example",
"name": "GetEscape",
"group": "Escape",
"version": "0.6.0",
"description": "<p>Escape Example data.</p>",
"examples": [
{
"title": "Example usage:",
"content": " curl -i http://localhost/escape/text\n <b>curl -i http://localhost/escape/html</b>\n <xml>curl -i http://localhost/escape/xml</xml>\n"
}
],
"success": {
"examples": [
{
"title": "Example Response",
"content": "HTTP/1.1 200 OK {\n field_text: 'text-value',\n field_html: '<b>html-value</b>',\n field_xml: '<xml>xml-value</xml>'\n}\n"
}
]
},
"filename": "test/fixtures/example/escape.js"
},
{
"type": "get",
"url": "/test/escape",
"title": "Escape Example",
"name": "GetEscape",
"group": "Escape",
"version": "0.5.0",
"description": "<p>Escape Example data - with comparison.</p>",
"examples": [
{
"title": "Example usage:",
"content": " curl -i http://localhost/escape/text-old\n <b>curl -i http://localhost/escape/html-old</b>\n <xml>curl -i http://localhost/escape/xml-old</xml>\n"
}
],
"success": {
"examples": [
{
"title": "Example Response",
"content": "HTTP/1.1 200 OK {\n field_text: 'text-value old',\n field_html: '<b>html-value old</b>',\n field_xml: '<xml>xml-value old</xml>'\n}\n"
}
]
},
"filename": "test/fixtures/example/escape.js"
},
{
"type": "get",
"url": "/group/:id",
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/api_project.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ define({
},
"generator": {
"version": "0.6.2",
"time": "2014-08-08T13:31:19.377Z"
"time": "2014-08-08T13:56:55.412Z"
}
});
2 changes: 1 addition & 1 deletion test/fixtures/api_project.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
},
"generator": {
"version": "0.6.2",
"time": "2014-08-08T13:31:19.377Z"
"time": "2014-08-08T13:56:55.412Z"
}
}
39 changes: 39 additions & 0 deletions test/fixtures/example/escape.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* @api {get} /test/escape Escape Example
* @apiName GetEscape
* @apiGroup Escape
* @apiVersion 0.6.0
* @apiDescription Escape Example data.
*
* @apiExample Example usage:
* curl -i http://localhost/escape/text
* <b>curl -i http://localhost/escape/html</b>
* <xml>curl -i http://localhost/escape/xml</xml>
*
* @apiSuccessExample Example Response
* HTTP/1.1 200 OK {
* field_text: 'text-value',
* field_html: '<b>html-value</b>',
* field_xml: '<xml>xml-value</xml>'
* }
*/

/**
* @api {get} /test/escape Escape Example
* @apiName GetEscape
* @apiGroup Escape
* @apiVersion 0.5.0
* @apiDescription Escape Example data - with comparison.
*
* @apiExample Example usage:
* curl -i http://localhost/escape/text-old
* <b>curl -i http://localhost/escape/html-old</b>
* <xml>curl -i http://localhost/escape/xml-old</xml>
*
* @apiSuccessExample Example Response
* HTTP/1.1 200 OK {
* field_text: 'text-value old',
* field_html: '<b>html-value old</b>',
* field_xml: '<xml>xml-value old</xml>'
* }
*/

0 comments on commit 57fb154

Please sign in to comment.