OpenAPI spec parsing: add custom templates w/ warning

This commit is contained in:
mDuo13
2019-10-01 17:01:08 -07:00
parent f4d7460a26
commit c2d8cd7f5a
7 changed files with 276 additions and 23 deletions

View File

@@ -1,26 +1,28 @@
<div class="github-edit-wrap">
{% set have_edit_link = False %}
{% if currentpage.md is defined %}
{% if currentpage.md.startswith("http://") or
currentpage.md.startswith("https://") %}
{# Leave have_edit_link = False #}
{% else %}
{% set have_edit_link = True %}
{% set githuburl = target.github_forkurl + "/edit/"
+ target.github_branch
+ "/content/" + currentpage.md %}
{% endif %}
{% elif currentpage.template is defined %}
{% set have_edit_link = True %}
{% set githuburl = target.github_forkurl + "/edit/"
+ target.github_branch + "/tool/" + currentpage.template %}
{% if target.github_forkurl is defined %}
{% set have_edit_link = False %}
{% if currentpage.md is defined %}
{% if currentpage.md.startswith("http://") or
currentpage.md.startswith("https://") %}
{# Leave have_edit_link = False #}
{% else %}
{% set have_edit_link = True %}
{% set githuburl = target.github_forkurl + "/edit/"
+ target.github_branch
+ "/content/" + currentpage.md %}
{% endif %}
{% elif currentpage.template is defined %}
{% set have_edit_link = True %}
{% set githuburl = target.github_forkurl + "/edit/"
+ target.github_branch + "/tool/" + currentpage.template %}
{% endif %}
{% if target.is_pr_build is defined and target.is_pr_build and have_edit_link %}
{% set githuburl = githuburl + "?pr=/ripple/ripple-dev-portal/pull/"
+ target.github_pr_id %}
{% endif %}
{% if not have_edit_link %}
{% set githuburl = target.github_forkurl %}
{% endif %}
<a href="{{githuburl}}" target="_blank" class="github-edit">Edit</a>
{% endif %}
{% if target.is_pr_build is defined and target.is_pr_build and have_edit_link %}
{% set githuburl = githuburl + "?pr=/ripple/ripple-dev-portal/pull/"
+ target.github_pr_id %}
{% endif %}
{% if not have_edit_link %}
{% set githuburl = target.github_forkurl %}
{% endif %}
<a href="{{githuburl}}" target="_blank" class="github-edit">Edit</a>
</div><!-- /.github-edit -->