add files

This commit is contained in:
Christine Dodrill 2016-02-02 19:03:30 -08:00
parent d6ba8491c1
commit 445524af71
9 changed files with 66 additions and 0 deletions

30
imgarchive.nim Normal file
View File

@ -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)

12
imgarchive.nimble Normal file
View File

@ -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"

BIN
in/XjScp8a.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

24
in/index.html Normal file
View File

@ -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>

BIN
in/lB4ICS3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

BIN
in/oaw79y9.jpg Normal file

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