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 = config.extra.repo_icon or repo_url %}
{% set platform = "md-source--github" %} {% if "github" in platform %}
{% elif "gitlab." in repo_url %} {% set repo_icon = "md-source--github" %}
{% set platform = "md-source--gitlab" %} {% elif "gitlab" in platform %}
{% elif "bitbucket." in repo_url %} {% set repo_icon = "md-source--gitlab" %}
{% set platform = "md-source--bitbucket" %} {% elif "bitbucket" in platform %}
{% set repo_icon = "md-source--bitbucket" %}
{% else %} {% else %}
{% set platform = "" %} {% set repo_icon = "" %}
{% endif %} {% 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"> <div class="md-source__repository">
{{ repo_name }} {{ repo_name }}
<ul class="md-source__facts"> <ul class="md-source__facts">

View File

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