From 9533cc980974429b51c99839de1d8e7627f4358b Mon Sep 17 00:00:00 2001 From: Martin Sikora Date: Fri, 8 Jun 2018 17:41:30 +0200 Subject: [PATCH] feat(docs-infra): add "suggest edits" feature to all docs (#24378) PR Close #24378 --- .../transforms/angular-content-package/index.js | 2 +- .../transforms/templates/api/base.template.html | 2 +- .../transforms/templates/api/includes/info-bar.html | 2 +- aio/tools/transforms/templates/content.template.html | 5 +++++ .../templates/{api/lib => }/githubLinks.html | 12 ++++++++---- .../transforms/templates/overview-dump.template.html | 2 +- 6 files changed, 17 insertions(+), 8 deletions(-) rename aio/tools/transforms/templates/{api/lib => }/githubLinks.html (68%) diff --git a/aio/tools/transforms/angular-content-package/index.js b/aio/tools/transforms/angular-content-package/index.js index 8a064a4605..b0635ae198 100644 --- a/aio/tools/transforms/angular-content-package/index.js +++ b/aio/tools/transforms/angular-content-package/index.js @@ -43,7 +43,7 @@ module.exports = new Package('angular-content', [basePackage, contentPackage]) readFilesProcessor.sourceFiles = readFilesProcessor.sourceFiles.concat([ { basePath: CONTENTS_PATH, - include: CONTENTS_PATH + '/{cookbook,guide,tutorial}/**/*.md', + include: CONTENTS_PATH + '/{guide,tutorial}/**/*.md', fileReader: 'contentFileReader' }, { diff --git a/aio/tools/transforms/templates/api/base.template.html b/aio/tools/transforms/templates/api/base.template.html index 8826e9b913..9921669f26 100644 --- a/aio/tools/transforms/templates/api/base.template.html +++ b/aio/tools/transforms/templates/api/base.template.html @@ -1,4 +1,4 @@ -{% import "lib/githubLinks.html" as github -%} +{% import "../githubLinks.html" as github -%} {% set comma = joiner(',') %} {% set breadcrumbDelimiter = joiner('>') %}
diff --git a/aio/tools/transforms/templates/api/includes/info-bar.html b/aio/tools/transforms/templates/api/includes/info-bar.html index 5a30c525ba..e915cee065 100644 --- a/aio/tools/transforms/templates/api/includes/info-bar.html +++ b/aio/tools/transforms/templates/api/includes/info-bar.html @@ -1,4 +1,4 @@ -{% import "lib/githubLinks.html" as github -%} +{% import "../../githubLinks.html" as github -%}
diff --git a/aio/tools/transforms/templates/content.template.html b/aio/tools/transforms/templates/content.template.html index a9216df1df..c02c83c481 100644 --- a/aio/tools/transforms/templates/content.template.html +++ b/aio/tools/transforms/templates/content.template.html @@ -1,4 +1,9 @@ +{% import "githubLinks.html" as github -%} + {% if doc.title %}{$ ('# ' + doc.title.trim()) | marked $}{% endif %} +
{$ doc.description | marked $}
\ No newline at end of file diff --git a/aio/tools/transforms/templates/api/lib/githubLinks.html b/aio/tools/transforms/templates/githubLinks.html similarity index 68% rename from aio/tools/transforms/templates/api/lib/githubLinks.html rename to aio/tools/transforms/templates/githubLinks.html index f99b37543b..dc5e7092bc 100644 --- a/aio/tools/transforms/templates/api/lib/githubLinks.html +++ b/aio/tools/transforms/templates/githubLinks.html @@ -1,14 +1,18 @@ +{% macro projectRelativePath(fileInfo) -%} +{$ fileInfo.realProjectRelativePath if fileInfo.realProjectRelativePath else fileInfo.projectRelativePath $} +{%- endmacro %} + {% macro githubViewHref(doc, versionInfo) -%} https://github.com/{$ versionInfo.gitRepoInfo.owner $}/{$ versionInfo.gitRepoInfo.repo $}/tree/{$ versionInfo.currentVersion.isSnapshot and versionInfo.currentVersion.SHA or versionInfo.currentVersion.raw $}/packages/{$ doc.fileInfo.realProjectRelativePath or doc.fileInfo.relativePath $}#L{$ doc.startingLine + 1 $}-L{$ doc.endingLine + 1 $} {%- endmacro -%} - {% macro githubEditHref(doc, versionInfo) -%} -https://github.com/{$ versionInfo.gitRepoInfo.owner $}/{$ versionInfo.gitRepoInfo.repo $}/edit/master/packages/{$ doc.fileInfo.realProjectRelativePath or doc.fileInfo.relativePath $}?message=docs( +https://github.com/{$ versionInfo.gitRepoInfo.owner $}/{$ versionInfo.gitRepoInfo.repo $}/edit/master{$ '/packages' if doc.docType !== 'content' $}/{$ projectRelativePath(doc.fileInfo) $}?message=docs( {%- if doc.moduleDoc %}{$ doc.moduleDoc.id.split('/')[0] $} {%- elseif doc.docType === 'package' %}{$ doc.id.split('/')[0] $} + {%- elseif doc.docType === 'content' %}aio {%- else %}...{%- endif -%} -)%3A%20describe%20your%20change...#L{$ doc.startingLine + 1 $}-L{$ doc.endingLine + 1 $} +)%3A%20describe%20your%20change...{% if doc.docType !== 'content' %}#L{$ doc.startingLine + 1 $}-L{$ doc.endingLine + 1 $}{% endif %} {%- endmacro -%} {% macro githubLinks(doc, versionInfo) -%} @@ -16,4 +20,4 @@ https://github.com/{$ versionInfo.gitRepoInfo.owner $}/{$ versionInfo.gitRepoInf -{%- endmacro -%} \ No newline at end of file +{%- endmacro -%} diff --git a/aio/tools/transforms/templates/overview-dump.template.html b/aio/tools/transforms/templates/overview-dump.template.html index 14039af667..c51538a6cc 100644 --- a/aio/tools/transforms/templates/overview-dump.template.html +++ b/aio/tools/transforms/templates/overview-dump.template.html @@ -1,4 +1,4 @@ -{% import "api/lib/githubLinks.html" as github -%} +{% import "githubLinks.html" as github -%} {% import "api/lib/memberHelpers.html" as members -%} {% macro goToCode(doc) %}{% endmacro %} {% macro label(test, class, text) %}{% if test %}{% endif %}{% endmacro %}