Simplify templates.
This commit is contained in:
parent
51a44c1f41
commit
a11179a6ed
54
app/site.hs
54
app/site.hs
|
@ -15,7 +15,7 @@ config = defaultConfiguration
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
bibHeaders :: [(String, [String])]
|
bibHeaders :: [(String, [String])]
|
||||||
bibHeaders = [ ("draft" , [ "-c", "$type='UNPUBLISHED'" ] ) ,
|
bibHeaders = [ ("drafts" , [ "-c", "$type='UNPUBLISHED'" ] ) ,
|
||||||
("thesis" , [ "-c", "$type='PHDTHESIS'" ] ) ,
|
("thesis" , [ "-c", "$type='PHDTHESIS'" ] ) ,
|
||||||
("pubs" , [ "-c", "$type='INPROCEEDINGS' or $type='ARTICLE'" ] ) ]
|
("pubs" , [ "-c", "$type='INPROCEEDINGS' or $type='ARTICLE'" ] ) ]
|
||||||
|
|
||||||
|
@ -70,31 +70,6 @@ main = hakyllWith config $ do
|
||||||
route $ setExtension "css"
|
route $ setExtension "css"
|
||||||
compile $ compass
|
compile $ compass
|
||||||
|
|
||||||
forM_ bibHeaders $ \(nick, flags) ->
|
|
||||||
create [fromCapture (fromGlob "bibs/*.html") nick] $ do
|
|
||||||
route idRoute
|
|
||||||
compile $
|
|
||||||
let biblioCtx = mconcat
|
|
||||||
[ field "bibitems" $ return . itemBody ] in do
|
|
||||||
bibTpl <- loadBody $ fromFilePath "templates/bibitemtpl.html"
|
|
||||||
(bib2bib flags)
|
|
||||||
>>= bib2bibParse
|
|
||||||
>>= applyTemplateList bibTpl bibEntryContext
|
|
||||||
>>= makeItem
|
|
||||||
>>= loadAndApplyTemplate (fromFilePath "templates/biblisttpl.html") biblioCtx
|
|
||||||
>>= relativizeUrls
|
|
||||||
|
|
||||||
match (fromGlob "content/biblio.md") $ do
|
|
||||||
route $ setExtension "html"
|
|
||||||
compile $ do
|
|
||||||
let makeBibCtx (nick, _) =
|
|
||||||
field nick (\_ -> loadBody $ fromFilePath ("bibs/" ++ nick ++ ".html"))
|
|
||||||
secDiv = defaultHakyllWriterOptions { writerSectionDivs = True }
|
|
||||||
biblioCtx = mconcat $ map makeBibCtx bibHeaders in do
|
|
||||||
pandocCompilerWith defaultHakyllReaderOptions secDiv
|
|
||||||
>>= applyAsTemplate biblioCtx
|
|
||||||
>>= relativizeUrls
|
|
||||||
|
|
||||||
match (fromGlob "content/*.md") $ do
|
match (fromGlob "content/*.md") $ do
|
||||||
route $ setExtension "html"
|
route $ setExtension "html"
|
||||||
compile $ do
|
compile $ do
|
||||||
|
@ -107,14 +82,27 @@ main = hakyllWith config $ do
|
||||||
compile $ do
|
compile $ do
|
||||||
let loadSec sec = field sec
|
let loadSec sec = field sec
|
||||||
(\_ -> loadBody (fromFilePath $ "content/" ++ sec ++ ".md"))
|
(\_ -> loadBody (fromFilePath $ "content/" ++ sec ++ ".md"))
|
||||||
mainContext = mconcat $ fmap loadSec contentSections
|
makeBibCtx (nick, _) =
|
||||||
indexContext =
|
field nick (\_ -> loadBody $ fromFilePath ("bibs/" ++ nick ++ ".html"))
|
||||||
field "footer" (\_ -> loadBody $ fromFilePath "content/footer.md")
|
biblioContext = mconcat $ map makeBibCtx bibHeaders
|
||||||
`mappend`
|
indexContext = mconcat $ fmap loadSec contentSections
|
||||||
defaultContext
|
footerContext = field "footer" (\_ -> loadBody $ fromFilePath "content/footer.md")
|
||||||
getResourceBody
|
getResourceBody
|
||||||
>>= applyAsTemplate mainContext
|
>>= applyAsTemplate (indexContext <> biblioContext <> footerContext <> defaultContext)
|
||||||
>>= loadAndApplyTemplate (fromFilePath "templates/main.html") indexContext
|
>>= relativizeUrls
|
||||||
|
|
||||||
|
forM_ bibHeaders $ \(nick, flags) ->
|
||||||
|
create [fromCapture (fromGlob "bibs/*.html") nick] $ do
|
||||||
|
route idRoute
|
||||||
|
compile $
|
||||||
|
let biblioCtx = mconcat
|
||||||
|
[ field "bibitems" $ return . itemBody ] in do
|
||||||
|
bibTpl <- loadBody $ fromFilePath "templates/bibitem.html"
|
||||||
|
(bib2bib flags)
|
||||||
|
>>= bib2bibParse
|
||||||
|
>>= applyTemplateList bibTpl bibEntryContext
|
||||||
|
>>= makeItem
|
||||||
|
>>= applyAsTemplate biblioCtx
|
||||||
>>= relativizeUrls
|
>>= relativizeUrls
|
||||||
|
|
||||||
match (fromGlob "templates/*") $ compile templateCompiler
|
match (fromGlob "templates/*") $ compile templateCompiler
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
## Drafts ##
|
|
||||||
|
|
||||||
\$draft\$
|
|
||||||
|
|
||||||
## Thesis ##
|
|
||||||
|
|
||||||
\$thesis\$
|
|
||||||
|
|
||||||
## Refereed Publications ##
|
|
||||||
|
|
||||||
\$pubs\$
|
|
|
@ -1,13 +0,0 @@
|
||||||
# About Me # {#card}
|
|
||||||
...
|
|
||||||
|
|
||||||
# Research Interests # {#card}
|
|
||||||
...
|
|
||||||
|
|
||||||
# Publications # {#card}
|
|
||||||
|
|
||||||
\$draft\$
|
|
||||||
|
|
||||||
\$confs\$
|
|
||||||
|
|
||||||
\$journal\$
|
|
|
@ -192,7 +192,7 @@ body {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#drafts, #thesis, #refereed-publications {
|
#drafts, #thesis, #pubs {
|
||||||
padding: $text-pad;
|
padding: $text-pad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
78
index.html
78
index.html
|
@ -1,4 +1,44 @@
|
||||||
<div class="topbox" id="card">
|
<meta charset=utf-8>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||||
|
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-33267683-1"></script>
|
||||||
|
<script>
|
||||||
|
window.dataLayer = window.dataLayer || [];
|
||||||
|
function gtag(){dataLayer.push(arguments);}
|
||||||
|
gtag('js', new Date());
|
||||||
|
|
||||||
|
gtag('config', 'UA-33267683-1');
|
||||||
|
|
||||||
|
var trackLink = function(label,url) {
|
||||||
|
gtag('event', 'click', {
|
||||||
|
'event_category': 'link',
|
||||||
|
'event_label': label,
|
||||||
|
'event_action': url,
|
||||||
|
'transport_type': 'beacon',
|
||||||
|
'event_callback': function(){document.location = url;}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<title> Justin Hsu </title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="css/style.css">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link href='https://fonts.googleapis.com/css?family=Roboto:500,300,300italic'
|
||||||
|
rel='stylesheet' type='text/css'>
|
||||||
|
<link href='https://fonts.googleapis.com/css?family=Inconsolata' rel='stylesheet'
|
||||||
|
type='text/css'>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="container" id="flexed">
|
||||||
|
<div class="header">
|
||||||
|
<h1> Justin Hsu </h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="topbox" id="card">
|
||||||
<div class="bio-bar">
|
<div class="bio-bar">
|
||||||
<div class="picture">
|
<div class="picture">
|
||||||
<img src="images/round.png" width="160" height="222">
|
<img src="images/round.png" width="160" height="222">
|
||||||
|
@ -16,18 +56,44 @@
|
||||||
|
|
||||||
$about$
|
$about$
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="card">
|
<div id="card">
|
||||||
<div id="mini-header-alt">
|
<div id="mini-header-alt">
|
||||||
News
|
News
|
||||||
</div>
|
</div>
|
||||||
$news$
|
$news$
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="card">
|
<div id="card">
|
||||||
<div id="mini-header">
|
<div id="mini-header">
|
||||||
Bibliography
|
Bibliography
|
||||||
</div>
|
</div>
|
||||||
$biblio$
|
<section id="drafts">
|
||||||
|
<h2>Drafts</h2><p>
|
||||||
|
<table>
|
||||||
|
$drafts$
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
<section id="thesis">
|
||||||
|
<h2>Thesis</h2><p>
|
||||||
|
<table>
|
||||||
|
$thesis$
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
<section id="pubs">
|
||||||
|
<h2>Refereed Publications</h2><p>
|
||||||
|
<table>
|
||||||
|
$pubs$
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<footer>
|
||||||
|
<small>
|
||||||
|
$footer$
|
||||||
|
</small>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
<table>
|
|
||||||
$bibitems$
|
|
||||||
</table>
|
|
|
@ -1,50 +0,0 @@
|
||||||
<meta charset=utf-8>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
|
||||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-33267683-1"></script>
|
|
||||||
<script>
|
|
||||||
window.dataLayer = window.dataLayer || [];
|
|
||||||
function gtag(){dataLayer.push(arguments);}
|
|
||||||
gtag('js', new Date());
|
|
||||||
|
|
||||||
gtag('config', 'UA-33267683-1');
|
|
||||||
|
|
||||||
var trackLink = function(label,url) {
|
|
||||||
gtag('event', 'click', {
|
|
||||||
'event_category': 'link',
|
|
||||||
'event_label': label,
|
|
||||||
'event_action': url,
|
|
||||||
'transport_type': 'beacon',
|
|
||||||
'event_callback': function(){document.location = url;}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<title> Justin Hsu </title>
|
|
||||||
<link rel="stylesheet" type="text/css" href="css/style.css">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<link href='https://fonts.googleapis.com/css?family=Roboto:500,300,300italic'
|
|
||||||
rel='stylesheet' type='text/css'>
|
|
||||||
<link href='https://fonts.googleapis.com/css?family=Inconsolata' rel='stylesheet'
|
|
||||||
type='text/css'>
|
|
||||||
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div class="container" id="flexed">
|
|
||||||
<div class="header">
|
|
||||||
<h1> Justin Hsu </h1>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
$body$
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<footer>
|
|
||||||
<small>
|
|
||||||
$footer$
|
|
||||||
</small>
|
|
||||||
</footer>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
Reference in New Issue