From 89c2d37f16163ce85077c506ffc07317e37b0cde Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sun, 1 Dec 2019 16:02:32 -0800 Subject: [PATCH] Start migrating layout and root files to the new generator --- public/_layout.ejs | 152 ------------------ templates/misc-DELETE-ME.html | 34 ++++ templates/post-link.html | 14 ++ templates/post-text.html | 13 ++ .../index.ejs => templates/recent-posts.html | 5 +- templates/samhuri.net.html | 95 +++++++++++ templates/site.html | 2 + 7 files changed, 162 insertions(+), 153 deletions(-) delete mode 100644 public/_layout.ejs create mode 100644 templates/misc-DELETE-ME.html create mode 100644 templates/post-link.html create mode 100644 templates/post-text.html rename public/index.ejs => templates/recent-posts.html (91%) create mode 100644 templates/samhuri.net.html create mode 100644 templates/site.html diff --git a/public/_layout.ejs b/public/_layout.ejs deleted file mode 100644 index 925a75c..0000000 --- a/public/_layout.ejs +++ /dev/null @@ -1,152 +0,0 @@ - - - - -<% allScripts = [] -%> -<% allStyles = [] -%> -<% var ctx = public -%> -<% var n = current.path.length -%> -<% for (var i in current.path) { -%> -<% var path = current.path[i] -%> -<% if (ctx._data) { -%> -<% if (ctx._data.scripts || ctx._data._scripts) { -%> -<% allScripts = allScripts.concat(ctx._data.scripts || ctx._data._scripts) -%> -<% } -%> -<% if (ctx._data.styles || ctx._data._styles) { -%> -<% allStyles = allStyles.concat(ctx._data.styles || ctx._data._styles) -%> -<% } -%> -<% if (ctx._data[path] && ctx._data[path].scripts) { -%> -<% allScripts = allScripts.concat(ctx._data[path].scripts) -%> -<% } -%> -<% if (ctx._data[path] && ctx._data[path].styles) { -%> -<% allStyles = allStyles.concat(ctx._data[path].styles) -%> -<% } -%> -<% } -%> -<% ctx = ctx[path] -%> -<% } -%> - - - - -<% if (typeof title != 'undefined') { -%> - <%= site %>: <%= title %> -<% } else { -%> - <%= site %> -<% } -%> - - - - - - - - - -<% for (var i in allStyles) { -%> - -<% } -%> - - - - - - - - - - - - - - -<% var bodyClasses = current.path -%> - -
- - - - -
-
- - <% if (typeof link != 'undefined' && link !== null) { -%> -
-
-

→ <%= title %>

- - -
- <%- yield %> -
-
-

-
- <% } else if (typeof date != 'undefined' && date !== null) { -%> -
-
-

<%= title %>

- -
- <%- yield %> -
-
-

-
- <% } else if (typeof title != 'undefined' && title !== null) { -%> -
-

<%= title %>

- <%- yield %> -
-
-

-
- <% } else { -%> - <%- yield %> - <% } -%> - - - - - -<% for (var i in allScripts) { -%> - -<% } -%> - - diff --git a/templates/misc-DELETE-ME.html b/templates/misc-DELETE-ME.html new file mode 100644 index 0000000..22edc8b --- /dev/null +++ b/templates/misc-DELETE-ME.html @@ -0,0 +1,34 @@ +HANDLED {% if post.link %} -%> +
+
+

→ <%= post.title %>

+ + +
+ <%- yield %> +
+
+

+
+HANDLED <% } else if (typeof date != 'undefined' && date !== null) { -%> +
+
+

<%= title %>

+ +
+ <%- yield %> +
+
+

+
+WTF IS THIS?? <% } else if (typeof title != 'undefined' && title !== null) { -%> +
+

<%= title %>

+ <%- yield %> +
+
+

+
+HANDLED <% } else { -%> + <%- yield %> + <% } -%> diff --git a/templates/post-link.html b/templates/post-link.html new file mode 100644 index 0000000..38f3b3b --- /dev/null +++ b/templates/post-link.html @@ -0,0 +1,14 @@ +{% extends "samhuri.net.html" %} +{% block body %} +
+
+

→ {{ post.title }}

+ + +
+ {{ post.body }} +
+
+

+
+{% endblock %} diff --git a/templates/post-text.html b/templates/post-text.html new file mode 100644 index 0000000..d86f372 --- /dev/null +++ b/templates/post-text.html @@ -0,0 +1,13 @@ +{% extends "samhuri.net.html" %} +{% block body %} +
+
+

{{ post.title }}

+ +
+ {{ post.body }} +
+
+

+
+{% endblock %} diff --git a/public/index.ejs b/templates/recent-posts.html similarity index 91% rename from public/index.ejs rename to templates/recent-posts.html index 9005623..4afc17d 100644 --- a/public/index.ejs +++ b/templates/recent-posts.html @@ -1,3 +1,5 @@ +{% extends "samhuri.net.html" %} +{% block body %}
<% var posts = public._data.posts -%> <% for (var i in posts) { -%> @@ -32,4 +34,5 @@
<% } -%> - \ No newline at end of file + +{% endblock %} diff --git a/templates/samhuri.net.html b/templates/samhuri.net.html new file mode 100644 index 0000000..823d174 --- /dev/null +++ b/templates/samhuri.net.html @@ -0,0 +1,95 @@ + + + + + + + +{% if post %} + {{ site.title }}: {{ post.title }} +{% else %} + {{ site.title }} +{% endif %} + + + + + + + + + +{% for style in styles %} + +{% endfor %} + + + + + + + + + + + + + + + +
+ + + + +
+
+ + {% block body %}footage not found{% endblock %} + + + + + +{% for script in scripts %} + +{% endfor %} + + diff --git a/templates/site.html b/templates/site.html new file mode 100644 index 0000000..e9528fd --- /dev/null +++ b/templates/site.html @@ -0,0 +1,2 @@ +{% extends "samhuri.net.html" %} +{% block body %}{{ body }}{% endblock %}