feat(docs-infra): add "suggest edits" feature to all docs (#24378)
PR Close #24378
This commit is contained in:
parent
06d04002fd
commit
9533cc9809
|
@ -43,7 +43,7 @@ module.exports = new Package('angular-content', [basePackage, contentPackage])
|
||||||
readFilesProcessor.sourceFiles = readFilesProcessor.sourceFiles.concat([
|
readFilesProcessor.sourceFiles = readFilesProcessor.sourceFiles.concat([
|
||||||
{
|
{
|
||||||
basePath: CONTENTS_PATH,
|
basePath: CONTENTS_PATH,
|
||||||
include: CONTENTS_PATH + '/{cookbook,guide,tutorial}/**/*.md',
|
include: CONTENTS_PATH + '/{guide,tutorial}/**/*.md',
|
||||||
fileReader: 'contentFileReader'
|
fileReader: 'contentFileReader'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{% import "lib/githubLinks.html" as github -%}
|
{% import "../githubLinks.html" as github -%}
|
||||||
{% set comma = joiner(',') %}
|
{% set comma = joiner(',') %}
|
||||||
{% set breadcrumbDelimiter = joiner('>') %}
|
{% set breadcrumbDelimiter = joiner('>') %}
|
||||||
<article>
|
<article>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{% import "lib/githubLinks.html" as github -%}
|
{% import "../../githubLinks.html" as github -%}
|
||||||
|
|
||||||
<!-- INFO BAR -->
|
<!-- INFO BAR -->
|
||||||
<section class="info-bar">
|
<section class="info-bar">
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
|
{% import "githubLinks.html" as github -%}
|
||||||
|
|
||||||
{% if doc.title %}{$ ('# ' + doc.title.trim()) | marked $}{% endif %}
|
{% if doc.title %}{$ ('# ' + doc.title.trim()) | marked $}{% endif %}
|
||||||
|
<div class="page-actions">
|
||||||
|
<a href="{$ github.githubEditHref(doc, versionInfo) $}" aria-label="Suggest Edits" title="Suggest Edits"><i class="material-icons" aria-hidden="true" role="img">mode_edit</i></a>
|
||||||
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{$ doc.description | marked $}
|
{$ doc.description | marked $}
|
||||||
</div>
|
</div>
|
|
@ -1,14 +1,18 @@
|
||||||
|
{% macro projectRelativePath(fileInfo) -%}
|
||||||
|
{$ fileInfo.realProjectRelativePath if fileInfo.realProjectRelativePath else fileInfo.projectRelativePath $}
|
||||||
|
{%- endmacro %}
|
||||||
|
|
||||||
{% macro githubViewHref(doc, versionInfo) -%}
|
{% 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 $}
|
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 -%}
|
{%- endmacro -%}
|
||||||
|
|
||||||
|
|
||||||
{% macro githubEditHref(doc, versionInfo) -%}
|
{% 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] $}
|
{%- if doc.moduleDoc %}{$ doc.moduleDoc.id.split('/')[0] $}
|
||||||
{%- elseif doc.docType === 'package' %}{$ doc.id.split('/')[0] $}
|
{%- elseif doc.docType === 'package' %}{$ doc.id.split('/')[0] $}
|
||||||
|
{%- elseif doc.docType === 'content' %}aio
|
||||||
{%- else %}...{%- endif -%}
|
{%- 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 -%}
|
{%- endmacro -%}
|
||||||
|
|
||||||
{% macro githubLinks(doc, versionInfo) -%}
|
{% macro githubLinks(doc, versionInfo) -%}
|
||||||
|
@ -16,4 +20,4 @@ https://github.com/{$ versionInfo.gitRepoInfo.owner $}/{$ versionInfo.gitRepoInf
|
||||||
<a href="{$ githubEditHref(doc, versionInfo) $}" aria-label="Suggest Edits" title="Suggest Edits"><i class="material-icons" aria-hidden="true" role="img">mode_edit</i></a>
|
<a href="{$ githubEditHref(doc, versionInfo) $}" aria-label="Suggest Edits" title="Suggest Edits"><i class="material-icons" aria-hidden="true" role="img">mode_edit</i></a>
|
||||||
<a href="{$ githubViewHref(doc, versionInfo) $}" aria-label="View Source" title="View Source"><i class="material-icons" aria-hidden="true" role="img">code</i></a>
|
<a href="{$ githubViewHref(doc, versionInfo) $}" aria-label="View Source" title="View Source"><i class="material-icons" aria-hidden="true" role="img">code</i></a>
|
||||||
</div>
|
</div>
|
||||||
{%- endmacro -%}
|
{%- endmacro -%}
|
|
@ -1,4 +1,4 @@
|
||||||
{% import "api/lib/githubLinks.html" as github -%}
|
{% import "githubLinks.html" as github -%}
|
||||||
{% import "api/lib/memberHelpers.html" as members -%}
|
{% import "api/lib/memberHelpers.html" as members -%}
|
||||||
{% macro goToCode(doc) %}<a href="{$ github.githubViewHref(doc, versionInfo) $}" class="go-to-code" title="Go to source code"><i class="material-icons" aria-hidden="true" role="img">code</i></a>{% endmacro %}
|
{% macro goToCode(doc) %}<a href="{$ github.githubViewHref(doc, versionInfo) $}" class="go-to-code" title="Go to source code"><i class="material-icons" aria-hidden="true" role="img">code</i></a>{% endmacro %}
|
||||||
{% macro label(test, class, text) %}{% if test %}<label class="{$ class $}">{$ text $}</label>{% endif %}{% endmacro %}
|
{% macro label(test, class, text) %}{% if test %}<label class="{$ class $}">{$ text $}</label>{% endif %}{% endmacro %}
|
||||||
|
|
Loading…
Reference in New Issue