diff --git a/content/_index.md b/content/_index.md index 4d09c62..ec13f75 100644 --- a/content/_index.md +++ b/content/_index.md @@ -5,4 +5,7 @@ page_template = "post.html" insert_anchor_links = "right" sort_by = "date" + +[extra] +include_posts = true +++ diff --git a/content/enterprise/_index.md b/content/enterprise/_index.md new file mode 100644 index 0000000..3819527 --- /dev/null +++ b/content/enterprise/_index.md @@ -0,0 +1,6 @@ ++++ +template = "blog.html" + +[extra] +include_posts = true ++++ diff --git a/content/enterprise/prototype/index.md b/content/enterprise/prototype/index.md index 2e1094c..982fe38 100644 --- a/content/enterprise/prototype/index.md +++ b/content/enterprise/prototype/index.md @@ -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 diff --git a/content/pages/_index.md b/content/pages/_index.md index d629dd3..502fef7 100644 --- a/content/pages/_index.md +++ b/content/pages/_index.md @@ -3,4 +3,7 @@ title = "all pages" template = "listing.html" page_template = "post.html" insert_anchor_links = "right" + +[extra] +include_posts = false +++ diff --git a/templates/blog.html b/templates/blog.html index 061ca75..09810af 100644 --- a/templates/blog.html +++ b/templates/blog.html @@ -8,7 +8,7 @@ {% endblock %} {% block content %} - {{ blog::postlisting(posts=section.pages) }} + {{ blog::sectionlisting(section=section) }}

click here for RSS feed diff --git a/templates/macros/blog.html b/templates/macros/blog.html index 151c85b..66bcd69 100644 --- a/templates/macros/blog.html +++ b/templates/macros/blog.html @@ -1,25 +1,59 @@ -{% macro postlisting(posts) %} +{% macro sectionlisting(section) %} - {% for post in posts %} - {% if not post.draft %} - - - {% if post.tags %} - - {% endif %} - - {% endif %} - {% endfor %} + {{ self::postlist(section=section) }}
- - {{ post.title }} - -
- - {{ post.reading_time }} min read - Posted {% if post.extra.author %}by {{ post.extra.author }}{% endif %} - on {{ post.date }} - -
{% endmacro postlisting %} + +{% macro postlisting(posts) %} + + {% for post in posts %} + {{ self::display_post(post=post) }} + {% endfor %} +
+{% 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 %} + + + + {{ post.title }} + +
+ + {{ post.reading_time }} min read - Posted {% if post.extra.author %}by {{ post.extra.author }}{% endif %} + on {{ post.date }} + + + {% if post.tags %} + + {{ post.tags | join(sep=", ") }} + + {% endif %} + + {% endif %} +{% endmacro %}