Add extra.repo_type config option to override link parser

This commit is contained in:
squidfunk 2016-10-16 18:22:07 +02:00
parent eaeba59dd8
commit a18eb4f982
2 changed files with 18 additions and 16 deletions

View File

@ -1,13 +1,14 @@
{% if "github." in repo_url %}
{% set platform = "md-source--github" %}
{% elif "gitlab." in repo_url %}
{% set platform = "md-source--gitlab" %}
{% elif "bitbucket." in repo_url %}
{% set platform = "md-source--bitbucket" %}
{% set platform = config.extra.repo_icon or repo_url %}
{% if "github" in platform %}
{% set repo_icon = "md-source--github" %}
{% elif "gitlab" in platform %}
{% set repo_icon = "md-source--gitlab" %}
{% elif "bitbucket" in platform %}
{% set repo_icon = "md-source--bitbucket" %}
{% else %}
{% set platform = "" %}
{% set repo_icon = "" %}
{% endif %}
<a href="{{ repo_url }}" title="Go to repository" class="md-source {{ platform }}">
<a href="{{ repo_url }}" title="Go to repository" class="md-source {{ repo_icon }}">
<div class="md-source__repository">
{{ repo_name }}
<ul class="md-source__facts">

View File

@ -24,19 +24,20 @@
Check whether the repository is hosted on one of the supported code hosting
platforms (Github, Gitlab or Bitbucket) to show icon.
-->
{% if "github." in repo_url %}
{% set platform = "md-source--github" %}
{% elif "gitlab." in repo_url %}
{% set platform = "md-source--gitlab" %}
{% elif "bitbucket." in repo_url %}
{% set platform = "md-source--bitbucket" %}
{% set platform = config.extra.repo_icon or repo_url %}
{% if "github" in platform %}
{% set repo_icon = "md-source--github" %}
{% elif "gitlab" in platform %}
{% set repo_icon = "md-source--gitlab" %}
{% elif "bitbucket" in platform %}
{% set repo_icon = "md-source--bitbucket" %}
{% else %}
{% set platform = "" %}
{% set repo_icon = "" %}
{% endif %}
<!-- Repository containing source -->
<a href="{{ repo_url }}" title="Go to repository"
class="md-source {{ platform }}">
class="md-source {{ repo_icon }}">
<div class="md-source__repository">
{{ repo_name }}
<ul class="md-source__facts">