Skip to content

Commit

Permalink
global procs
Browse files Browse the repository at this point in the history
  • Loading branch information
hry-gh committed May 28, 2024
1 parent 849b0d5 commit 39fdbdd
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 23 deletions.
9 changes: 9 additions & 0 deletions content/objects/_proc/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
+++
title = "proc"
template = "proc_list.html"
weight = 100

page_template = "proc.html"
+++

These procs are globally accessible, and can be called from anywhere in the code.
3 changes: 3 additions & 0 deletions content/objects/_proc/del.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
+++
title = "del"
+++
2 changes: 1 addition & 1 deletion content/objects/atom/proc/cross.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title = "Cross"

[extra]
return_val = "1 to allow movement, 0 to prevent movement"
return_val = ["1 to allow movement", "0 to prevent movement"]
args = [
{ name = "thing", type = "/atom/movable", description = "The object attempting to overlap." },
]
Expand Down
4 changes: 4 additions & 0 deletions styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ h6 {
}
}

.nav-link-inactive {
transition: background-color 0.2s;
}

.nav-link-inactive:hover {
background-color: #fdfeff23;
border-radius: 2px;
Expand Down
9 changes: 5 additions & 4 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/solid.min.css" integrity="sha512-Hp+WwK4QdKZk9/W0ViDvLunYjFrGJmNDt6sCflZNkjgvNq9mY+0tMbd6tWMiAlcf1OQyqL4gn2rYp7UsfssZPA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>

<body>
<div class="flex gap-10 px-3 safe-h-screen">

<body class="flex gap-10 px-3 safe-h-screen">
<div>
<div class="left-bar hidden md:block h-[100%]" id="left-bar">
<div class="flex flex-row">
<div class="flex flex-col justify-center">
Expand Down Expand Up @@ -87,8 +86,10 @@
{% block content %}{% endblock %}
</div>

<div class="pt-5">
<hr>
<div class="flex flex-row justify-center"><a class="text-gray-500" href="{{macros::get_github_link(page=pageOrSubsection)}}"><i class="fa-brands fa-github text-gray-500"></i> Improve this page</a></div>
<div class="flex flex-row justify-center pt-3"><a class="text-gray-500" href="{{macros::get_github_link(page=pageOrSubsection)}}"><i class="fa-brands fa-github text-gray-500"></i> Improve this page</a></div>
</div>

</div>
</div>
Expand Down
36 changes: 24 additions & 12 deletions templates/macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</span>
{%- if subsection.subsections -%}
<ul>
{%- for lowerSubPath in subsection.subsections | sort -%}
{%- for lowerSubPath in subsection.subsections | sort-%}
{% set lowerSubsection = get_section(path=lowerSubPath) %}
{{- self::render_subsection(currentPage = currentPage, subsection=lowerSubsection, depth=depth+1) -}}
{%- endfor -%}
Expand Down Expand Up @@ -175,12 +175,14 @@

{% macro render_proc_args_long(page) %}
{% if page.extra.args %}
<div>Args:</div>
<ul>
{% for arg in page.extra.args %}
<li class="pl-5">{{arg.name}} ({{ self::render_single_type(type=arg.type)}}): {{arg.description}}</li>
{% endfor %}
</ul>
<div class="border-l-2 border-gray-500 pl-3">
<div class="text-xl">Arguments:</div>
<ul>
{% for arg in page.extra.args %}
<li class="pl-5">{{arg.name}} ({{ self::render_single_type(type=arg.type)}}): {{arg.description}}</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endmacro render_proc_args_long %}

Expand Down Expand Up @@ -307,13 +309,23 @@ <h1 class="title text-3xl">
{% macro render_proc(page, list=false) %}
<div class="flex flex-col gap-5">

<div>
{{ macros::render_proc_args_long(page=page) }}
</div>

<div>
Returns:
<div class="pl-5">{{page.extra.return_val | default(value="null") | safe }}</div>
<div class="border-l-2 border-gray-500 pl-3">
<div class="text-xl">Returns:</div>
<div class="pl-5">
{%- if page.extra.return_val and page.extra.return_val is iterable -%}
<div class="flex flex-col">
{%- for option in page.extra.return_val -%}
<div>{{- option -}}</div>
{%- endfor -%}
</div>
{%- elif page.extra.return_val is defined -%}
{{ page.extra.return_val }}
{%- else -%}
null
{%- endif -%}
</div>
</div>

{{ 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 ogtitle %}
<meta property="og:title" content="{{page.title}} ({{ macros::render_page_parent_type(page=page, skip_level=1, recursive=false) | striptags | trim | safe }} proc)" />
{% endblock ogtitle %}

{% block header %}
{{ macros::render_proc_title(page=page) }}
{% endblock header %}
Expand Down
16 changes: 10 additions & 6 deletions templates/proc_list.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
{% 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 header %}

{% block ogtitle %}
<meta property="og:title" content="{{ macros::render_page_parent_type(page=section, skip_level=0, recursive=false) | striptags | trim | safe }} {{pageOrSubsection.title}}" />
{% endblock ogtitle %}

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

{% block content %}

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

{{ section.content | safe }}

{% for page in section.pages | sort(attribute="title") %}
<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 class="flex flex-col gap-3">
{{ macros::render_proc_title(page=page, list=true) }}
{{ macros::render_proc(page=page, list=true) }}
</div>
</div>
{% endfor %}

Expand Down
2 changes: 2 additions & 0 deletions templates/section.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ <h1 class="title text-3xl">

{{ macros::render_backlinks(page=section) }}

{{ section.subsections }}

{%- if not section.content | length -%}
<div class="border-l-2 border-yellow-600 pl-5">
<div class="text-xl">Work In Progress 👷</div>
Expand Down

0 comments on commit 39fdbdd

Please sign in to comment.