Start simple init program
This commit is contained in:
parent
3f13de0787
commit
6307ecd094
13 changed files with 199 additions and 32 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -13,6 +13,7 @@ tags
|
|||
tests/Main
|
||||
_cache
|
||||
_store
|
||||
_site
|
||||
|
||||
# Rest of the file: ignore examples
|
||||
web/_cache
|
||||
|
|
17
data/example/about.rst
Normal file
17
data/example/about.rst
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
title: About
|
||||
---
|
||||
Nullam imperdiet sodales orci vitae molestie. Nunc quam orci, pharetra a
|
||||
rhoncus vitae, eleifend id felis. Suspendisse potenti. Etiam vitae urna orci.
|
||||
Quisque pellentesque dignissim felis, egestas tempus urna luctus vitae. In hac
|
||||
habitasse platea dictumst. Morbi fringilla mattis odio, et mattis tellus
|
||||
accumsan vitae.
|
||||
|
||||
1. Amamus Unicode 碁
|
||||
2. Interdum nex magna.
|
||||
|
||||
Vivamus eget mauris sit amet nulla laoreet lobortis. Nulla in diam elementum
|
||||
risus convallis commodo. Cras vehicula varius dui vitae facilisis. Proin
|
||||
elementum libero eget leo aliquet quis euismod orci vestibulum. Duis rhoncus
|
||||
lorem consequat tellus vestibulum aliquam. Quisque orci orci, malesuada porta
|
||||
blandit et, interdum nec magna.
|
21
data/example/code.lhs
Normal file
21
data/example/code.lhs
Normal file
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
title: Code
|
||||
---
|
||||
Etiam condimentum auctor semper. Donec lobortis, magna id sodales sollicitudin,
|
||||
lectus mi egestas nulla, pulvinar lobortis nunc eros id nisl. Curabitur
|
||||
imperdiet, erat at accumsan vulputate.
|
||||
|
||||
> reverse' [] = []
|
||||
> reverse' (x:xs) = (reverse' xs) ++ [x]
|
||||
|
||||
Purus nunc blandit nulla, dictum.
|
||||
|
||||
vestibulum sem lorem eget ipsum. Nunc tincidunt, turpis ut fermentum dapibus,
|
||||
justo tortor bibendum sem, at facilisis justo odio luctus lectus. Quisque nec
|
||||
ligula ipsum. Nunc augue lacus, ullamcorper vel dapibus in, mattis eget elit.
|
||||
|
||||
> main = print $ reverse' [1 .. 10]
|
||||
|
||||
Integer ut dui eu felis mollis vestibulum. Etiam at nibh id diam aliquet
|
||||
vestibulum sit amet a nibh. Aliquam erat volutpat. Etiam vitae nulla at dolor
|
||||
fringilla tempor ut a nunc. Pellentesque elementum elit lorem.
|
27
data/example/css/default.css
Normal file
27
data/example/css/default.css
Normal file
|
@ -0,0 +1,27 @@
|
|||
body {
|
||||
width: 600px;
|
||||
margin: 0px auto 0px auto;
|
||||
}
|
||||
|
||||
div#navigation {
|
||||
text-align: center;
|
||||
border-bottom: 4px solid black;
|
||||
}
|
||||
|
||||
div#navigation a {
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
background-color: black;
|
||||
padding: 3px 10px 3px 10px;
|
||||
margin: 0px 10px 0px 10px;
|
||||
}
|
||||
|
||||
div.figure {
|
||||
float: right;
|
||||
margin: 20px 0px 20px 20px;
|
||||
}
|
||||
|
||||
div.figure p.caption {
|
||||
text-align: center;
|
||||
font-style: italic;
|
||||
}
|
18
data/example/css/syntax.css
Normal file
18
data/example/css/syntax.css
Normal file
|
@ -0,0 +1,18 @@
|
|||
/* Generated by pandoc. */
|
||||
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode, table.sourceCode pre
|
||||
{ margin: 0; padding: 0; border: 0; vertical-align: baseline; border: none; }
|
||||
td.lineNumbers { border-right: 1px solid #AAAAAA; text-align: right; color: #AAAAAA; padding-right: 5px; padding-left: 5px; }
|
||||
td.sourceCode { padding-left: 5px; }
|
||||
pre.sourceCode span.kw { color: #007020; font-weight: bold; }
|
||||
pre.sourceCode span.dt { color: #902000; }
|
||||
pre.sourceCode span.dv { color: #40a070; }
|
||||
pre.sourceCode span.bn { color: #40a070; }
|
||||
pre.sourceCode span.fl { color: #40a070; }
|
||||
pre.sourceCode span.ch { color: #4070a0; }
|
||||
pre.sourceCode span.st { color: #4070a0; }
|
||||
pre.sourceCode span.co { color: #60a0b0; font-style: italic; }
|
||||
pre.sourceCode span.ot { color: #007020; }
|
||||
pre.sourceCode span.al { color: red; font-weight: bold; }
|
||||
pre.sourceCode span.fu { color: #06287e; }
|
||||
pre.sourceCode span.re { }
|
||||
pre.sourceCode span.er { color: red; font-weight: bold; }
|
BIN
data/example/images/haskell-logo.png
Normal file
BIN
data/example/images/haskell-logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
27
data/example/index.markdown
Normal file
27
data/example/index.markdown
Normal file
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
title: Home
|
||||
---
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce tempor, urna et
|
||||
auctor tincidunt, eros mauris facilisis purus, eget sollicitudin leo massa sit
|
||||
amet ipsum. Vivamus eu massa in urna vehicula rutrum eget sit amet purus.
|
||||
|
||||
![Haskell logo](/images/haskell-logo.png)
|
||||
|
||||
- Mauris sit amet justo mi.
|
||||
- Curabitur vel quam felis.
|
||||
- In hac habitasse platea dictumst.
|
||||
|
||||
Etiam nec consequat risus. Donec consequat est vitae neque fermentum
|
||||
feugiat nec ac nibh. Nulla rhoncus, odio quis scelerisque rutrum, metus sem
|
||||
tempor ante, a ornare ipsum felis sed ligula. Morbi urna lectus, scelerisque
|
||||
non pharetra in, rutrum quis ligula. Phasellus semper ullamcorper arcu eu
|
||||
auctor.
|
||||
|
||||
Aliquam sagittis tincidunt libero ut elementum. Ut sit amet vestibulum metus.
|
||||
Ut aliquet congue neque eu tincidunt. Integer eu elit sed massa sollicitudin
|
||||
vehicula nec ut sem. Cras euismod enim eget purus lacinia non feugiat urna
|
||||
imperdiet. Aliquam justo sem, viverra eu vehicula vitae, imperdiet vel magna.
|
||||
|
||||
Pellentesque enim dui, interdum elementum vehicula luctus, feugiat vitae arcu.
|
||||
Vestibulum ut felis justo. Quisque vestibulum mauris eget ipsum luctus
|
||||
consequat.
|
23
data/example/site.hs
Normal file
23
data/example/site.hs
Normal file
|
@ -0,0 +1,23 @@
|
|||
--------------------------------------------------------------------------------
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
import Hakyll
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
main :: IO ()
|
||||
main = hakyll $ do
|
||||
match "images/*" $ do
|
||||
route idRoute
|
||||
compile copyFileCompiler
|
||||
|
||||
match "css/*" $ do
|
||||
route idRoute
|
||||
compile compressCssCompiler
|
||||
|
||||
match (fromList ["about.rst", "index.markdown", "code.lhs"]) $ do
|
||||
route $ setExtension "html"
|
||||
compile $ pageCompiler
|
||||
>>= requireApplyTemplate "templates/default.html" defaultContext
|
||||
>>= relativizeUrls
|
||||
|
||||
match "templates/*" $ compile templateCompiler
|
21
data/example/templates/default.html
Normal file
21
data/example/templates/default.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>MyAweSomeCompany - $title$</title>
|
||||
<link rel="stylesheet" type="text/css" href="/css/default.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/syntax.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>MyAweSomeCompany - $title$</h1>
|
||||
<div id="navigation">
|
||||
<a href="/">Home</a>
|
||||
<a href="/about.html">About</a>
|
||||
<a href="/code.html">Code</a>
|
||||
</div>
|
||||
|
||||
$body$
|
||||
</body>
|
||||
</html>
|
24
hakyll.cabal
24
hakyll.cabal
|
@ -41,11 +41,19 @@ Cabal-Version: >= 1.8
|
|||
Build-Type: Simple
|
||||
Data-Dir: data
|
||||
|
||||
Data-Files:
|
||||
templates/atom.xml
|
||||
Data-files:
|
||||
example/about.rst
|
||||
example/code.lhs
|
||||
example/css/default.css
|
||||
example/css/syntax.css
|
||||
example/images/haskell-logo.png
|
||||
example/index.markdown
|
||||
example/site.hs
|
||||
example/templates/default.html
|
||||
templates/atom-item.xml
|
||||
templates/rss.xml
|
||||
templates/atom.xml
|
||||
templates/rss-item.xml
|
||||
templates/rss.xml
|
||||
|
||||
Extra-source-files:
|
||||
tests/data/example.md
|
||||
|
@ -214,3 +222,13 @@ Test-suite hakyll-tests
|
|||
Hakyll.Web.Urls.Relativize.Tests
|
||||
Hakyll.Web.Util.Html.Tests
|
||||
TestSuite.Util
|
||||
|
||||
Executable hakyll-init
|
||||
Ghc-options: -Wall
|
||||
Hs-source-dirs: src
|
||||
Main-is: Hakyll/Init.hs
|
||||
|
||||
Build-depends:
|
||||
base >= 4 && < 5,
|
||||
directory >= 1.0 && < 1.3,
|
||||
filepath >= 1.0 && < 1.4
|
||||
|
|
23
src/Hakyll/Init.hs
Normal file
23
src/Hakyll/Init.hs
Normal file
|
@ -0,0 +1,23 @@
|
|||
--------------------------------------------------------------------------------
|
||||
module Main
|
||||
( main
|
||||
) where
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
import System.Directory (copyFile)
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
import Hakyll.Core.Util.File
|
||||
import Paths_hakyll
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
main :: IO ()
|
||||
main = do
|
||||
let dstDir = "."
|
||||
srcDir <- getDataFileName "example"
|
||||
files <- getRecursiveContents srcDir
|
||||
print files
|
||||
return ()
|
|
@ -1,28 +0,0 @@
|
|||
---
|
||||
title: Philosophy
|
||||
---
|
||||
|
||||
# Small-to-medium sites
|
||||
|
||||
Hakyll was written to be used for small-to-medium sites. You can do some
|
||||
advanced things with it, but don't use it to build a big online shop.
|
||||
|
||||
# Hakyll.hs
|
||||
|
||||
It should be possible to put all configuration in one file, so data and
|
||||
configuration can be strictly separated. In addition, we think this file should
|
||||
never exceed a 100 lines of code.
|
||||
|
||||
# High-level
|
||||
|
||||
Hakyll tries to provide as many high-level functions as possible for common
|
||||
tasks, while the lower-level functions should also be accessible. If you think
|
||||
you're writing something that can be used for many sites, please send a patch,
|
||||
or your `hakyll.hs`, and we will see what we can do.
|
||||
|
||||
# Well-documented
|
||||
|
||||
A key to being easy-to-use is documentation. That's why we try to provide as
|
||||
many working examples as possible. If you ever create a site using hakyll,
|
||||
please consider open-sourcing it, as people might be able to learn from your
|
||||
code.
|
|
@ -26,7 +26,6 @@
|
|||
<a href="/index.html">home</a>
|
||||
<a href="/tutorials.html">tutorials</a>
|
||||
<a href="/reference.html">reference</a>
|
||||
<a href="/philosophy.html">philosophy</a>
|
||||
<a href="/about.html">about</a>
|
||||
<a href="/tutorials/faq.html">faq</a>
|
||||
<a href="/examples.html">examples</a>
|
||||
|
|
Loading…
Reference in a new issue