Skip to content

Commit

Permalink
green for types
Browse files Browse the repository at this point in the history
  • Loading branch information
hry-gh committed May 27, 2024
1 parent 4d3a341 commit d985699
Show file tree
Hide file tree
Showing 12 changed files with 133 additions and 73 deletions.
2 changes: 2 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ extra_syntaxes_and_themes = ["syntaxes"]

[extra]
# Put all your custom variables here
repo = "https://github.com/harryob/od-dm-reference"
branch = "main"
3 changes: 3 additions & 0 deletions content/objects/exception/_index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
+++
title = "/exception"

[extra]
parent_type = "/datum"
+++
31 changes: 16 additions & 15 deletions styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ body {
}

.left-bar {
padding-right: 10px;
background-color: #1b1b1b;
height: 100vh;
border-right: 1px solid #fdfeff;
Expand All @@ -42,20 +41,6 @@ body {
animation-duration: 0.3s;
}

i.navigation-button {
cursor: pointer;
position: absolute;
top: 4%;
right: 3%;

}

@media (min-width: 768px) {
i.navigation-button {
display: none;
}
}

@keyframes slide-in {
from {left: -100%} to {left: 0%}
}
Expand All @@ -72,11 +57,24 @@ a {
color: #7a698f;
}

a > i {
color: #fdfeff;
}

.type {
color: #70C3AF;
text-decoration: dotted;
}


ul li.active > a {
color: #E67A82;
}

input[type="text"] {
border-radius: 4px;
}

.stork-output-visible {
position: absolute;
background: #1b1b1b;
Expand All @@ -101,6 +99,9 @@ ul li.active > a {
padding-left: 5px;
}

.stork-close-button {
display: none;
}

.container, .section {
width: 100%;
Expand Down
41 changes: 30 additions & 11 deletions templates/base.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{% import "macros.html" as macros %}

{%- if page -%}
{% set pageOrSubsection = page -%}
{% elif section -%}
{% set pageOrSubsection = section -%}
{% endif -%}

<!DOCTYPE html>
<html lang="en">

Expand All @@ -20,35 +26,48 @@
</head>

<body>
<div class="flex gap-10 mx-auto px-3">
<div class="flex gap-10 px-3">

<div class="left-bar hidden md:block" id="left-bar">
<div class="flex flex-row">
<img src="{{ get_url(path='favicon.svg') | safe }}" width=24px><input data-stork="ref-search" class="flex-grow m-2 pr-2" />
<img src="{{ get_url(path='favicon.svg') | safe }}" width=24px><input data-stork="ref-search" class="flex-grow m-2 pr-2" type="text" />
</div>
<div data-stork="ref-search-output" class="results"></div>
<nav role="navigation">
<nav role="navigation" class="pr-2">
<ul>
{%- block menu -%}
{%- set index = get_section(path="_index.md") -%}
{%- for subsectionPath in index.subsections | sort -%}
{%- set subsection = get_section(path=subsectionPath) -%}
{%- if page -%}
{% set pageOrSubsection = page -%}
{% elif section -%}
{% set pageOrSubsection = section -%}
{% endif -%}
{{ macros::render_subsection(currentPage=pageOrSubsection, subsection=subsection, depth=0) -}}
{%- endfor -%}
{%- endblock menu -%}
</ul>
</nav>
</div>

<i class="navigation-button fa-solid fa-bars fa-2xl" id="navigation-button"></i>

<section class="section">
<div class="container mt-5">{% block content %} {% endblock %}</div>
<div class="mt-5">
<div class="flex flex-col gap-5">
<div class="flex flex-col-reverse gap-5 md:flex-row justify-between">
<div>{% block header %} {% endblock %}</div>
<div class="flex flex-row justify-between md:justify-end">
<img src="{{ get_url(path='favicon.svg') | safe }}" width=28px class="md:hidden">
<div class="flex flex-row gap-1">
<div class="p-1">
<a href="{{ config.extra.repo }}/blob/{{ config.extra.branch }}/content/{{ pageOrSubsection.relative_path }}?plain=1">
<i class="fa-brands fa-github fa-2xl"></i></div>
</a>
<div class="p-1 md:hidden">
<i class="fa-solid fa-bars fa-2xl cursor-pointer" id="navigation-button" class="cursor-pointer md:hidden"></i></div>
</div>
</div>
</div>
<div>
{% block content %} {% endblock %}
</div>
</div>
</div>
</section>
</div>

Expand Down
9 changes: 5 additions & 4 deletions templates/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{% extends "base.html" %}

{% block content %}

<div class="flex flex-col gap-3">

{% block header %}
<h1 class="title text-3xl">
<div class="flex flex-row gap-2"><img src="{{ get_url(path='favicon.svg') | safe }}" width=24px>{{ section.title }}</div>
</h1>
{% endblock header %}

{% block content %}

<div class="flex flex-col gap-3">
{{ section.content | safe}}
</div>

Expand Down
69 changes: 40 additions & 29 deletions templates/macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

{% if current_path == subsection.path %}
{% set class = "active" %}
{% elif depth > 2
{% elif depth > 1
and current_path != subsection.path
and current_path != myParentSection.path
and current_path != subsectionParent.path
Expand All @@ -31,16 +31,18 @@
{% set class = "" %}
{% endif %}

{% set linkClass = "" %}
{% set firstChar = subsection.title | split(pat="") | nth(n = 1) -%}
{% if firstChar == "/" -%}
{% set class = class ~ " code-nav" %}
{% set linkClass = "type" %}
{% else %}
{% set class = class ~ " text-title" %}
{% endif %}

<li class="{{class}}" data-expand-tag="{{subsection.path}}" style="padding-left: 20px">
<i class="fa-solid fa-caret-right"></i>
<a href="{{ subsection.permalink | safe }}">
<a href="{{ subsection.permalink | safe }}" class="{{linkClass}}">
{{ subsection.title }}
</a>
{% if subsection.subsections %}
Expand Down Expand Up @@ -74,7 +76,7 @@

{% if current_path == page.path %}
{% set class = "active" %}
{% elif depth > 1
{% elif depth > 0
and current_path != subsection.path
and currentParent.path != subsection.path
and not renderAll %}
Expand Down Expand Up @@ -111,7 +113,7 @@
{% if recursive %}
{{ self::render_parent_type(page=url) }}
{% endif %}
<a href="{{ url.permalink | safe}}" class="code-title">{{url.title}}</a>
<a href="{{ url.permalink | safe}}" class="code-title type">{{url.title}}</a>
<i class="fa-solid fa-arrow-left"></i>
{% endif %}
{% endmacro render_parent_type %}
Expand All @@ -131,7 +133,15 @@
{% if recursive %}
{{ self::render_parent_type(page=parentSection) }}
{% endif %}
<a href="{{parentSection.permalink | safe}}" class="code-title">{{parentSection.title}}</a>

{% set class = "" %}
{% set firstChar = parentSection.title | split(pat="") | nth(n = 1) -%}
{% if firstChar == "/" -%}
{% set class = "code-title type" %}
{% endif %}

<a href="{{parentSection.permalink | safe}}" class="{{class}}">{{parentSection.title}}</a>
<i class="fa-solid fa-arrow-left"></i>
{%- endif -%}
{%- endmacro render_page_parent_type %}

Expand All @@ -140,7 +150,7 @@
{% if firstChar == "/" -%}
{% set lookup = "objects" ~ type ~ "/_index.md" -%}
{% set url = get_section(path=lookup) -%}
<a href="{{ url.permalink | safe}}" class="code-title">{{url.title}}</a>
<a href="{{ url.permalink | safe}}" class="code-title type">{{url.title}}</a>
{%- else -%}
{{type}}
{%- endif %}
Expand Down Expand Up @@ -211,7 +221,7 @@ <h3 class="text-xl">Inherited Procs:</h3>
<div class="flex flex-col">
{% endif %}
{% for newVar in possibleVarPage.pages %}
<div><a href="{{newVar.permalink | safe}}">/var/{{ newVar.title }}</a></div>
<div class="code-title"><a href="{{newVar.permalink | safe}}">/var/{{ newVar.title }}</a></div>
{% endfor %}
{% if possibleVarPage.pages | length > 0 %}
</div>
Expand Down Expand Up @@ -257,31 +267,32 @@ <h4>See also:</h4>
{% endif %}
{% endmacro render_backlinks %}

{% macro render_proc_title(page, list=false) %}
<h1 class="title text-3xl">
<div class="code-title">
{% if page.extra.override %}
{% set overrideText = "" %}
{% else %}
{% set overrideText = "/proc" %}
{% endif %}
{%- if not list -%}
{{- macros::render_page_parent_type(page=page, skip_level=1) -}}
{%- endif -%}
{%- if list -%}
<a href="{{page.permalink | safe}}">
{%- endif -%}
{{overrideText}}/{{ page.title }}
{%- if list -%}
</a>
{%- endif -%}
({{ macros::render_proc_args_short(page=page) }})
</div>
</h1>
{% endmacro render_proc_title %}

{% macro render_proc(page, list=false) %}
<div class="flex flex-col gap-5">

<h1 class="title text-3xl">
<div class="code-title">
{% if page.extra.override %}
{% set overrideText = "" %}
{% else %}
{% set overrideText = "/proc" %}
{% endif %}
{%- if not list -%}
{{- macros::render_page_parent_type(page=page, skip_level=1) -}}
{%- endif -%}
{%- if list -%}
<a href="{{page.permalink | safe}}">
{%- endif -%}
{{overrideText}}/{{ page.title }}
{%- if list -%}
</a>
{%- endif -%}
({{ macros::render_proc_args_short(page=page) }})
</div>

</h1>

<div>
{{ macros::render_proc_args_long(page=page) }}
</div>
Expand Down
10 changes: 6 additions & 4 deletions templates/page.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{% extends "base.html" %}
{% import "macros.html" as macros %}

{% block content %}

<div class="flex flex-col gap-5">

{% block header %}
<h1 class="title text-3xl">
{{ macros::render_page_parent_type(page=page, skip_level=0) }} | {{ page.title }}
</h1>
{% endblock header %}

{% block content %}

<div class="flex flex-col gap-5">

{{ page.content | safe }}

Expand Down
4 changes: 4 additions & 0 deletions templates/proc.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{% extends "base.html" %}
{% import "macros.html" as macros %}

{% block header %}
{{ macros::render_proc_title(page=page) }}
{% endblock header %}

{% block content %}

{{ macros::render_proc(page=page) }}
Expand Down
6 changes: 5 additions & 1 deletion templates/proc_list.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{% extends "base.html" %}
{% import "macros.html" as macros %}

{% block header %}
<h1 class="title text-3xl">{{ macros::render_page_parent_type(page=section, skip_level=0) }} {{ section.title }}</h1>
{% endblock heaer %}

{% block content %}

<div class="flex flex-col gap-5">
<h1 class="title text-3xl">{{ macros::render_page_parent_type(page=section, skip_level=0) }} {{ section.title }}</h1>

{% for page in section.pages %}
<div class="border border-white border-dashed p-5">
{{ macros::render_proc_title(page=page, list=true) }}
{{ macros::render_proc(page=page, list=true) }}
</div>
{% endfor %}
Expand Down
15 changes: 12 additions & 3 deletions templates/section.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
{% extends "base.html" %}
{% import "macros.html" as macros %}

{% block content %}
{% block header %}

<div class="flex flex-col gap-5">
{% set class = "" %}
{% set firstChar = section.title | split(pat="") | nth(n = 1) -%}
{% if firstChar == "/" -%}
{% set class = "code-title type" %}
{% endif %}

<h1 class="title text-3xl">
{{ macros::render_page_parent_type(page=section, skip_level=0) }} {{ section.title }}
{{ macros::render_page_parent_type(page=section, skip_level=0) }} <span class="{{class}}">{{ section.title }}</span>
</h1>
{% endblock header %}

{% block content %}

<div class="flex flex-col gap-5">

{{ section.content | safe }}

Expand Down
Loading

0 comments on commit d985699

Please sign in to comment.