Migrated to use my new html-generator tool!

master
lijerom 2018-05-05 13:49:13 -07:00
parent 200004aeaf
commit 7c1bd41fdd
22 changed files with 333 additions and 89 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*~
*.xhtml
*.xml

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "templates/html-generator"]
path = templates/html-generator
url = https://github.com/lijerom/html-generator

3
build-site-no-sitemap.sh Executable file
View File

@ -0,0 +1,3 @@
cd templates/
stack exec html-generator -- $(find .. -type f -name "*.hs" | grep -v "./templates")
cd ..

3
build-site.sh Executable file
View File

@ -0,0 +1,3 @@
cd templates/
stack exec html-generator -- --sitemap $(find .. -type f -name "*.hs" | grep -v "./templates")
cd ..

15
gow/index.hs Normal file
View File

@ -0,0 +1,15 @@
module Page where
import Templates
import HtmlGen.Sitemap
import HtmlGen.Html
sitemap :: Sitemap
sitemap = baseSitemap "https://lijero.co/gow/"
`withChangeFreq` "never"
`withPriority` "0.0"
`withLastMod` "2018-05-05"
page :: Html
page = redirectPage "The Grapes of Wrath (Audio) playlist" "https://www.youtube.com/playlist?list=PL0_-F4mPidOAXcnn9bBhaZ8byRyC4FyRyC4FpvC"

20
index.hs Normal file
View File

@ -0,0 +1,20 @@
module Page where
import Templates
import HtmlGen.Html
import HtmlGen.Tags
import HtmlGen.Sitemap
sitemap :: Sitemap
sitemap = baseSitemap "https://lijero.co/index.xhtml" `withLastMod` "2018-05-05"
page :: Html
page = simplePage "Lijero" "Lijero" "2018-05-05" $
article
%> (h1 %>> "Home Page")
%> (p %>> "Sorry! This site is currently under construction.")
%> (h2 %>> "Lorem Ipsum")
%> (p %>> "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")
%> (p %>> "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?")
%> (p %>> "At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.")

View File

@ -1,32 +0,0 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<!-- Uses Open Iconic: MIT licenses, attribution optional licenses. -->
<!-- This page is friendly to text browsers. -->
<head>
<meta charset="utf-8" />
<meta name="author" content="Lijero" />
<!-- <meta name="description" content="" /> -->
<meta name="keywords" content="Lijero,music,code,producer,games,website" />
<meta name="robots" content="index,follow" />
<title>Lijero</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="/favicon.png" rel="icon" type="image/png" />
<link href="/res/common.css" rel="stylesheet" type="text/css" />
</head>
<body>
<nav>
<span id="navbrand">Lijero</span>
</nav>
<article>
<header>
<h1>Home Page</h1>
</header>
<p>Sorry! This site is under construction.</p>
</article>
</body>
</html>

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Waybury
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.

3
res/icon/icon/clock.svg Normal file
View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8">
<path d="M4 0c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 1c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm-.5 1v2.22l.16.13.5.5.34.38.72-.72-.38-.34-.34-.34v-1.81h-1z" />
</svg>

After

Width:  |  Height:  |  Size: 272 B

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8">
<path d="M3 0c-1.65 0-3 1.35-3 3v3h3v-3h-2c0-1.11.89-2 2-2v-1zm5 0c-1.65 0-3 1.35-3 3v3h3v-3h-2c0-1.11.89-2 2-2v-1z" transform="translate(0 1)" />
</svg>

After

Width:  |  Height:  |  Size: 235 B

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8">
<path d="M0 0v3h2c0 1.11-.89 2-2 2v1c1.65 0 3-1.35 3-3v-3h-3zm5 0v3h2c0 1.11-.89 2-2 2v1c1.65 0 3-1.35 3-3v-3h-3z" transform="translate(0 1)" />
</svg>

After

Width:  |  Height:  |  Size: 233 B

3
res/icon/icon/person.svg Normal file
View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8">
<path d="M4 0c-1.1 0-2 1.12-2 2.5s.9 2.5 2 2.5 2-1.12 2-2.5-.9-2.5-2-2.5zm-2.09 5c-1.06.05-1.91.92-1.91 2v1h8v-1c0-1.08-.84-1.95-1.91-2-.54.61-1.28 1-2.09 1-.81 0-1.55-.39-2.09-1z" />
</svg>

