aboutsummaryrefslogtreecommitdiff
path: root/cmd/site/internal/front
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2020-07-16 15:32:30 -0400
committerGitHub <noreply@github.com>2020-07-16 15:32:30 -0400
commit385d25c9f96c0acd5d932488e3bd0ed36ceb4dd7 (patch)
treeaf789f7250519b23038a7e5ea0ae7f4f4c1ffdfc /cmd/site/internal/front
parent449e934246c82d90dd0aac2644d67f928befeeb4 (diff)
downloadxesite-385d25c9f96c0acd5d932488e3bd0ed36ceb4dd7.tar.xz
xesite-385d25c9f96c0acd5d932488e3bd0ed36ceb4dd7.zip
Rewrite site backend in Rust (#178)
* add shell.nix changes for Rust #176 * set up base crate layout * add first set of dependencies * start adding basic app modules * start html templates * serve index page * add contact and feeds pages * add resume rendering support * resume cleanups * get signalboost page working * rewrite config to be in dhall * more work * basic generic post loading * more tests * initial blog index support * fix routing? * render blogposts * X-Clacks-Overhead * split blog handlers into blog.rs * gallery index * gallery posts * fix hashtags * remove instantpage (it messes up the metrics) * talk support + prometheus * Create rust.yml * Update rust.yml * Update codeql-analysis.yml * add jsonfeed library * jsonfeed support * rss/atom * go mod tidy * atom: add posted date * rss: add publishing date * nix: build rust program * rip out go code * rip out go templates * prepare for serving in docker * create kubernetes deployment * create automagic deployment * build docker images on non-master * more fixes * fix timestamps * fix RSS/Atom/JSONFeed validation errors * add go vanity import redirecting * templates/header: remove this * atom feed: fixes * fix? * fix?? * fix rust tests * Update rust.yml * automatically show snow during the winter * fix dates * show commit link in footer * sitemap support * fix compiler warning * start basic patreon client * integrate kankyo * fix patreon client * add patrons page * remove this * handle patron errors better * fix build * clean up deploy * sort envvars for deploy * remove deps.nix * shell.nix: remove go * update README * fix envvars for tests * nice * blog: add rewrite in rust post * blog/site-update: more words
Diffstat (limited to 'cmd/site/internal/front')
-rw-r--r--cmd/site/internal/front/LICENSE19
-rw-r--r--cmd/site/internal/front/front.go24
-rw-r--r--cmd/site/internal/front/front_test.go42
3 files changed, 0 insertions, 85 deletions
diff --git a/cmd/site/internal/front/LICENSE b/cmd/site/internal/front/LICENSE
deleted file mode 100644
index e8152bb..0000000
--- a/cmd/site/internal/front/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2017 TJ Holowaychuk <tj@vision-media.ca>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. \ No newline at end of file
diff --git a/cmd/site/internal/front/front.go b/cmd/site/internal/front/front.go
deleted file mode 100644
index b2c7f0e..0000000
--- a/cmd/site/internal/front/front.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// Package front provides YAML frontmatter unmarshalling.
-package front
-
-import (
- "bytes"
-
- "gopkg.in/yaml.v2"
-)
-
-// Delimiter.
-var delim = []byte("---")
-
-// Unmarshal parses YAML frontmatter and returns the content. When no
-// frontmatter delimiters are present the original content is returned.
-func Unmarshal(b []byte, v interface{}) (content []byte, err error) {
- if !bytes.HasPrefix(b, delim) {
- return b, nil
- }
-
- parts := bytes.SplitN(b, delim, 3)
- content = parts[2]
- err = yaml.Unmarshal(parts[1], v)
- return
-}
diff --git a/cmd/site/internal/front/front_test.go b/cmd/site/internal/front/front_test.go
deleted file mode 100644
index bdc56d1..0000000
--- a/cmd/site/internal/front/front_test.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package front_test
-
-import (
- "fmt"
- "log"
-
- "christine.website/cmd/site/internal/front"
-)
-
-var markdown = []byte(`---
-title: Ferrets
-authors:
- - Tobi
- - Loki
- - Jane
----
-Some content here, so
-interesting, you just
-want to keep reading.`)
-
-type article struct {
- Title string
- Authors []string
-}
-
-func Example() {
- var a article
-
- content, err := front.Unmarshal(markdown, &a)
- if err != nil {
- log.Fatalf("error unmarshalling: %s", err)
- }
-
- fmt.Printf("%#v\n", a)
- fmt.Printf("%s\n", string(content))
- // Output:
- // front_test.article{Title:"Ferrets", Authors:[]string{"Tobi", "Loki", "Jane"}}
- //
- // Some content here, so
- // interesting, you just
- // want to keep reading.
-}