Skip to content

Commit

Permalink
added localization feature
Browse files Browse the repository at this point in the history
  • Loading branch information
mrin9 committed Sep 7, 2019
1 parent 28b18e4 commit 03728e9
Show file tree
Hide file tree
Showing 12 changed files with 249 additions and 13 deletions.
42 changes: 42 additions & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!doctype html>
<html lang="en">

<head>
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
<title>RapiPdf</title>
</head>

<body>
<!--
Some sample spec to try
http://10.21.83.83:8080/api/swagger.json
https://api.apis.guru/v2/specs/stripe.com/2019-02-19/swagger.json
https://api.apis.guru/v2/specs/github.com/v3/swagger.json
https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json
https://petstore.swagger.io/v2/swagger.json
https://assets.zuora.com/zuora-documentation/swagger.yaml <<< Large spec with lot of markdown
-->

<rapi-pdf id='rapipdf' style="width:750px; height:40px; font-size:18px"
spec-url="https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json"
pdf-title="New API Reference"
>
<template>
{ "index" : "Translated INDEX"}
</template>
</rapi-pdf>


<button onclick="changeSpec()">Change Spec</button>
<script type="text/javascript">
function changeSpec(){
let el = document.getElementById("rapipdf");
//el.specUrl = 'abcd'
el.setAttribute('spec-url', 'set new attrib');
}
</script>


<script type="text/javascript" src="rapipdf-min.js"></script></body>

</html>
Binary file added dist/index.html.gz
Binary file not shown.
55 changes: 55 additions & 0 deletions dist/rapipdf-min.js

Large diffs are not rendered by default.

Binary file added dist/rapipdf-min.js.gz
Binary file not shown.
1 change: 1 addition & 0 deletions dist/rapipdf-min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added dist/rapipdf-min.js.map.gz
Binary file not shown.
64 changes: 64 additions & 0 deletions dist/report.html

Large diffs are not rendered by default.

40 changes: 38 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,44 @@ <h2> Methods</h2>
</tr>
</table>
</div>

<h2> Localization</h2>
<div class="mono-bold" style="text-align: center;">create a &lt;template&gt; inside &lt;rapi-pdf&gt; element and provide the translations</div>
<pre class="shadow code-block"><code class="html" style="border-radius:4px">
&lt;rapi-pdf spec-url="https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json"&gt;
&lt;template&gt;
{
"index" : "INDEX",
"api" : "API",
"apiList" : "API List",
"apiReference" : "API Reference",
"apiVersion" : "API Version",
"contact" : "CONTACT",
"name" : "NAME",
"email" : "EMAIL",
"url" : "URL",
"termsOfService" : "Terms of service",
"securitySchemes": "SECURITY SCHEMES",
"type" : "TYPE",
"description" : "DESCRIPTION",
"request" : "REQUEST",
"requestBody" : "REQUEST BODY",
"response" : "RESPONSE",
"responseModel" : "RESPONSE MODEL",
"statusCode" : "STATUS CODE",
"deprecated" : "DEPRECATED",
"allowed" : "allowed",
"pattern" : "pattern",
"parameters" : "Parameters",
"method" : "METHOD",
"securityAndAuthentication" : "Security and Authentication",
"noRequestParameters" : "No request parameters",
}
&lt;/template&gt;
&lt;/rapi-pdf&gt;
</code>
</pre>

</div>
</div>
<!-- End of API -->
Expand All @@ -291,8 +329,6 @@ <h2> Methods</h2>
}
}



</script>
</body>

Expand Down
18 changes: 9 additions & 9 deletions docs/rapipdf-min.js

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions docs/welcome.html
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,44 @@ <h2> Methods</h2>
</tr>
</table>
</div>

<h2> Localization</h2>
<div class="mono-bold" style="text-align: center;">create a &lt;template&gt; inside &lt;rapi-pdf&gt; element and provide the translations</div>
<pre class="shadow code-block"><code class="html" style="border-radius:4px">
&lt;rapi-pdf spec-url="https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json"&gt;
&lt;template&gt;
{
"index" : "INDEX",
"api" : "API",
"apiList" : "API List",
"apiReference" : "API Reference",
"apiVersion" : "API Version",
"contact" : "CONTACT",
"name" : "NAME",
"email" : "EMAIL",
"url" : "URL",
"termsOfService" : "Terms of service",
"securitySchemes": "SECURITY SCHEMES",
"type" : "TYPE",
"description" : "DESCRIPTION",
"request" : "REQUEST",
"requestBody" : "REQUEST BODY",
"response" : "RESPONSE",
"responseModel" : "RESPONSE MODEL",
"statusCode" : "STATUS CODE",
"deprecated" : "DEPRECATED",
"allowed" : "allowed",
"pattern" : "pattern",
"parameters" : "Parameters",
"method" : "METHOD",
"securityAndAuthentication" : "Security and Authentication",
"noRequestParameters" : "No request parameters",
}
&lt;/template&gt;
&lt;/rapi-pdf&gt;
</code>
</pre>

</div>
</div>
<!-- End of API -->
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
pdf-title="New API Reference"
>
<template>
{"index":"Translated INDEX"}
{ "index" : "Translated INDEX"}
</template>
</rapi-pdf>

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rapipdf",
"version": "1.0.5",
"version": "1.1.0",
"description": "RapiPdf - Generate PDF from Open API spec",
"author": "Mrinmoy Majumdar <[email protected]>",
"repository": {
Expand Down

0 comments on commit 03728e9

Please sign in to comment.