add files
This commit is contained in:
parent
d6ba8491c1
commit
445524af71
|
@ -0,0 +1,30 @@
|
|||
import emerald, os, streams
|
||||
|
||||
proc getItems(): seq[string] =
|
||||
result = newSeq[string]()
|
||||
|
||||
for kind, path in walkDir("."):
|
||||
result.add(path)
|
||||
|
||||
proc indexTemplate(files: seq[string]) {.html_templ.} =
|
||||
html(lang = "en"):
|
||||
head:
|
||||
title: "Image Archive"
|
||||
|
||||
body:
|
||||
h1: "Image Archive"
|
||||
|
||||
for path in files.items():
|
||||
a(href=path):
|
||||
img(src="thumbs/" & path & ".thumb.png")
|
||||
|
||||
when isMainModule:
|
||||
setCurrentDir "/home/xena/pictures/derpi"
|
||||
|
||||
var
|
||||
files = getItems()
|
||||
fs = newFileStream("index.html", fmWrite)
|
||||
myTempl = newIndexTemplate()
|
||||
|
||||
myTempl.files = files
|
||||
myTempl.render(fs)
|
|
@ -0,0 +1,12 @@
|
|||
# Package
|
||||
|
||||
version = "0.1.0"
|
||||
author = "Christine Dodrill"
|
||||
description = "Tools for generating static sites for image archives"
|
||||
license = "MIT"
|
||||
bin = @["imgarchive"]
|
||||
|
||||
# Dependencies
|
||||
|
||||
requires "nim >= 0.13.0", "emerald"
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 286 KiB |
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<title>Image Archive</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Image Archive</h1>
|
||||
<a href="./XjScp8a.png">
|
||||
<img src="thumbs/./XjScp8a.png.thumb.png"/>
|
||||
</a>
|
||||
<a href="./lB4ICS3.png">
|
||||
<img src="thumbs/./lB4ICS3.png.thumb.png"/>
|
||||
</a>
|
||||
<a href="./oaw79y9.jpg">
|
||||
<img src="thumbs/./oaw79y9.jpg.thumb.png"/>
|
||||
</a>
|
||||
<a href="./index.html">
|
||||
<img src="thumbs/./index.html.thumb.png"/>
|
||||
</a>
|
||||
<a href="./thumbs">
|
||||
<img src="thumbs/./thumbs.thumb.png"/>
|
||||
</a>
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
After Width: | Height: | Size: 361 KiB |
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
Binary file not shown.
After Width: | Height: | Size: 92 KiB |
Binary file not shown.
After Width: | Height: | Size: 108 KiB |
Binary file not shown.
After Width: | Height: | Size: 92 KiB |
Loading…
Reference in New Issue