Added support for custom repository icons

This commit is contained in:
squidfunk 2019-12-23 20:24:24 +01:00
parent bd712ca794
commit 9d67cdfe4a
10 changed files with 12 additions and 53 deletions

View File

@ -396,9 +396,6 @@ hr {
padding: 0;
border: 0; }
.md-svg {
display: none; }
.md-grid {
max-width: 61rem;
margin-right: auto;
@ -1079,13 +1076,13 @@ hr {
display: inline-block;
width: 2.4rem;
height: 2.4rem;
content: "";
vertical-align: middle; }
.md-source__icon svg {
width: 1.2rem;
height: 1.2rem;
margin-top: 0.6rem;
margin-left: 0.6rem; }
margin-left: 0.6rem;
fill: white; }
[dir="rtl"] .md-source__icon svg {
margin-right: 0.6rem;
margin-left: initial; }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -87,18 +87,6 @@
{% else %}
<body dir="{{ lang.t('direction') }}">
{% endif %}
<svg class="md-svg">
<defs>
{% set platform = config.extra.repo_icon or config.repo_url %}
{% if "github" in platform %}
{% include "assets/images/icons/github.svg" %}
{% elif "gitlab" in platform %}
{% include "assets/images/icons/gitlab.svg" %}
{% elif "bitbucket" in platform %}
{% include "assets/images/icons/bitbucket.svg" %}
{% endif %}
</defs>
</svg>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>

View File

@ -2,7 +2,7 @@
This file was automatically generated - do not edit
-#}
{% import "partials/language.html" as lang with context %}
{% set platform = config.extra.repo_icon or config.repo_url %}
{% set platform = config.repo_url %}
{% if "github" in platform %}
{% set repo_type = "github" %}
{% elif "gitlab" in platform %}
@ -15,9 +15,8 @@
<a href="{{ config.repo_url }}" title="{{ lang.t('source.link.title') }}" class="md-source" data-md-source="{{ repo_type }}">
{% if repo_type %}
<div class="md-source__icon">
<svg viewBox="0 0 24 24" width="24" height="24">
<use xlink:href="#__{{ repo_type }}" width="24" height="24"></use>
</svg>
{% set repo_icon = config.extra.repo_icon | default("brands/git-alt") %}
{% include "assets/images/icons/fontawesome/" ~ repo_icon ~ ".svg" %}
</div>
{% endif %}
<div class="md-source__repository">

View File

@ -91,11 +91,6 @@ hr {
border: 0;
}
// Inline SVG container
.md-svg {
display: none;
}
// Template-wide grid
.md-grid {
max-width: px2rem(1220px);

View File

@ -89,7 +89,6 @@
display: inline-block;
width: px2rem(48px);
height: px2rem(48px);
content: "";
vertical-align: middle;
// Align SVG, do not scale, as this will incur strange formatting bugs
@ -99,6 +98,7 @@
height: px2rem(24px);
margin-top: px2rem(12px);
margin-left: px2rem(12px);
fill: $md-color-white;
// Adjust for RTL languages
[dir="rtl"] & {

View File

@ -190,25 +190,6 @@
<body dir="{{ lang.t('direction') }}">
{% endif %}
<!-- Hidden container for inline SVGs -->
<svg class="md-svg">
<defs>
<!--
Check whether the repository is hosted on one of the supported code
hosting platforms (GitHub, GitLab or Bitbucket) to show icon.
-->
{% set platform = config.extra.repo_icon or config.repo_url %}
{% if "github" in platform %}
{% include "assets/images/icons/github.svg" %}
{% elif "gitlab" in platform %}
{% include "assets/images/icons/gitlab.svg" %}
{% elif "bitbucket" in platform %}
{% include "assets/images/icons/bitbucket.svg" %}
{% endif %}
</defs>
</svg>
<!--
State toggles - we need to set autocomplete="off" in order to reset the
drawer on back button invocation in some browsers

View File

@ -26,7 +26,7 @@
Check whether the repository is hosted on one of the supported code hosting
platforms (GitHub, GitLab or Bitbucket) to show icon.
-->
{% set platform = config.extra.repo_icon or config.repo_url %}
{% set platform = config.repo_url %}
{% if "github" in platform %}
{% set repo_type = "github" %}
{% elif "gitlab" in platform %}
@ -46,9 +46,8 @@
>
{% if repo_type %}
<div class="md-source__icon">
<svg viewBox="0 0 24 24" width="24" height="24">
<use xlink:href="#__{{ repo_type }}" width="24" height="24"></use>
</svg>
{% set repo_icon = config.extra.repo_icon | default("brands/git-alt") %}
{% include "assets/images/icons/fontawesome/" ~ repo_icon ~ ".svg" %}
</div>
{% endif %}
<div class="md-source__repository">