githubLinks.html 1.88 KB
Newer Older
1 2 3 4 5
{% macro projectRelativePath(fileInfo) -%}
{$ fileInfo.realProjectRelativePath if fileInfo.realProjectRelativePath else fileInfo.projectRelativePath $}
{%- endmacro %}

{% macro githubViewHref(doc, versionInfo) -%}
6
{% set githubUrl = 'https://github.com/' + versionInfo.gitRepoInfo.owner + '/' + 'angular-cn' -%}
7 8 9
{% set version = versionInfo.currentVersion.isSnapshot and versionInfo.currentVersion.SHA or versionInfo.currentVersion.raw -%}
{% set lineInfo = doc.startingLine and ('#L' + (doc.startingLine + 1) + '-L' + (doc.endingLine + 1)) or '' -%}
{$ githubUrl $}/tree/{$ version $}/{$ projectRelativePath(doc.fileInfo) $}{$ lineInfo $}
10 11
{%- endmacro %}

12
{% macro githubEditHref(doc, versionInfo, pathPrefix) -%}
13
{% set githubUrl = 'https://github.com/' + versionInfo.gitRepoInfo.owner + '/' + 'angular-cn' -%}
14
{% set lineInfo = doc.startingLine and ('#L' + (doc.startingLine + 1) + '-L' + (doc.endingLine + 1)) or '' -%}
15
{$ githubUrl $}/edit/aio/{$ projectRelativePath(doc.fileInfo) $}?message=docs
16 17 18 19
  {%- if doc.moduleDoc %}({$ doc.moduleDoc.id.split('/')[0] $})
  {%- elseif doc.docType === 'module' %}({$ doc.id.split('/')[0] $})
  {%- elseif doc.docType === 'content' %}
  {%- else %}(...){%- endif -%}
20
%3A%20请简述你的修改...{$ lineInfo $}
21 22 23
{%- endmacro %}

{% macro githubEditLink(doc, versionInfo) -%}
24
<a href="{$ githubEditHref(doc, versionInfo) $}" aria-label="提供编辑建议" title="提供编辑建议"><i class="material-icons" aria-hidden="true" role="img">mode_edit</i></a>
25 26 27
{%- endmacro %}

{% macro githubViewLink(doc, versionInfo) -%}
28
<a href="{$ githubViewHref(doc, versionInfo) $}" aria-label="查看源码" title="查看源码"><i class="material-icons" aria-hidden="true" role="img">code</i></a>
29 30 31 32 33 34 35 36
{%- endmacro %}

{% macro githubLinks(doc, versionInfo) -%}
<div class="github-links">
  {$ githubEditLink(doc, versionInfo) $}
  {$ githubViewLink(doc, versionInfo) $}
</div>
{%- endmacro -%}