-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
426 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
- val dateFormat = org.joda.time.format.DateTimeFormat.forPattern("EEEE d MMMM") | ||
!!!html | ||
%html | ||
%head | ||
-# Don't get it | ||
- if (title.isDefined) | ||
%title= title.get | ||
%link(rel="stylesheet" href="monkeyman/monkeyman.css" type="text/css") | ||
%body | ||
#main | ||
#header | ||
%h1= title.getOrElse("No title") | ||
#subtitle= dateFormat.print(pubDateTime) | ||
.hr | ||
#body | ||
- unescape(body) | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
@base: #DDDDDD; | ||
@fontcolor: #3F3F3F; | ||
|
||
html, body { | ||
margin:0; | ||
padding: 0; | ||
height: 100%; | ||
} | ||
|
||
body { | ||
font-family: Helvetica, Arial, sans; | ||
background-color: @base; | ||
} | ||
|
||
#main { | ||
margin-left: auto; | ||
margin-right: auto; | ||
width: 800px; | ||
background-color: lighten(@base, 10%); | ||
padding-left: 40px; | ||
padding-right: 40px; | ||
padding-top: 0px; | ||
margin-top: 0px; | ||
margin-bottom: 0px; | ||
min-height: 100%; | ||
border-left: 1px solid darken(@base, 10%); | ||
border-right: 1px solid darken(@base, 10%); | ||
} | ||
|
||
#header { | ||
padding-top: 30px; | ||
background-image: url("./logo.png"); | ||
background-repeat: no-repeat; | ||
background-position: right; | ||
height: 100px; | ||
} | ||
|
||
#body { | ||
color: @fontcolor; | ||
margin-top: 30px; | ||
} | ||
|
||
h1 { | ||
margin-top: 0px; | ||
color: darken(@fontcolor, 3%); | ||
margin-bottom: 0px; | ||
} | ||
|
||
#subtitle { | ||
font-weight: 300; | ||
font-size: 18px; | ||
} | ||
|
||
.hr { | ||
border-top: 1px solid darken(@base, 5%); | ||
border-bottom: 1px solid white; | ||
width: 100%; | ||
height: 0px; | ||
} |
46 changes: 46 additions & 0 deletions
46
src/main/scala/nl/flotsam/monkeyman/ClasspathResource.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Monkeyman static web site generator | ||
* Copyright (C) 2012 Wilfred Springer | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
package nl.flotsam.monkeyman | ||
|
||
import org.joda.time.LocalDateTime | ||
import eu.medsea.mimeutil.{MimeType, MimeUtil} | ||
import collection.JavaConversions._ | ||
|
||
case class ClasspathResource(path: String) extends Resource { | ||
|
||
val url = getClass.getResource("/" + path) | ||
|
||
def title = None | ||
|
||
def pubDateTime = LocalDateTime.now() | ||
|
||
def contentType = MimeUtil.getMimeTypes(url).asInstanceOf[java.util.Set[MimeType]].head.toString | ||
|
||
def open = url.openStream() | ||
|
||
def tags = Set.empty | ||
|
||
def published = true | ||
|
||
def asHtmlFragment = None | ||
|
||
def id = path | ||
|
||
} |
62 changes: 62 additions & 0 deletions
62
src/main/scala/nl/flotsam/monkeyman/ClasspathResourceLoader.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Monkeyman static web site generator | ||
* Copyright (C) 2012 Wilfred Springer | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
package nl.flotsam.monkeyman | ||
|
||
import org.joda.time.LocalDateTime | ||
import collection.JavaConversions._ | ||
import eu.medsea.mimeutil.detector.ExtensionMimeDetector | ||
import eu.medsea.mimeutil.{MimeType, MimeUtil} | ||
|
||
|
||
class ClasspathResourceLoader(paths: Seq[String], loader: ResourceLoader) extends ResourceLoader { | ||
|
||
private val resources = paths.map(path => ClasspathResource(path)) | ||
|
||
def load = { | ||
val loaded = loader.load | ||
val ids = loaded.map(_.id) | ||
resources.filter(resource => !ids.contains(resource.id)) ++ loaded | ||
} | ||
|
||
def register(listener: ResourceListener) { | ||
loader.register(new ResourceListener { | ||
def deleted(id: String) { | ||
resources.find(_.id == id) match { | ||
case Some(resource) => listener.modified(resource) | ||
case None => listener.deleted(id) | ||
} | ||
} | ||
|
||
def modified(resource: Resource) { | ||
listener.modified(resource) | ||
} | ||
|
||
def added(resource: Resource) { | ||
resources.find(_.id == resource.id) match { | ||
case Some(resource) => listener.modified(resource) | ||
case None => listener.added(resource) | ||
} | ||
} | ||
}) | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
should be 'monkeyman' here