center and theme things
This commit is contained in:
parent
445524af71
commit
75ffbb3226
|
@ -1,26 +1,33 @@
|
||||||
import emerald, os, streams
|
import emerald, os, streams, strutils
|
||||||
|
|
||||||
proc getItems(): seq[string] =
|
proc getItems(): seq[string] =
|
||||||
result = newSeq[string]()
|
result = newSeq[string]()
|
||||||
|
|
||||||
for kind, path in walkDir("."):
|
for kind, path in walkDir("."):
|
||||||
|
if (path.endsWith "thumbs") or (path.endsWith "index.html"):
|
||||||
|
continue
|
||||||
|
|
||||||
result.add(path)
|
result.add(path)
|
||||||
|
|
||||||
proc indexTemplate(files: seq[string]) {.html_templ.} =
|
proc indexTemplate(files: seq[string]) {.html_templ.} =
|
||||||
html(lang = "en"):
|
html(lang = "en"):
|
||||||
head:
|
head:
|
||||||
title: "Image Archive"
|
title: "Image Archive"
|
||||||
|
link(rel="stylesheet", `type`="text/css", href="/css/solarized-dark.min.css")
|
||||||
|
|
||||||
body:
|
body:
|
||||||
h1: "Image Archive"
|
h1: "Image Archive"
|
||||||
|
|
||||||
for path in files.items():
|
a(href=".."): "Go back"
|
||||||
a(href=path):
|
|
||||||
img(src="thumbs/" & path & ".thumb.png")
|
br(); br(); br()
|
||||||
|
|
||||||
|
d(style="text-align: center"):
|
||||||
|
for path in files.items():
|
||||||
|
a(href=path):
|
||||||
|
img(src="thumbs/" & path & ".thumb.png")
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
setCurrentDir "/home/xena/pictures/derpi"
|
|
||||||
|
|
||||||
var
|
var
|
||||||
files = getItems()
|
files = getItems()
|
||||||
fs = newFileStream("index.html", fmWrite)
|
fs = newFileStream("index.html", fmWrite)
|
||||||
|
|
Loading…
Reference in New Issue