Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Enabling static/ directory

  • Loading branch information...
commit 784247af93c996b97833601c29fde9f6343ea861 1 parent 3a4a30e
@bytbox authored
Showing with 20 additions and 0 deletions.
  1. +13 −0 html.go
  2. +2 −0  slark.go
  3. +5 −0 static/style.css
View
13 html.go
@@ -47,3 +47,16 @@ func writeHtml(odn, tdn string, all []*Threaded, msgs []*Threaded) {
f.Close()
}
}
+
+func copyStatic(odn, sdn string) {
+ fs, e := ioutil.ReadDir(sdn)
+ if e != nil { panic(e) }
+ for _, i := range fs {
+ if i.IsDir() { continue }
+ in := filepath.Join(sdn, i.Name())
+ out := filepath.Join(odn, i.Name())
+ c, e := ioutil.ReadFile(in)
+ if e != nil { continue }
+ ioutil.WriteFile(out, c, 0755)
+ }
+}
View
2  slark.go
@@ -13,6 +13,7 @@ var (
version = flag.Bool("V", false, "display version information")
html = flag.String("html", "html/", "write html output to directory")
tmpldir = flag.String("templates", "tmpl/", "use template directory")
+ statdir = flag.String("static", "static/", "use static directory")
)
func main() {
@@ -39,4 +40,5 @@ func main() {
all, threaded := Thread(msgs)
writeHtml(*html, *tmpldir, all, threaded)
+ copyStatic(*html, *statdir)
}
View
5 static/style.css
@@ -0,0 +1,5 @@
+/* Default slark styling */
+
+body {
+ width: 780px;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.