From 5e2a82641aab330f9a94a74b5fa4386dd684d7f1 Mon Sep 17 00:00:00 2001 From: Blaise Thompson Date: Sat, 11 Apr 2020 18:59:35 -0500 Subject: initial commit --- LICENSE | 121 ++++++++++++++++++++++++++++++++++++++++++ build.py | 77 +++++++++++++++++++++++++++ posts/a.md | 8 +++ posts/hello-world.md | 6 +++ public/a/index.html | 28 ++++++++++ public/a/style.css | 35 ++++++++++++ public/hello-world/index.html | 27 ++++++++++ public/hello-world/style.css | 35 ++++++++++++ public/index.html | 44 +++++++++++++++ public/style.css | 35 ++++++++++++ publicize.sh | 3 ++ templates/footer.html | 9 ++++ templates/header.html | 8 +++ templates/index.html | 25 +++++++++ templates/post.html | 11 ++++ templates/style.css | 35 ++++++++++++ 16 files changed, 507 insertions(+) create mode 100644 LICENSE create mode 100755 build.py create mode 100644 posts/a.md create mode 100644 posts/hello-world.md create mode 100644 public/a/index.html create mode 100644 public/a/style.css create mode 100644 public/hello-world/index.html create mode 100644 public/hello-world/style.css create mode 100644 public/index.html create mode 100644 public/style.css create mode 100755 publicize.sh create mode 100644 templates/footer.html create mode 100644 templates/header.html create mode 100644 templates/index.html create mode 100644 templates/post.html create mode 100644 templates/style.css diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0e259d4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/build.py b/build.py new file mode 100755 index 0000000..6afa673 --- /dev/null +++ b/build.py @@ -0,0 +1,77 @@ +import os +from pprint import pprint +import jinja2 +import markdown +import pathlib +from datetime import datetime +from dataclasses import dataclass + + +__here__ = pathlib.Path(__file__).resolve().parent + + +date = datetime.now().strftime('%Y-%m-%d %H:%M:%S') + + +md = markdown.Markdown(extensions=['meta']) + + +env = jinja2.Environment(loader = jinja2.FileSystemLoader(str(__here__ / "templates"))) + + +# grab posts -------------------------------------------------------------------------------------- + + +@dataclass +class Post: + title: str + date: str + content: str + path: str + + +posts = [] +for post in os.listdir(__here__ / "posts"): + with open(__here__ / "posts" / post, "r") as f: + content = md.convert(f.read()) + kwargs = dict() + kwargs["title"] = md.Meta["title"][0] + kwargs["date"] = md.Meta["date"][0] + kwargs["content"] = content + kwargs["path"] = post[:-3] + print(kwargs) + posts.append(Post(**kwargs)) + +posts.sort(key=lambda p: p.date, reverse=True) + + +# index ------------------------------------------------------------------------------------------- + + +if not os.path.isdir(__here__ / "public"): + os.mkdir(__here__ / "public") + + +template = env.get_template("index.html") +with open(__here__ / "public" / "index.html", "w") as f: + f.write(template.render(posts=posts, title="blog", date=date)) + + +# posts ------------------------------------------------------------------------------------------- + + +template = env.get_template("post.html") +for post in posts: + if not os.path.isdir(__here__ / "public" / post.path): + os.mkdir(__here__ / "public" / post.path) + with open(__here__ / "public" / post.path / "index.html", "w") as f: + f.write(template.render(post=post, title=post.title, date=date)) + + +# css --------------------------------------------------------------------------------------------- + + +template = env.get_template('style.css') +for d, _, _ in os.walk(__here__ / "public", topdown=False): + with open(os.path.join(d, "style.css"), 'w') as fh: + fh.write(template.render()) diff --git a/posts/a.md b/posts/a.md new file mode 100644 index 0000000..c18feb5 --- /dev/null +++ b/posts/a.md @@ -0,0 +1,8 @@ +title: why not +date: 2020-04-10 + +Header: +------- +*Markdown content* + +a diff --git a/posts/hello-world.md b/posts/hello-world.md new file mode 100644 index 0000000..b419d8d --- /dev/null +++ b/posts/hello-world.md @@ -0,0 +1,6 @@ +title: Hello world! +date: 2020-04-11 + +Header: +------- +*Markdown content* diff --git a/public/a/index.html b/public/a/index.html new file mode 100644 index 0000000..b7d65ac --- /dev/null +++ b/public/a/index.html @@ -0,0 +1,28 @@ + + + + + why not + + + + +

+blaise/blog/why not +

+ +
+ +

Header:

+

Markdown content

+

a

