diff options
-rw-r--r-- | LICENSE | 121 | ||||
-rwxr-xr-x | build.py | 77 | ||||
-rw-r--r-- | posts/a.md | 8 | ||||
-rw-r--r-- | posts/hello-world.md | 6 | ||||
-rw-r--r-- | public/a/index.html | 28 | ||||
-rw-r--r-- | public/a/style.css | 35 | ||||
-rw-r--r-- | public/hello-world/index.html | 27 | ||||
-rw-r--r-- | public/hello-world/style.css | 35 | ||||
-rw-r--r-- | public/index.html | 44 | ||||
-rw-r--r-- | public/style.css | 35 | ||||
-rwxr-xr-x | publicize.sh | 3 | ||||
-rw-r--r-- | templates/footer.html | 9 | ||||
-rw-r--r-- | templates/header.html | 8 | ||||
-rw-r--r-- | templates/index.html | 25 | ||||
-rw-r--r-- | templates/post.html | 11 | ||||
-rw-r--r-- | templates/style.css | 35 |
16 files changed, 507 insertions, 0 deletions
@@ -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 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> + <title>why not</title> + <link rel="stylesheet" href="style.css"> +</head> +<body> + +<h1> +<a href=http://blaise.zone>blaise</a>/<a href=../>blog</a>/why not +</h1> + +<hr> + +<h2>Header:</h2> +<p><em>Markdown content</em></p> +<p>a</p> + +<hr> + +<ul class="horizontal"> + <li>built 2020-04-11 15:56:23</li> + <li><a href="https://creativecommons.org/publicdomain/zero/1.0/">CC0</a>: no copyright</li> +</ul> + +</body> +</html>
\ 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 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> + <title>Hello world!</title> + <link rel="stylesheet" href="style.css"> +</head> +<body> + +<h1> +<a href=http://blaise.zone>blaise</a>/<a href=../>blog</a>/Hello world! +</h1> + +<hr> + +<h2>Header:</h2> +<p><em>Markdown content</em></p> + +<hr> + +<ul class="horizontal"> + <li>built 2020-04-11 15:56:23</li> + <li><a href="https://creativecommons.org/publicdomain/zero/1.0/">CC0</a>: no copyright</li> +</ul> + +</body> +</html>
\ 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 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> + <title>blog</title> + <link rel="stylesheet" href="style.css"> +</head> +<body> + +<h1> +<a href=http://blaise.zone>blaise</a>/blog +</h1> + +<hr> + +<p> +Welcome to my personal blog! <br> +This page lists my blog entries in reverse chronological order. <br> +You may also browse by tag (coming soon). <br> +You may be interested in my meta post (coming soon). <br> +Thanks for stopping by! —Blaise +</p> + +<p> + + 2020-04-11 + <a href=./hello-world>Hello world!</a> + <br> + + 2020-04-10 + <a href=./a>why not</a> + <br> + +</p> + +<hr> + +<ul class="horizontal"> + <li>built 2020-04-11 15:56:23</li> + <li><a href="https://creativecommons.org/publicdomain/zero/1.0/">CC0</a>: no copyright</li> +</ul> + +</body> +</html>
\ 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 @@ +<hr> + +<ul class="horizontal"> + <li>built {{ date }}</li> + <li><a href="https://creativecommons.org/publicdomain/zero/1.0/">CC0</a>: no copyright</li> +</ul> + +</body> +</html> 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 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> + <title>{{ title }}</title> + <link rel="stylesheet" href="style.css"> +</head> +<body> 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" %} + +<h1> +<a href=http://blaise.zone>blaise</a>/blog +</h1> + +<hr> + +<p> +Welcome to my personal blog! <br> +This page lists my blog entries in reverse chronological order. <br> +You may also browse by tag (coming soon). <br> +You may be interested in my meta post (coming soon). <br> +Thanks for stopping by! —Blaise +</p> + +<p> +{% for post in posts %} + {{ post.date }} + <a href=./{{ post.path }}>{{ post.title }}</a> + <br> +{% endfor %} +</p> + +{% 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" %} + +<h1> +<a href=http://blaise.zone>blaise</a>/<a href=../>blog</a>/{{ post.title }} +</h1> + +<hr> + +{{ 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; +} |