After

Width:  |  Height:  |  Size: 272 B

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://lijero.co/</loc>
<lastmod>2017-10-03</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
</urlset>

View File

@ -1,48 +0,0 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<!-- Uses Open Iconic: MIT licenses, attribution optional licenses. -->
<!-- This page is friendly to text browsers. -->
<head>
<meta charset="utf-8" />
<meta name="author" content="Lijero" />
<!-- <meta name="description" content="" /> -->
<meta name="keywords" content="Lijero" />
<meta name="robots" content="index,follow" />
<title>Lijero</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="/favicon.png" rel="icon" type="image/png" />
<link href="/res/common.css" rel="stylesheet" type="text/css" />
</head>
<body>
<nav>
<div id="navbrand">Lijero</div>
<ul>
<li><a href="/">Home</a></li>
<li>Music</li>
<li>Games</li>
<li>About</li>
</ul>
</nav>
<article>
<header>
<h1>Test Content</h1>
</header>
</article>
<footer>
<div class="metadata">
<span><img alt="Author" src="//lijero.co/res/icon/person.svg" /> Lijero</span>
<span><img alt="Updated" src="//lijero.co/res/icon/clock.svg" /> 2017-12-16</span>
<div class="license">
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">
<img alt="This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License" style="border-width:0" src="/res/cc-by-sa-small.png" />
</a>
</div>
</div>
</footer>
</body>
</html>

22
templates/.gitignore vendored Normal file
View File

@ -0,0 +1,22 @@
dist
dist-*
cabal-dev
*.o
*.hi
*.chi
*.chs.h
*.dyn_o
*.dyn_hi
.hpc
.hsenv
.cabal-sandbox/
cabal.sandbox.config
*.prof
*.aux
*.hp
*.eventlog
.stack-work/
cabal.project.local
cabal.project.local~
.HTF/
.ghc.environment.*

2
templates/Setup.hs Normal file
View File

@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain

@ -0,0 +1 @@
Subproject commit 43d556c89301d850da7f9e832811691daf506bf1

View File

@ -0,0 +1,70 @@
module Templates where
import Templates.Urls
import Templates.Icons
import HtmlGen.Html
import HtmlGen.Tags
basePage :: String -> String -> Html -> Html
basePage pageTitle authorName content =
html %% xmlns %% langEn
%> (headTag
%> utf8
%> author authorName
%> allowRobots
%> stylesheet stylesheetCommonUrl
%> faviconLink
%> (title %>> pageTitle)
%> viewport
)
%> content
navSection :: Html
navSection =
nav
%> (spanTag `withId` "navbrand" %>> "Lijero")
%> unorderedList
[ href baseUrl $ text "Home"
, href qiplUrl $ text "Qipl"
, href aboutUrl $ text "About"
]
footerSection :: String -> String -> Html
footerSection authorName dateModified =
footer
%> (divTag `withClass` "metadata"
%> (spanTag
%> authorIcon
%>> ' ' : authorName
)
%> (spanTag
%> updatedIcon
%>> ' ' : dateModified
)
%> license
)
simplePage :: String -> String -> String -> Html -> Html
simplePage titleName authorName dateModified content =
basePage titleName authorName $
body %> navSection
%> content
%> footerSection authorName dateModified
redirectPage :: String -> String -> Html
redirectPage name url =
html
%> (headTag
%> utf8
%> (meta
%% ("http-equiv", "refresh")
%% ("content", "0;url=" ++ url)
)
%> (title %>> "Redirecting to " ++ url)
)
%> (body
%> (href url $ p
%>> ("Click here if you are not being redirected to " ++ name)
)
)

View File