+ +
+ + + + + \ No newline at end of file diff --git a/public/a/style.css b/public/a/style.css new file mode 100644 index 0000000..f1b4927 --- /dev/null +++ b/public/a/style.css @@ -0,0 +1,35 @@ +a { + text-decoration: none; + color: #81a2be; +} + +body { + font-family: sans-serif; + margin: 40px auto; + max-width: 650px; + line-height: 1.5; + font-size: 16px; + background-color: #1d1f21; + color: #c5c8c6; + padding: 0 10px; + text-align: left; +} + +.singlespaced { + line-height: 1; +} + +.horizontal { + display: flex; + list-style-type: none; + padding: 0; + justify-content: space-between; +} + +.tab30 { + margin-left: 30px; +} + +.tab60 { + margin-left: 60px; +} \ No newline at end of file diff --git a/public/hello-world/index.html b/public/hello-world/index.html new file mode 100644 index 0000000..40456d8 --- /dev/null +++ b/public/hello-world/index.html @@ -0,0 +1,27 @@ + + + + + Hello world! + + + + +

+blaise/blog/Hello world! +

+ +
+ +

Header:

+

Markdown content

+ +
+ + + + + \ No newline at end of file diff --git a/public/hello-world/style.css b/public/hello-world/style.css new file mode 100644 index 0000000..f1b4927 --- /dev/null +++ b/public/hello-world/style.css @@ -0,0 +1,35 @@ +a { + text-decoration: none; + color: #81a2be; +} + +body { + font-family: sans-serif; + margin: 40px auto; + max-width: 650px; + line-height: 1.5; + font-size: 16px; + background-color: #1d1f21; + color: #c5c8c6; + padding: 0 10px; + text-align: left; +} + +.singlespaced { + line-height: 1; +} + +.horizontal { + display: flex; + list-style-type: none; + padding: 0; + justify-content: space-between; +} + +.tab30 { + margin-left: 30px; +} + +.tab60 { + margin-left: 60px; +} \ No newline at end of file diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..337a173 --- /dev/null +++ b/public/index.html @@ -0,0 +1,44 @@ + + + + + blog + + + + +

+blaise/blog +

+ +
+ +

+Welcome to my personal blog!
+This page lists my blog entries in reverse chronological order.
+You may also browse by tag (coming soon).
+You may be interested in my meta post (coming soon).
+Thanks for stopping by! —Blaise +

+ +

+ + 2020-04-11 + Hello world! +
+ + 2020-04-10 + why not +
+ +

+ +
+ + + + + \ No newline at end of file diff --git a/public/style.css b/public/style.css new file mode 100644 index 0000000..f1b4927 --- /dev/null +++ b/public/style.css @@ -0,0 +1,35 @@ +a { + text-decoration: none; + color: #81a2be; +} + +body { + font-family: sans-serif; + margin: 40px auto; + max-width: 650px; + line-height: 1.5; + font-size: 16px; + background-color: #1d1f21; + color: #c5c8c6; + padding: 0 10px; + text-align: left; +} + +.singlespaced { + line-height: 1; +} + +.horizontal { + display: flex; + list-style-type: none; + padding: 0; + justify-content: space-between; +} + +.tab30 { + margin-left: 30px; +} + +.tab60 { + margin-left: 60px; +} \ No newline at end of file diff --git a/publicize.sh b/publicize.sh new file mode 100755 index 0000000..28b0f4c --- /dev/null +++ b/publicize.sh @@ -0,0 +1,3 @@ +python3 build.py +scp -r ./public/* root@blaise.zone:/var/www/brain.blaise.zone/html/ + diff --git a/templates/footer.html b/templates/footer.html new file mode 100644 index 0000000..7016b7a --- /dev/null +++ b/templates/footer.html @@ -0,0 +1,9 @@ +
+ + + + + diff --git a/templates/header.html b/templates/header.html new file mode 100644 index 0000000..e913fc1 --- /dev/null +++ b/templates/header.html @@ -0,0 +1,8 @@ + + + + + {{ title }} + + + diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..dbd6bd4 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,25 @@ +{% include "header.html" %} + +

+blaise/blog +

+ +
+ +

+Welcome to my personal blog!
+This page lists my blog entries in reverse chronological order.
+You may also browse by tag (coming soon).
+You may be interested in my meta post (coming soon).
+Thanks for stopping by! —Blaise +

+ +

+{% for post in posts %} + {{ post.date }} + {{ post.title }} +
+{% endfor %} +

+ +{% include "footer.html" %} diff --git a/templates/post.html b/templates/post.html new file mode 100644 index 0000000..563fbb1 --- /dev/null +++ b/templates/post.html @@ -0,0 +1,11 @@ +{% include "header.html" %} + +

+blaise/blog/{{ post.title }} +

+ +
+ +{{ post.content }} + +{% include "footer.html" %} diff --git a/templates/style.css b/templates/style.css new file mode 100644 index 0000000..4517798 --- /dev/null +++ b/templates/style.css @@ -0,0 +1,35 @@ +a { + text-decoration: none; + color: #81a2be; +} + +body { + font-family: sans-serif; + margin: 40px auto; + max-width: 650px; + line-height: 1.5; + font-size: 16px; + background-color: #1d1f21; + color: #c5c8c6; + padding: 0 10px; + text-align: left; +} + +.singlespaced { + line-height: 1; +} + +.horizontal { + display: flex; + list-style-type: none; + padding: 0; + justify-content: space-between; +} + +.tab30 { + margin-left: 30px; +} + +.tab60 { + margin-left: 60px; +} -- cgit v1.2.3