mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[ADF-3040] Replaced doc template engine to fix whitespace issues (#3356)
This commit is contained in:
parent
c63dee50f1
commit
0e64efc4e2
@ -103,13 +103,13 @@
|
||||
"bundlesize": "^0.15.3",
|
||||
"chalk": "^2.3.2",
|
||||
"codelyzer": "4.3.0",
|
||||
"combyne": "^2.0.0",
|
||||
"commander": "^2.15.1",
|
||||
"concurrently": "^3.5.1",
|
||||
"copy-webpack-plugin": "4.0.1",
|
||||
"css-loader": "0.25.0",
|
||||
"css-to-string-loader": "0.1.2",
|
||||
"cssnano": "3.8.1",
|
||||
"ejs": "^2.6.1",
|
||||
"extract-text-webpack-plugin": "2.0.0-rc.3",
|
||||
"file-loader": "0.11.1",
|
||||
"fork-ts-checker-webpack-plugin": "0.2.3",
|
||||
|
@ -17,7 +17,7 @@
|
||||
"toc"
|
||||
],
|
||||
"dev": [
|
||||
"tsInfo"
|
||||
"versionIndex"
|
||||
]
|
||||
}
|
||||
}
|
23
tools/doc/templates/component.combyne
vendored
23
tools/doc/templates/component.combyne
vendored
@ -1,23 +0,0 @@
|
||||
{% if hasInputs %}
|
||||
### Properties
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| -- | -- | -- | -- |
|
||||
{% each properties as prop %}
|
||||
{% if prop.isInput %}
|
||||
| {{{prop.name}}} | `{{{prop.type}}}` | {{{prop.defaultValue}}} | {{{prop.docText}}} |
|
||||
{% endif %}
|
||||
{% endeach %}
|
||||
{% endif %}
|
||||
{% if hasOutputs%}
|
||||
|
||||
### Events
|
||||
|
||||
| Name | Type | Description |
|
||||
| -- | -- | -- |
|
||||
{% each properties as prop %}
|
||||
{% if prop.isOutput %}
|
||||
| {{prop.name}} | `{{{prop.type}}}` | {{{prop.docText}}} |
|
||||
{% endif %}
|
||||
{% endeach %}
|
||||
{% endif %}
|
23
tools/doc/templates/component.ejs
vendored
Normal file
23
tools/doc/templates/component.ejs
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
<% if (hasInputs) { %>
|
||||
### Properties
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| -- | -- | -- | -- |
|
||||
<% properties.forEach(function(prop) { -%>
|
||||
<% if (prop.isInput) { -%>
|
||||
| <%= prop.name %> | `<%- prop.type %>` | <%= prop.defaultValue %> | <%= prop.docText %> |
|
||||
<% } -%>
|
||||
<% }) -%>
|
||||
<% } %>
|
||||
<% if (hasOutputs) { %>
|
||||
|
||||
### Events
|
||||
|
||||
| Name | Type | Description |
|
||||
| -- | -- | -- |
|
||||
<% properties.forEach(function(prop) { %>
|
||||
<% if (prop.isOutput) { %>
|
||||
| <%= prop.name %> | `<%- prop.type %>` | <%= prop.docText %> |
|
||||
<% } %>
|
||||
<% }) %>
|
||||
<% } %>
|
23
tools/doc/templates/directive.combyne
vendored
23
tools/doc/templates/directive.combyne
vendored
@ -1,23 +0,0 @@
|
||||
{% if hasInputs %}
|
||||
### Properties
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| -- | -- | -- | -- |
|
||||
{% each properties as prop %}
|
||||
{% if prop.isInput %}
|
||||
| {{{prop.name}}} | `{{{prop.type}}}` | {{{prop.defaultValue}}} | {{{prop.docText}}} |
|
||||
{% endif %}
|
||||
{% endeach %}
|
||||
{% endif %}
|
||||
{% if hasOutputs%}
|
||||
|
||||
### Events
|
||||
|
||||
| Name | Type | Description |
|
||||
| -- | -- | -- |
|
||||
{% each properties as prop %}
|
||||
{% if prop.isOutput %}
|
||||
| {{prop.name}} | `{{{prop.type}}}` | {{{prop.docText}}} |
|
||||
{% endif %}
|
||||
{% endeach %}
|
||||
{% endif %}
|
23
tools/doc/templates/directive.ejs
vendored
Normal file
23
tools/doc/templates/directive.ejs
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
<% if (hasInputs) { %>
|
||||
### Properties
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| -- | -- | -- | -- |
|
||||
<% properties.forEach(function(prop) { -%>
|
||||
<% if (prop.isInput) { -%>
|
||||
| <%= prop.name %> | `<%- prop.type %>` | <%= prop.defaultValue %> | <%= prop.docText %> |
|
||||
<% } -%>
|
||||
<% }) -%>
|
||||
<% } %>
|
||||
<% if (hasOutputs) { %>
|
||||
|
||||
### Events
|
||||
|
||||
| Name | Type | Description |
|
||||
| -- | -- | -- |
|
||||
<% properties.forEach(function(prop) { %>
|
||||
<% if (prop.isOutput) { %>
|
||||
| <%= prop.name %> | `<%- prop.type %>` | <%= prop.docText %> |
|
||||
<% } %>
|
||||
<% }) %>
|
||||
<% } %>
|
14
tools/doc/templates/service.combyne
vendored
14
tools/doc/templates/service.combyne
vendored
@ -1,14 +0,0 @@
|
||||
|
||||
{% if hasMethods %}
|
||||
### Methods
|
||||
|
||||
{% each methods as meth %}- **{{meth.name}}**{{{meth.signature}}}{% if meth.returnsSomething %}: `{{{meth.returnType}}}`{% endif %}<br/>
|
||||
{{meth.docText}}
|
||||
{% each meth.params as param %}
|
||||
- *{{{param.name}}}:* `{{{param.type}}}` - {% if param.isOptional %}(Optional){% endif %}{{{param.docText}}}
|
||||
{% endeach %}
|
||||
{% if meth.returnsSomething %}
|
||||
- **Returns** `{{{meth.returnType}}}` - {{{meth.returnDocText}}}
|
||||
{% endif %}
|
||||
{% endeach %}
|
||||
{% endif %}
|
15
tools/doc/templates/service.ejs
vendored
Normal file
15
tools/doc/templates/service.ejs
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
<% if (hasMethods) { %>
|
||||
### Methods
|
||||
|
||||
<% methods.forEach(function(meth) { -%>
|
||||
- **<%= meth.name %>**<%= meth.signature %><% if (meth.returnsSomething) { %>: `<%- meth.returnType %>`<% } %><br/>
|
||||
<%= meth.docText %>
|
||||
<% meth.params.forEach(function(param) { -%>
|
||||
- *<%= param.name%>:* `<%- param.type %>` - <% if (param.isOptional) { %>(Optional)<% } %><%= param.docText %>
|
||||
<% }) -%>
|
||||
<% if (meth.returnsSomething) { -%>
|
||||
- **Returns** `<%- meth.returnType %>` - <%= meth.returnDocText %>
|
||||
<% } -%>
|
||||
<% }) -%>
|
||||
<% } %>
|
5
tools/doc/templates/tutIndex.combyne
vendored
5
tools/doc/templates/tutIndex.combyne
vendored
@ -1,5 +0,0 @@
|
||||
| Name | Level | Abstract |
|
||||
| -- | -- | -- |
|
||||
{% each tuts as tut %}
|
||||
| [**{{tut.title}}**]({{tut.link}}) | {{tut.level}} | {{tut.briefDesc}} |
|
||||
{% endeach %}
|
5
tools/doc/templates/tutIndex.ejs
vendored
Normal file
5
tools/doc/templates/tutIndex.ejs
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
| Name | Level | Abstract |
|
||||
| -- | -- | -- |
|
||||
<% tuts.forEach(function(tut) { -%>
|
||||
| [**<%= tut.title %>**](<%= tut.link %>) | <%= tut.level %> | <%= tut.briefDesc %> |
|
||||
<% }) %>
|
3
tools/doc/templates/versIndex.combyne
vendored
3
tools/doc/templates/versIndex.combyne
vendored
@ -1,3 +0,0 @@
|
||||
{% each items as item %}
|
||||
- [{{item.title}}]({{item.link}})
|
||||
{% endeach %}
|
3
tools/doc/templates/versIndex.ejs
vendored
Normal file
3
tools/doc/templates/versIndex.ejs
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
<% items.forEach(function(item) { -%>
|
||||
- [<%= item.title %>](<%= item.link %>)
|
||||
<% }) %>
|
@ -4,7 +4,7 @@ var fs = require("fs");
|
||||
var path = require("path");
|
||||
var replaceSection = require("mdast-util-heading-range");
|
||||
var remark = require("remark");
|
||||
var combyne = require("combyne");
|
||||
var ejs = require("ejs");
|
||||
var typedoc_1 = require("typedoc");
|
||||
var mdNav_1 = require("../mdNav");
|
||||
var libFolders = ["core", "content-services", "process-services", "insights"];
|
||||
@ -79,9 +79,9 @@ var ParamInfo = /** @class */ (function () {
|
||||
this.combined = this.name;
|
||||
if (this.isOptional)
|
||||
this.combined += "?";
|
||||
this.combined += ": " + this.type;
|
||||
this.combined += ": `" + this.type + "`";
|
||||
if (this.defaultValue !== "")
|
||||
this.combined += " = " + this.defaultValue;
|
||||
this.combined += " = `" + this.defaultValue + "`";
|
||||
}
|
||||
return ParamInfo;
|
||||
}());
|
||||
@ -213,10 +213,10 @@ function updatePhase(tree, pathname, aggData, errorMessages) {
|
||||
var methodMD = getMethodDocsFromMD(tree);
|
||||
updateMethodDocsFromMD(compData, methodMD, errorMessages);
|
||||
}
|
||||
var templateName = path.resolve(templateFolder, classType + ".combyne");
|
||||
var templateName = path.resolve(templateFolder, classType + ".ejs");
|
||||
var templateSource = fs.readFileSync(templateName, "utf8");
|
||||
var template = combyne(templateSource);
|
||||
var mdText = template.render(compData);
|
||||
var template = ejs.compile(templateSource);
|
||||
var mdText = template(compData);
|
||||
mdText = mdText.replace(/^ +\|/mg, "|");
|
||||
var newSection_1 = remark().data("settings", { paddedTable: false, gfm: false }).parse(mdText.trim()).children;
|
||||
replaceSection(tree, "Class members", function (before, section, after) {
|
||||
|
@ -7,6 +7,7 @@ import * as stringify from "remark-stringify";
|
||||
import * as frontMatter from "remark-frontmatter";
|
||||
|
||||
import * as combyne from "combyne";
|
||||
import * as ejs from "ejs";
|
||||
|
||||
import {
|
||||
Application,
|
||||
@ -129,10 +130,10 @@ class ParamInfo {
|
||||
if (this.isOptional)
|
||||
this.combined += "?";
|
||||
|
||||
this.combined += `: ${this.type}`;
|
||||
this.combined += `: \`${this.type}\``;
|
||||
|
||||
if (this.defaultValue !== "")
|
||||
this.combined += ` = ${this.defaultValue}`;
|
||||
this.combined += ` = \`${this.defaultValue}\``;
|
||||
}
|
||||
}
|
||||
|
||||
@ -307,11 +308,11 @@ export function updatePhase(tree, pathname, aggData, errorMessages) {
|
||||
updateMethodDocsFromMD(compData, methodMD, errorMessages);
|
||||
}
|
||||
|
||||
let templateName = path.resolve(templateFolder, classType + ".combyne");
|
||||
let templateName = path.resolve(templateFolder, classType + ".ejs");
|
||||
let templateSource = fs.readFileSync(templateName, "utf8");
|
||||
let template = combyne(templateSource);
|
||||
let template = ejs.compile(templateSource);
|
||||
|
||||
let mdText = template.render(compData);
|
||||
let mdText = template(compData);
|
||||
mdText = mdText.replace(/^ +\|/mg, "|");
|
||||
|
||||
let newSection = remark().data("settings", {paddedTable: false, gfm: false}).parse(mdText.trim()).children;
|
||||
|
@ -1,12 +1,12 @@
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
var replaceSection = require("mdast-util-heading-range");
|
||||
var remark = require("remark");
|
||||
var frontMatter = require("remark-frontmatter");
|
||||
var yaml = require("js-yaml");
|
||||
var combyne = require("combyne");
|
||||
var ejs = require("ejs");
|
||||
var unist = require("../unistHelpers");
|
||||
var tutFolder = path.resolve("docs", "tutorials");
|
||||
var templateFolder = path.resolve("tools", "doc", "templates");
|
||||
@ -17,10 +17,10 @@ function readPhase(tree, pathname, aggData) { }
|
||||
exports.readPhase = readPhase;
|
||||
function aggPhase(aggData) {
|
||||
var indexDocData = getIndexDocData();
|
||||
var templateName = path.resolve(templateFolder, "tutIndex.combyne");
|
||||
var templateName = path.resolve(templateFolder, "tutIndex.ejs");
|
||||
var templateSource = fs.readFileSync(templateName, "utf8");
|
||||
var template = combyne(templateSource);
|
||||
var mdText = template.render(indexDocData);
|
||||
var template = ejs.compile(templateSource);
|
||||
var mdText = template(indexDocData);
|
||||
mdText = mdText.replace(/^ +\|/mg, "|");
|
||||
var newSection = remark().data("settings", { paddedTable: false, gfm: false }).parse(mdText.trim()).children;
|
||||
var tutIndexFile = path.resolve(tutFolder, "README.md");
|
||||
|
@ -6,7 +6,7 @@ import * as remark from "remark";
|
||||
import * as stringify from "remark-stringify";
|
||||
import * as frontMatter from "remark-frontmatter";
|
||||
import * as yaml from "js-yaml";
|
||||
import * as combyne from "combyne";
|
||||
import * as ejs from "ejs";
|
||||
|
||||
import * as unist from "../unistHelpers";
|
||||
|
||||
@ -23,11 +23,11 @@ export function readPhase(tree, pathname, aggData) {}
|
||||
export function aggPhase(aggData) {
|
||||
let indexDocData = getIndexDocData();
|
||||
|
||||
let templateName = path.resolve(templateFolder, "tutIndex.combyne");
|
||||
let templateName = path.resolve(templateFolder, "tutIndex.ejs");
|
||||
let templateSource = fs.readFileSync(templateName, "utf8");
|
||||
let template = combyne(templateSource);
|
||||
let template = ejs.compile(templateSource);
|
||||
|
||||
let mdText = template.render(indexDocData);
|
||||
let mdText = template(indexDocData);
|
||||
mdText = mdText.replace(/^ +\|/mg, "|");
|
||||
|
||||
let newSection = remark().data("settings", {paddedTable: false, gfm: false}).parse(mdText.trim()).children;
|
||||
|
@ -7,7 +7,7 @@ var stringify = require("remark-stringify");
|
||||
var zone = require("mdast-zone");
|
||||
var frontMatter = require("remark-frontmatter");
|
||||
|
||||
var combyne = require("combyne");
|
||||
var ejs = require("ejs");
|
||||
|
||||
var unist = require("../unistHelpers");
|
||||
var ngHelpers = require("../ngHelpers");
|
||||
@ -77,9 +77,9 @@ function aggPhase(aggData) {
|
||||
return 0;
|
||||
});
|
||||
|
||||
var templateName = path.resolve(templateFolder, "versIndex.combyne");
|
||||
var templateName = path.resolve(templateFolder, "versIndex.ejs");
|
||||
var templateSource = fs.readFileSync(templateName, "utf8");
|
||||
var template = combyne(templateSource);
|
||||
var template = ejs.compile(templateSource);
|
||||
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var version = keys[i];
|
||||
@ -105,7 +105,7 @@ function aggPhase(aggData) {
|
||||
});
|
||||
}
|
||||
|
||||
var mdText = template.render(versionTemplateData);
|
||||
var mdText = template(versionTemplateData);
|
||||
mdText = mdText.replace(/^ +-/mg, "-");
|
||||
|
||||
var newSection = remark().data("settings", {paddedTable: false, gfm: false}).parse(mdText.trim()).children;
|
||||
|
Loading…
x
Reference in New Issue
Block a user