cursed tera moments
This commit is contained in:
parent
a70ccbd4a5
commit
ef8f57ea54
6 changed files with 76 additions and 31 deletions
|
@ -5,4 +5,7 @@ page_template = "post.html"
|
|||
|
||||
insert_anchor_links = "right"
|
||||
sort_by = "date"
|
||||
|
||||
[extra]
|
||||
include_posts = true
|
||||
+++
|
||||
|
|
6
content/enterprise/_index.md
Normal file
6
content/enterprise/_index.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
+++
|
||||
template = "blog.html"
|
||||
|
||||
[extra]
|
||||
include_posts = true
|
||||
+++
|
|
@ -6,17 +6,15 @@ template = "post.html"
|
|||
|
||||
[taxonomies]
|
||||
tags = []
|
||||
|
||||
[extra]
|
||||
toc = true
|
||||
+++
|
||||
|
||||
This past weekend, while on my trip to Minneapolis, I completed a very early prototype of "enterprise", a new UI framework I've been kind of envisioning over the past couple of weeks. While the UI framework is mainly targeted at web apps, the hope is that with a bit more effort, native UIs can be produced with almost no changes to existing applications. Before I begin to describe how it works, I'd like to acknowledge [Nathan Ringo][1] for his massively helpful feedback in both the ideation and the implementation process.
|
||||
|
||||
## Goals of the project
|
||||
|
||||
* **Complete separation of business logic from UI.** Theoretically, one could completely retarget the application to a completely different platform (mobile, web, native, something new that will pop up in 5 years), without changing any of the core logic. As enterprise grows to include a backend, this should be true of the backend as well. It does this by introducing [DSL][2]s that are completely architecture-independent.
|
||||
* **Frontend relationships should be as static as possible.**
|
||||
* **Complete separation of business logic from UI.** Theoretically, one could completely retarget the application to a completely different platform (mobile, web, native, something new that will pop up in 5 years), without changing any of the core logic. It does this by introducing [DSL][2]s that are completely architecture-independent.
|
||||
* **Maximally static component relationships.** Like [Svelte][3], I'm aiming to resolve as many relationships between elements as possible during compile-time, to avoid having to maintain a full virtual DOM at runtime.
|
||||
*
|
||||
|
||||
## Prototype
|
||||
|
||||
|
@ -33,9 +31,7 @@ inputEl.addEventListener("change", () => {
|
|||
});
|
||||
```
|
||||
|
||||
Surely, this works, but it doesn't scale. If you try to write a page full of these kind of bindings directly using JavaScript, you're either going to start running into bugs or building up a pile of unmaintainable spaghetti code.
|
||||
|
||||
So how does enterprise represent this? Well, the enterprise DSL has no concrete syntax yet, but if it did, it would look something like this:
|
||||
Surely, this works, but it doesn't scale. If you try to write a page full of these kind of bindings directly using JavaScript, you're either going to start running into bugs or building up a pile of unmaintainable spaghetti code. How does enterprise represent this? Well, the enterprise DSL has no concrete syntax yet, but if it did, it would look something like this:
|
||||
|
||||
```
|
||||
model {
|
||||
|
@ -48,5 +44,8 @@ view {
|
|||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
[1]: https://remexre.xyz
|
||||
[2]: https://en.wikipedia.org/wiki/Domain-specific_language
|
||||
[3]: https://svelte.dev
|
||||
|
|
|
@ -3,4 +3,7 @@ title = "all pages"
|
|||
template = "listing.html"
|
||||
page_template = "post.html"
|
||||
insert_anchor_links = "right"
|
||||
|
||||
[extra]
|
||||
include_posts = false
|
||||
+++
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{{ blog::postlisting(posts=section.pages) }}
|
||||
{{ blog::sectionlisting(section=section) }}
|
||||
|
||||
<p style="text-align: center;">
|
||||
<small><a href="/rss.xml">click here for RSS feed</a></small>
|
||||
|
|
|
@ -1,6 +1,42 @@
|
|||
{% macro sectionlisting(section) %}
|
||||
<table style="width: 100%;">
|
||||
{{ self::postlist(section=section) }}
|
||||
</table>
|
||||
{% endmacro postlisting %}
|
||||
|
||||
{% macro postlisting(posts) %}
|
||||
<table style="width: 100%;">
|
||||
{% for post in posts %}
|
||||
{{ self::display_post(post=post) }}
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endmacro postlisting %}
|
||||
|
||||
{% macro postlist(section) %}
|
||||
{% set post_paths = self::recursive_visit(section=section) %}
|
||||
{% set_global posts = [] %}
|
||||
{% for path in post_paths | split(pat="&") %}
|
||||
{% set clean_path = path | trim %}
|
||||
{% if clean_path == "" %}{% continue %}{% endif %}
|
||||
{% set post = get_page(path=clean_path) %}
|
||||
{% set_global posts = posts | concat(with=post) %}
|
||||
{% endfor %}
|
||||
|
||||
{% for post in posts | sort(attribute="date") | reverse %}
|
||||
{{ self::display_post(post=post) }}
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro recursive_visit(section) %}
|
||||
{% if section.extra.include_posts == true %}
|
||||
{% for page in section.pages %}{{ page.relative_path }}&{% endfor %}
|
||||
{% for sub in section.subsections %}
|
||||
{{ self::recursive_visit(section=get_section(path=sub)) }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro display_post(post) %}
|
||||
{% if not post.draft %}
|
||||
<tr class="postlisting-row">
|
||||
<td>
|
||||
|
@ -20,6 +56,4 @@
|
|||
{% endif %}
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endmacro postlisting %}
|
||||
{% endmacro %}
|
||||
|
|
Loading…
Reference in a new issue