@ -0,0 +1,45 @@
module Templates.Icons where
import Templates.Urls
import HtmlGen.Html
import HtmlGen.Tags
personIconUrl :: String
personIconUrl = iconUrl ++ "person.svg"
personIcon :: String -> Html
personIcon alt = img alt personIconUrl
authorIcon :: Html
authorIcon = personIcon "Author"
clockIconUrl :: String
clockIconUrl = iconUrl ++ "clock.svg"
clockIcon :: String -> Html
clockIcon alt = img alt clockIconUrl
updatedIcon :: Html
updatedIcon = clockIcon "Updated"
ccbysaIconUrl :: String
ccbysaIconUrl = resUrl ++ "cc-by-sa-small.png"
ccbysaIcon :: Html
ccbysaIcon = img "This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License" ccbysaIconUrl %% ("style", "border-width:0")
license :: Html
license =
divTag `withClass` "license"
%> (href ccbysaUrl ccbysaIcon
%% ("rel", "license"))
faviconUrl :: String
faviconUrl = baseUrl ++ "favicon.png"
faviconMime :: String
faviconMime = "image/png"
faviconLink :: Html
faviconLink = favicon faviconUrl faviconMime

View File

@ -0,0 +1,22 @@
module Templates.Urls where
baseUrl :: String
baseUrl = "//lijero.co/"
resUrl :: String
resUrl = baseUrl ++ "res/"
iconUrl :: String
iconUrl = resUrl ++ "icon/"
ccbysaUrl :: String
ccbysaUrl = "http://creativecommons.org/licenses/by-sa/4.0/"
stylesheetCommonUrl :: String
stylesheetCommonUrl = resUrl ++ "common.css"
qiplUrl :: String
qiplUrl = baseUrl ++ "qipl/"
aboutUrl :: String
aboutUrl = baseUrl ++ "about/"

66
templates/stack.yaml Normal file
View File

@ -0,0 +1,66 @@
# This file was automatically generated by 'stack init'
#
# Some commonly used options have been documented as comments in this file.
# For advanced use and comprehensive documentation of the format, please see:
# https://docs.haskellstack.org/en/stable/yaml_configuration/
# Resolver to choose a 'specific' stackage snapshot or a compiler version.
# A snapshot resolver dictates the compiler version and the set of packages
# to be used for project dependencies. For example:
#
# resolver: lts-3.5
# resolver: nightly-2015-09-21
# resolver: ghc-7.10.2
# resolver: ghcjs-0.1.0_ghc-7.10.2
#
# The location of a snapshot can be provided as a file or url. Stack assumes
# a snapshot provided as a file might change, whereas a url resource does not.
#
# resolver: ./custom-snapshot.yaml
# resolver: https://example.com/snapshots/2018-01-01.yaml
resolver: lts-11.7
# User packages to be built.
# Various formats can be used as shown in the example below.
#
# packages:
# - some-directory
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
# - location:
# git: https://github.com/commercialhaskell/stack.git
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
# - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a
# subdirs:
# - auto-update
# - wai
packages:
- .
- html-generator
# Dependency packages to be pulled from upstream that are not in the resolver
# using the same syntax as the packages field.
# (e.g., acme-missiles-0.3)
# extra-deps: []
# Override default flag values for local packages and extra-deps
# flags: {}
# Extra package databases containing global packages
# extra-package-dbs: []
# Control whether we use the GHC we find on the path
# system-ghc: true
#
# Require a specific version of stack, using version ranges
# require-stack-version: -any # Default
# require-stack-version: ">=1.7"
#
# Override the architecture used by stack, especially useful on Windows
# arch: i386
# arch: x86_64
#
# Extra directories used by stack for building
# extra-include-dirs: [/path/to/dir]
# extra-lib-dirs: [/path/to/dir]
#
# Allow a newer minor version of GHC than the snapshot specifies
# compiler-check: newer-minor

25
templates/templates.cabal Normal file
View File

@ -0,0 +1,25 @@
name: templates
version: 0.1.0.0
-- synopsis:
-- description:
homepage: https://github.com/lijerom/lijero.co/
license: GPL-3
--license-file: LICENSE
author: Lijero
maintainer: lijero@lijero.co
copyright: 2018 Lijero
category: Web
build-type: Simple
cabal-version: >=1.10
-- extra-source-files: README.md
library
hs-source-dirs: src
default-language: Haskell2010
exposed-modules:
Templates
, Templates.Icons
, Templates.Urls
build-depends:
base >=4.7 && <5
, html-generator