From 2ae6d4c5a42d093a10feb8eaa0cb3bbb088c5bd3 Mon Sep 17 00:00:00 2001 From: Zack Rauen Date: Wed, 27 Sep 2023 16:20:04 -0400 Subject: [PATCH] Add initial templates --- src/templates/page.ejs | 132 ++++++++++++++++++++++++++++++++++++ src/templates/tree_item.ejs | 25 +++++++ 2 files changed, 157 insertions(+) create mode 100644 src/templates/page.ejs create mode 100644 src/templates/tree_item.ejs diff --git a/src/templates/page.ejs b/src/templates/page.ejs new file mode 100644 index 000000000..5abba1535 --- /dev/null +++ b/src/templates/page.ejs @@ -0,0 +1,132 @@ + + + + + <% if (note.hasLabel("shareDescription")) { %> + "> + <% } %> + + + <% if (note.hasRelation("shareFavicon")) { %> + /download"> + <% } else { %> + + <% } %> + + <% if (!note.hasLabel("shareOmitDefaultCss")) { %> + + + <% } %> + <% if (note.hasLabel("shareSwagger")) { %> + + + + <% } %> + <% if (note.type === 'text' || note.type === 'book') { %> + + <% } %> + <% for (const cssRelation of note.getRelations("shareCss")) { %> + + <% } %> + <% for (const jsRelation of note.getRelations("shareJs")) { %> + + <% } %> + <% if (note.hasLabel('shareDisallowRobotIndexing')) { %> + + <% } %> + <%- header %> + <%= note.title %><% if (note.noteId !== subRoot.noteId) { %> - <%= subRoot.title %><% } %> + +<% +const currentTheme = note.getLabel("shareTheme") === "light" ? "light" : "dark"; +const themeClass = currentTheme === "light" ? " theme-light" : " theme-dark"; +%> + +
+ + <% if (subRoot.hasRelation("shareLogo")) { %> + /download" alt="Logo" /> + <% } %> + <%= subRoot.title %> + + +
+
+
+ +
+
+
+ + + <% if (note.hasLabel("pageUrl")) { %> +
This note was originally clipped from "><%= note.getLabelValue("pageUrl") %>
+ <% } %> + + <% if (!isEmpty) { %> +
+

<%= note.title %>

+ <%- content %> +
+ <% } %> + + <% if (note.hasVisibleChildren()) { %> + + <% } else if (isEmpty) { %> +
+

<%= note.title %>

+

This note has no content.

+
+ <% } %> +
+
+
+ + diff --git a/src/templates/tree_item.ejs b/src/templates/tree_item.ejs new file mode 100644 index 000000000..dd50a108a --- /dev/null +++ b/src/templates/tree_item.ejs @@ -0,0 +1,25 @@ +<% +const linkClass = `type-${note.type}` + (activeNote.noteId === note.noteId ? " active" : ""); +const isExternalLink = note.hasLabel("shareExternal"); +const linkHref = isExternalLink ? note.getLabelValue("shareExternal") : `./${note.shareId}`; +const target = isExternalLink ? ` target="_blank" rel="noopener noreferrer"` : ""; +%> + + <% if (note.noteId !== subRoot.noteId) { %> +> + <% if (note.hasVisibleChildren()) { %><% } %> + <%= note.title %> + +<% } %> + + +<% if (note.hasVisibleChildren()) { %> + +<% } %>