diff --git a/example-site/pages.json b/example-site/pages.json new file mode 100644 index 0000000..94ae40d --- /dev/null +++ b/example-site/pages.json @@ -0,0 +1,9 @@ +{ + "pages": [ + { + "file_path": "about.md", + "title": "About This Site", + "url": "/about/" + } + ] +} \ No newline at end of file diff --git a/example-site/pages/about.md b/example-site/pages/about.md new file mode 100644 index 0000000..3225372 --- /dev/null +++ b/example-site/pages/about.md @@ -0,0 +1,3 @@ +This is the so-called "about" page. Probably you'd write something to describe what this site is. I guess? + +However, here you will only find a bunch of words to fill up space. \ No newline at end of file diff --git a/example-site/posts.json b/example-site/posts.json new file mode 100644 index 0000000..6551497 --- /dev/null +++ b/example-site/posts.json @@ -0,0 +1,44 @@ +{ + "posts": [ + { + "file_path": "2023-01-01-hello-world.md", + "title": "Hello, world!", + "date": "2023-01-01", + "slug": "hello-world", + "tags": ["aaa", "hello", "testing"] + }, + { + "file_path": "2023-02-01-commonmark-testing.md", + "title": "CommonMark Testing", + "date": "2023-02-01", + "slug": "commonmark-testing", + "tags": ["testing"] + }, + { + "file_path": "2023-03-20-lorem-ipsum.md", + "title": "Lorem Ipsum", + "date": "2023-03-20", + "slug": "lorem-ipsum" + }, + { + "file_path": "2023-04-15-static-site-generators-are-boring.md", + "title": "Static Site Generators Are Boring", + "date": "2023-04-15", + "slug": "static-site-generators-are-boring", + "tags": ["aaa", "rant"] + }, + { + "file_path": "2023-06-27-donuts-are-pretty-great.md", + "title": "Donuts Are Pretty Great", + "date": "2023-06-27", + "slug": "donuts-are-pretty-great", + "tags": ["aaa", "donuts", "coffee"] + } + ], + "rss": { + "title": "My Site", + "description": "This is my site. There are others like it, but this one is mine.", + "url": "http://localhost:8080/", + "count": 10 + } +} \ No newline at end of file diff --git a/example-site/posts/2023-01-01-hello-world.md b/example-site/posts/2023-01-01-hello-world.md new file mode 100644 index 0000000..0632ee9 --- /dev/null +++ b/example-site/posts/2023-01-01-hello-world.md @@ -0,0 +1,10 @@ +Hello, world! + +```c +#include + +int main(int argc, char *argv[]) { + printf("Hello, world!\n"); + return 0; +} +``` diff --git a/example-site/posts/2023-02-01-commonmark-testing.md b/example-site/posts/2023-02-01-commonmark-testing.md new file mode 100644 index 0000000..5078c22 --- /dev/null +++ b/example-site/posts/2023-02-01-commonmark-testing.md @@ -0,0 +1,158 @@ +Here we test some [CommonMark](https://commonmark.org/) things, gloriously rendered via the +[pulldown-cmark](https://github.com/raphlinus/pulldown-cmark) crate! + +--- + +This is a sentence rendered as a paragraph. + +This is a sentence that is also rendered as a paragraph, +but it has a forced line-break in the middle of it! + +This is normal text. + +_This is italicized text._ + +*This is also italicized text.* + +**This is bolded text.** + +__This is also bolded text.__ + +~~This is strikethrough text.~~ + +We can also **escape** characters to skip applying formatting like \_so_! + +# Heading Level 1 +## Heading Level 2 +### Heading Level 3 +#### Heading Level 4 +##### Heading Level 5 +###### Heading Level 6 + +Heading Level 1 Alternate +========================= + +Heading Level 2 Alternate +------------------------- + +> This is rendered as a block quote. + +Also ... + +> This is rendered as a multi-line block quote. +> This is in the same block quote. +> +> And finally, this is also in the same block quote! + +But wait, there's more! + +> Block quote again. +> > Nested block quote action! Wow! + +1. Number one +2. Number two +3. Number three + +- First +- Second +- And finally, third! + +1. One item which is multi-line. + This is the second line of the first item. +2. Here is item number two. +3. And item number three. + +* First item + * First item, first sub-item + * First item, second sub-item +* Second item +* Third item + +1. First item + 1. First item, first sub-item + 2. First item, second sub-item +2. Second item +3. Third item + +* More lists +* Because why not? +* It's getting a little tiresome ... +* So this will be the last one! + +Escaping to prevent accidental un-ordered list rendering ... + +\* Like so + +Task lists! + +- [ ] Task 1 +- [x] Task 2 (completed!) + +Here's some tables. To be honest, this syntax really sucks for anything but the very simplest of tables ... + +| foo | bar | longer column heading | +|-----|-----|-----------------------| +| yes | no | hi | +| 1 | 2 | 3 | + +| left | right | +|:-----|------:| +| a | b | +| one | two | + +| lazy | cell | formatting | +|------|------|------------| +| a | b | c | +| one | two | three | + +Here's a code block. + +``` +#include + +int main(int argc, char *argv[]) { + printf("Hello, world!\n"); + return 0; +} +``` + +Here's a code block with a language specified (which could be syntax highlighted if the right server-side parsing +was happening ...). + +```c +#include + +int main(int argc, char *argv[]) { + printf("Hello, world!\n"); + return 0; +} +``` + +Code blocks can also be indented like so: + + #include + + int main(int argc, char *argv[]) { + printf("Hello, world!\n"); + return 0; + } + + +Here's some inline `code` bits that will appear `inline` within this paragraph. + +
+We can also render html inline. +
+ +And we can place horizontal rules: + +--- + +And we can have images! + +![An image](/images/coffee_and_donuts.jpg) + +Images can also be links: + +[![An image](/images/coffee_and_donuts.jpg)](/images/coffee_and_donuts.jpg) + diff --git a/example-site/posts/2023-03-20-lorem-ipsum.md b/example-site/posts/2023-03-20-lorem-ipsum.md new file mode 100644 index 0000000..aaac92c --- /dev/null +++ b/example-site/posts/2023-03-20-lorem-ipsum.md @@ -0,0 +1,33 @@ +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna +aliqua. Vitae suscipit tellus mauris a. Ac turpis egestas maecenas pharetra convallis. Tincidunt dui ut ornare lectus +sit amet est placerat. Nibh ipsum consequat nisl vel pretium lectus quam id leo. Sit amet consectetur adipiscing elit. +Pretium viverra suspendisse potenti nullam ac tortor. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl +rhoncus. Etiam sit amet nisl purus in mollis nunc sed id. Mollis nunc sed id semper risus in. In hendrerit gravida +rutrum quisque non tellus orci. Justo laoreet sit amet cursus sit amet dictum. Egestas erat imperdiet sed euismod nisi +porta. + +Risus commodo viverra maecenas accumsan lacus. Gravida arcu ac tortor dignissim convallis aenean et. Ornare lectus sit +amet est placerat in egestas erat. Imperdiet nulla malesuada pellentesque elit eget. Porta lorem mollis aliquam ut. +Ornare arcu dui vivamus arcu felis. Urna id volutpat lacus laoreet non curabitur. Donec adipiscing tristique risus nec +feugiat in fermentum. Netus et malesuada fames ac turpis egestas. Enim nulla aliquet porttitor lacus luctus accumsan +tortor. + +Nulla pellentesque dignissim enim sit amet venenatis urna cursus. Nisi est sit amet facilisis magna etiam. Egestas dui +id ornare arcu odio ut. Fusce ut placerat orci nulla pellentesque dignissim enim sit. Nec feugiat in fermentum posuere +urna nec tincidunt praesent. Malesuada pellentesque elit eget gravida cum sociis natoque penatibus et. Duis at tellus +at urna condimentum. Enim ut tellus elementum sagittis vitae et. Semper eget duis at tellus at urna condimentum mattis. +Et molestie ac feugiat sed lectus vestibulum mattis ullamcorper velit. Vulputate eu scelerisque felis imperdiet proin +fermentum leo. Dolor sed viverra ipsum nunc. + +Vitae congue eu consequat ac felis. Fermentum dui faucibus in ornare quam viverra orci sagittis eu. Lobortis elementum +nibh tellus molestie nunc non. Libero justo laoreet sit amet cursus sit amet dictum. Aliquam id diam maecenas ultricies +mi. Dictum at tempor commodo ullamcorper a lacus. Sagittis purus sit amet volutpat consequat. Posuere morbi leo urna +molestie at elementum eu facilisis. Nibh praesent tristique magna sit amet purus gravida. Porta non pulvinar neque +laoreet. Vel elit scelerisque mauris pellentesque pulvinar pellentesque habitant morbi tristique. Tempor orci eu +lobortis elementum nibh tellus molestie. Nulla facilisi nullam vehicula ipsum. + +Tristique et egestas quis ipsum suspendisse. Sit amet massa vitae tortor condimentum lacinia quis vel. Eget nullam non +nisi est sit amet facilisis magna etiam. Donec pretium vulputate sapien nec sagittis aliquam. Scelerisque viverra +mauris in aliquam sem fringilla ut morbi tincidunt. Id aliquet lectus proin nibh nisl condimentum. Nulla facilisi +nullam vehicula ipsum a arcu cursus vitae congue. Convallis tellus id interdum velit laoreet id donec. Porttitor +rhoncus dolor purus non enim praesent elementum facilisis. Gravida neque convallis a cras semper auctor neque. diff --git a/example-site/posts/2023-04-15-static-site-generators-are-boring.md b/example-site/posts/2023-04-15-static-site-generators-are-boring.md new file mode 100644 index 0000000..3191459 --- /dev/null +++ b/example-site/posts/2023-04-15-static-site-generators-are-boring.md @@ -0,0 +1,11 @@ +It's true. + +Static site generators are boring. Sure, they can be used to generate all the files necessary for many types of +websites and then be uploaded somewhere and served up in an incredible efficient fashion. + +But they're boring. + +And there's so many of them out there. And I really can't be arsed to futz about with their endless configuration +options and templating and so forth. + +Bleh! \ No newline at end of file diff --git a/example-site/posts/2023-06-27-donuts-are-pretty-great.md b/example-site/posts/2023-06-27-donuts-are-pretty-great.md new file mode 100644 index 0000000..0424a9d --- /dev/null +++ b/example-site/posts/2023-06-27-donuts-are-pretty-great.md @@ -0,0 +1,8 @@ +Donuts are pretty great. Even better when you have more than one. Especially so when you have sprinkles on some or all +of them. And this all becomes _significantly better_ when paired up with coffee. Which should always be just black, +because why would anyone want to do something gross like dunk extra sugar, milk or cream into your coffee? What a +horrible thing to do ... + +![](/images/coffee_and_donuts.jpg) + +Have a coffee and donut today! 🍩 ☕ \ No newline at end of file diff --git a/example-site/server.json b/example-site/server.json new file mode 100644 index 0000000..e2599ab --- /dev/null +++ b/example-site/server.json @@ -0,0 +1,8 @@ +{ + "bind_addr": "127.0.0.1", + "bind_port": 8080, + "static_files_path": "static", + "templates_path": "templates", + "pages_path": "pages", + "posts_path": "posts" +} \ No newline at end of file diff --git a/example-site/static/favicon.ico b/example-site/static/favicon.ico new file mode 100644 index 0000000..003bee5 Binary files /dev/null and b/example-site/static/favicon.ico differ diff --git a/example-site/static/images/coffee_and_donuts.jpg b/example-site/static/images/coffee_and_donuts.jpg new file mode 100644 index 0000000..1980620 Binary files /dev/null and b/example-site/static/images/coffee_and_donuts.jpg differ diff --git a/example-site/static/site.css b/example-site/static/site.css new file mode 100644 index 0000000..cf0fac0 --- /dev/null +++ b/example-site/static/site.css @@ -0,0 +1,45 @@ +body { + font-family: sans-serif; +} + +main { + padding-bottom: 1em; +} + +footer { + color: #777777; + font-style: italic; +} + +.meta { + font-style: italic; +} + +.tags > span { + margin: auto 2px; + padding: 1px; + background-color: #eeeeee; +} + +.tags > span > a { + color: #555555; +} + +.tags > span > a:visited { + color: #888888; +} + +blockquote { + padding: 3px; + background-color: #dddddd; + border-left: 5px solid #888888; +} + +table { + border-collapse: collapse; + margin-bottom: 1em; +} + +table td, table th { + border: 1px solid #dddddd; +} \ No newline at end of file diff --git a/example-site/templates/archive.html b/example-site/templates/archive.html new file mode 100644 index 0000000..29d98c1 --- /dev/null +++ b/example-site/templates/archive.html @@ -0,0 +1,23 @@ +{% extends "base.html" %} +{% block title %}Posts Archive{% endblock title %} +{% block content %} +
+

Posts Archive

+
+ + + {% for post in posts %} + + + + + {% endfor %} +
+ {{ post.title }} + + {%- for tag in post.tags -%} + {{ tag }} + {%- endfor -%} + +
+{% endblock content %} \ No newline at end of file diff --git a/example-site/templates/base.html b/example-site/templates/base.html new file mode 100644 index 0000000..481b950 --- /dev/null +++ b/example-site/templates/base.html @@ -0,0 +1,33 @@ + + + + + My Site :: {% block title %}{% endblock title %} + + + + + + + + +
+
+

My Site

+ +
+
+ {% block content %}{% endblock content %} +
+
+ © {{ now() | date(format="%Y") }} - My Site, by Me +
+
+ + + + \ No newline at end of file diff --git a/example-site/templates/page.html b/example-site/templates/page.html new file mode 100644 index 0000000..4b6eaf5 --- /dev/null +++ b/example-site/templates/page.html @@ -0,0 +1,5 @@ +{% extends "base.html" %} +{% block title %}{{ page.title }}{% endblock title %} +{% block content %} +{% include "partials/page.html" %} +{% endblock content %} \ No newline at end of file diff --git a/example-site/templates/partials/page.html b/example-site/templates/partials/page.html new file mode 100644 index 0000000..f318198 --- /dev/null +++ b/example-site/templates/partials/page.html @@ -0,0 +1,6 @@ +
+

{{ page.title }}

+
+ {{ page.content_html | safe }} +
+
\ No newline at end of file diff --git a/example-site/templates/partials/post.html b/example-site/templates/partials/post.html new file mode 100644 index 0000000..251bf17 --- /dev/null +++ b/example-site/templates/partials/post.html @@ -0,0 +1,16 @@ +
+
+

{{ post.title }}

+
+ {{ post.date }} — + + {%- for tag in post.tags -%} + {{ tag }} + {%- endfor -%} + +
+
+
+ {{ post.content_html | safe }} +
+
\ No newline at end of file diff --git a/example-site/templates/post.html b/example-site/templates/post.html new file mode 100644 index 0000000..1d41653 --- /dev/null +++ b/example-site/templates/post.html @@ -0,0 +1,5 @@ +{% extends "base.html" %} +{% block title %}{{ post.title }}{% endblock title %} +{% block content %} +{% include "partials/post.html" %} +{% endblock content %} \ No newline at end of file diff --git a/example-site/templates/tag.html b/example-site/templates/tag.html new file mode 100644 index 0000000..dbcbe0a --- /dev/null +++ b/example-site/templates/tag.html @@ -0,0 +1,16 @@ +{% extends "base.html" %} +{% block title %}Posts With Tag {{ tag }}{% endblock title %} +{% block content %} +
+

Posts With Tag "{{ tag }}"

+
+ + + {% for post in posts %} + + + + + {% endfor %} +
{{ post.title }}
+{% endblock content %} \ No newline at end of file