From f8e23d0ce84b5735d37365dda37318b0ddb46f2b Mon Sep 17 00:00:00 2001 From: mark Date: Thu, 4 May 2023 03:58:16 +0200 Subject: [PATCH] Added index.html for the github page. Built from site/index.html using site/build.mers as a preprocessor. --- index.html | 24 ++++++++++++++++++++++++ site/build.mers | 46 ++++++++++++++++++++++++++++++++++++++++++++++ site/external.css | 40 ++++++++++++++++++++++++++++++++++++++++ site/index.html | 28 ++++++++++++++++++++++++++++ site/welcome.mers | 4 ++++ 5 files changed, 142 insertions(+) create mode 100644 index.html create mode 100755 site/build.mers create mode 100644 site/external.css create mode 100644 site/index.html create mode 100644 site/welcome.mers diff --git a/index.html b/index.html new file mode 100644 index 0000000..17193bb --- /dev/null +++ b/index.html @@ -0,0 +1,24 @@ + + + + +Mark :: mers + + +

Mers

+
+
+mers gud?
+Second line.
+(yes this is a prototype) +
+
+ +#!/usr/bin/env mers
/* welcome to mers */
println("Hello, World!")
42 // return value

+
+
+ +
+
+ + diff --git a/site/build.mers b/site/build.mers new file mode 100755 index 0000000..3238fb6 --- /dev/null +++ b/site/build.mers @@ -0,0 +1,46 @@ +#!/usr/bin/env mers + +fn read_string(path string) { + bytes_to_string(fs_read(path).assume_no_enum()).assume_no_enum() +} + +index = read_string("index.html") + +welcome_script: []/string = [] +get_welcome_script = () { + script = welcome_script + switch! script { + string script + [] { + scr = "" + for line read_string("welcome.mers").regex(".*").assume_no_enum() { + scr = scr.add(line.add("
")) + } + welcome_script = scr + scr + } + } +} + +out = "" +for line index.regex("\\S*.*").assume_no_enum() { + if line.starts_with("#") { + // comment, ignore + } else if line.starts_with("$") { + if line.eq("$welcome_script") { + script = get_welcome_script.run() + out = out.add(script) + } + } else { + loop { + if line.starts_with(" ") { + line = line.substring(1) + } else { + true // break + } + } + out = out.add(line.add("\n")) + } +} + +fs_write("../index.html" string_to_bytes(out)).assume_no_enum() diff --git a/site/external.css b/site/external.css new file mode 100644 index 0000000..b0460a4 --- /dev/null +++ b/site/external.css @@ -0,0 +1,40 @@ +body { + color: MintCream; + background-color: DarkSlateBlue; + /* background-color: MidnightBlue; */ +} +h1 { + text-align: center; +} + +.mers-code-snippet { + text-align: left; +} + +.container_left { + margin-left: 9%; + width: 20%; + margin-right: 5%; + float: left; + display: inline-block; +} +.container_center { + margin-left: 0.5%; + width: 30%; + margin-right: 0.5%; + border-style: dotted; + display: inline-block; +} +.container_right { + margin-left: 5%; + width: 20%; + margin-right: 9%; + float: right; + display: inline-block; +} +.code-border { + border-style: double; +} +.textalign-center { + text-align: center; +} diff --git a/site/index.html b/site/index.html new file mode 100644 index 0000000..2f2a5c6 --- /dev/null +++ b/site/index.html @@ -0,0 +1,28 @@ + +# This document will be processed by build.mers. +# Lines starting with hashtags are comments and will be ignored. +# Lines starting with dollar-signs insert special text. +# To escape this, put a space before the hashtag or dollar sign. + + + + Mark :: mers + + +

Mers

+
+
+ mers gud?
+ Second line.
+ (yes this is a prototype) +
+
+ +$welcome_script + +
+
+ +
+
+ diff --git a/site/welcome.mers b/site/welcome.mers new file mode 100644 index 0000000..4907eac --- /dev/null +++ b/site/welcome.mers @@ -0,0 +1,4 @@ +#!/usr/bin/env mers +/* welcome to mers */ +println("Hello, World!") +42 // return value