This repository has been archived by the owner on Jan 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit dde125c
Showing
7 changed files
with
218 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2014 Kevin Renskers | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# raml2html confluence wiki theme | ||
|
||
A raml2html theme for rendering RAML to confluence wiki format. | ||
|
||
## Install | ||
``` | ||
npm i -g raml2html-confluencewiki-theme | ||
``` | ||
|
||
## Usage | ||
``` | ||
raml2html --theme raml2html-confluencewiki-theme example.raml > example.wiki | ||
``` | ||
|
||
## License | ||
raml2html-confluence-template is available under the MIT license. See the LICENSE file for more info. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const nunjucks = require('nunjucks'); | ||
|
||
module.exports = { | ||
// Takes a ramlObj and outputs the Confluence Wiki | ||
processRamlObj(ramlObj, config) { | ||
const env = nunjucks.configure(__dirname, { autoescape: false }); | ||
|
||
return new Promise((resolve) => { | ||
const result = env.render('index.nunjucks', ramlObj); | ||
if (config.processOutput) { | ||
resolve(config.processOutput(result)); | ||
} | ||
|
||
return resolve(result); | ||
}); | ||
}, | ||
|
||
// Takes the Confluence Wiki and post processes it further | ||
postProcessHtml(data) { | ||
data = data.replace(/([{}])/g, '\\$1'); | ||
return data.replace(/\n{3,}/g, '\n\n'); | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
h1. {{ title }} API documentation{% if version %} version {{ version }}{% endif %} | ||
{{ baseUri }} | ||
|
||
{% if description -%} | ||
{{ description }} | ||
{%- endif %} | ||
|
||
{% for item in documentation %} | ||
h3. {{ item.title }} | ||
{{ item.content }} | ||
{% endfor %} | ||
|
||
---- | ||
|
||
{% for resource in resources %} | ||
h2. {% if resource.displayName %}{{ resource.displayName }}{% else %}{{ resource.relativeUri }}{% endif %} | ||
{{ resource.description }} | ||
|
||
{% include "./resource.nunjucks" %} | ||
|
||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
*{%- if isPathParam -%} | ||
{% raw %}{{% endraw %} | ||
{%- endif -%} | ||
{{ item.key }} | ||
{%- if isPathParam -%} | ||
{% raw %}}{% endraw %} | ||
{%- endif -%}* | {% if item.required -%}Y{%- endif %} | {% if item.enum -%} | ||
{%- if item.enum.length === 1 -%} | ||
{{ item.enum.join(', ') }} | ||
{%- else -%} | ||
one of {{ item.enum.join(', ') }} | ||
{%- endif -%} | ||
{%- else -%} | ||
{%- if item.type === 'array' -%} | ||
array of {% if isStandardType(item.items) %}{{ item.items }}{% else %}{{ item.items.displayName }}{%- endif -%} | ||
{%- else -%} | ||
{{ item.type }} | ||
{%- endif -%} | ||
{%- endif %} | {% if item.default or item.default == 0 or item.default == false -%} | ||
default: {{ item.default }} | ||
{%- endif -%} | ||
{%- if item.repeat -%} | ||
repeat: {{ item.repeat }} | ||
{%- endif -%} | ||
{%- if item.type == 'string' -%} | ||
{%- if item.minLength or item.minLength == 0 -%} | ||
minLength: {{ item.minLength }} | ||
{% endif -%} | ||
{%- if item.maxLength or item.maxLength == 0 -%} | ||
maxLength: {{ item.maxLength }} | ||
{% endif -%} | ||
{%- else -%} | ||
{%- if item.minimum or item.minimum == 0 -%} | ||
minimum: {{ item.minimum }} | ||
{% endif -%} | ||
{%- if item.maximum or item.maximum == 0 -%} | ||
maximum: {{ item.maximum }} | ||
{% endif -%} | ||
{%- endif -%} | ||
{%- if item.pattern -%} | ||
pattern: {{ item.pattern }} | ||
{% endif -%} | ||
{{ item.description }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"name": "raml2html-confluencewiki-theme", | ||
"description": "A raml2html theme for rendering RAML to confluence wiki format.", | ||
"version": "0.0.1", | ||
"author": { | ||
"name": "Chris Reid", | ||
"email": "[email protected]" | ||
}, | ||
"homepage": "https://github.com/chrinor2002/raml2html-confluencewiki-theme", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/chrinor2002/raml2html-confluencewiki-theme.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/chrinor2002/raml2html-confluencewiki-theme/issues" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"main": "index.js", | ||
"dependencies": { | ||
"nunjucks": "2.5.x" | ||
}, | ||
"keywords": [ | ||
"RAML", | ||
"raml2html-theme" | ||
], | ||
"license": "MIT", | ||
"files": [ | ||
"index.js", | ||
"index.nunjucks", | ||
"item.nunjucks", | ||
"resource.nunjucks" | ||
], | ||
"maintainers": [ | ||
{ | ||
"name": "Chris Reid", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"directories": {}, | ||
"scripts": {}, | ||
"preferGlobal": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{% if (resource.methods or (resource.description and resource.parentUrl)) %} | ||
h3. {{ resource.parentUrl }}{{ resource.relativeUri }} | ||
{% if resource.parentUrl %}{{ resource.description }}{% endif %} | ||
{% if resource.allUriParameters.length %} | ||
{% set headerOutput = false %} | ||
{% for item in resource.allUriParameters %} | ||
{%- if not item.structuredValue -%} | ||
{%- if not headerOutput -%} | ||
{% set headerOutput = true %} | ||
|| Name || Required || Type || Description || | ||
{% endif -%} | ||
{%- set isPathParam = true -%} | ||
| {% include "./item.nunjucks" %} | | ||
{% else -%} | ||
| {{ item.structuredValue | dump }} |||| | ||
{% endif -%} | ||
{%- endfor -%} | ||
{% endif %} | ||
{% for method in resource.methods %} | ||
|
||
h4. {{ method.method}} {% if method.securedBy %} *(secured)*{% endif %} | ||
{{ method.description }} | ||
{% if method.queryString and method.queryString.properties.length %} | ||
{% set headerOutput = false %} | ||
{% for item in method.queryString.properties %} | ||
{%- if not headerOutput -%} | ||
{% set headerOutput = true %} | ||
|| Name || Required || Type || Description || | ||
{% endif -%} | ||
| {% include "./item.nunjucks" %} | | ||
{% endfor -%} | ||
{%- endif -%} | ||
|
||
{% if method.queryParameters.length %} | ||
{% set headerOutput = false %} | ||
{% for item in method.queryParameters %} | ||
{%- if not headerOutput -%} | ||
{% set headerOutput = true %} | ||
|| Name || Required || Type || Description || | ||
{% endif -%} | ||
| {% include "./item.nunjucks" %} | | ||
{% endfor -%} | ||
{%- endif -%} | ||
|
||
{%- endfor -%} | ||
{% endif %} | ||
|
||
{% for resource in resource.resources %} | ||
{% include "./resource.nunjucks" %} | ||
{% endfor %} |