Commit 541d1ec4 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

Merge branch 'point-to-templates-projects' into 'master'

feat: point to the template's GitLab project

See merge request to-be-continuous/doc!93
parents a45187b2 cdb79937
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ site_dir: public
# edit_uri: doc/edit/master/docs/
theme:
  name: material
  custom_dir: overrides
  favicon: img/favicon.ico
  logo: img/tbc-50.png
  font: false

overrides/main.html

0 → 100644
+39 −0
Original line number Diff line number Diff line
{% extends "base.html" %}

{% block site_nav %}
            {% if nav %}
              {% if page.meta and page.meta.hide %}
                {% set hidden = "hidden" if "navigation" in page.meta.hide %}
              {% endif %}
              <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" {{ hidden }}>
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    {% include "partials/nav.html" %}
                  </div>
                </div>
              </div>
            {% endif %}
            {% if "toc.integrate" not in features %}
              {% if page.meta and page.meta.hide %}
                {% set hidden = "hidden" if "toc" in page.meta.hide %}
              {% endif %}
              <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" {{ hidden }}>
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    {% include "partials/toc.html" %}
                  </div>
                </div>
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                  {% if page.meta and page.meta.repo_url %}
                    <label class="md-nav__title" for="__toc">
                      <a href="{{ page.meta.repo_url }}">Edit this page</a>
                    </label>
                  {% endif %}
                  </div>
                </div>
              </div>
            {% endif %}

{% endblock %}
+22 −0
Original line number Diff line number Diff line
{% if page.meta and page.meta.repo_url %}
<a href="{{ page.meta.repo_url }}" title="{{ lang.t('source') }}" class="md-source" data-md-component="source">
  <div class="md-source__icon md-icon">
    {% set icon = config.theme.icon.repo or "fontawesome/brands/git-alt" %}
    {% include ".icons/" ~ icon ~ ".svg" %}
  </div>
  <div class="md-source__repository">
    {{ page.meta.repo_name }}
  </div>
</a>
{% else %}
<a href="{{ config.repo_url }}" title="{{ lang.t('source') }}" class="md-source" data-md-component="source">
  <div class="md-source__icon md-icon">
    {% set icon = config.theme.icon.repo or "fontawesome/brands/git-alt" %}
    {% include ".icons/" ~ icon ~ ".svg" %}
  </div>
  <div class="md-source__repository">
    {{ config.repo_name }}
  </div>
</a>
{% endif %}
+5 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ function maybe_process_template() {
  project_json="$1"
  extension_json="${2:-null}"
  project_id=$(echo "$project_json" | jq -r .id)
  project_nice_name=$(echo "$project_json" | jq -r .name)
  project_name=$(echo "$project_json" | jq -r .path)
  project_path=$(echo "$project_json" | jq -r .path_with_namespace)
  project_default_branch=$(echo "$project_json" | jq -r .default_branch)
@@ -85,6 +86,9 @@ function maybe_process_template() {
      log_info " ... downloading README.md to \\e[33;1m$DOC_OUT/ref/$project_name.md\\e[0m..."
      curl -sS -H "$AUTH_HEADER" --output "$DOC_OUT/ref/$project_name.md" "$API_URL/projects/$project_id/repository/files/README.md/raw?ref=$project_default_branch"

      # add frontmatter
      sed -i "1i---\nrepo_name: $project_nice_name\nrepo_url: $web_url\nicon_url: $$web_url/-/avatar\n---\n" "$DOC_OUT/ref/$project_name.md"

      # write template card
      {
        echo "-   <img class=\"tbc-tmpl-icon\" src=\"$web_url/-/avatar\"> [**$template_name**]($project_name)"
@@ -322,6 +326,7 @@ function build_aggregated_toc() {

# API url default to local GitLab instance
API_URL=${BASE_API_URL:-https://gitlab.com/api/v4}
SERVER_URL=${API_URL%/api/*}
JSON_OUT=kicker-aggregated.json
IMAGES_OUT=tbc-default-images.out
DOC_OUT=./docs