Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added custom.css. Initialize only copies logo, footer, custom.css.

Everything else falls back to the defaults in the data
directory.
  • Loading branch information...
commit 25ffe1ef19fc594ba7db58b9ac400d5a21063463 1 parent 8d7c981
@jgm authored
View
22 Network/Gitit/Initialize.hs
@@ -22,7 +22,7 @@ module Network.Gitit.Initialize ( initializeGititState
, createRepoIfMissing
, createTemplateIfMissing )
where
-import System.FilePath ((</>), (<.>), takeExtension)
+import System.FilePath ((</>), (<.>))
import Data.FileStore
import qualified Data.Map as M
import Network.Gitit.Types
@@ -32,7 +32,7 @@ import Network.Gitit.Plugins
import Network.Gitit.Layout (defaultRenderPage)
import Paths_gitit (getDataFileName)
import Control.Exception (throwIO, try)
-import System.Directory (copyFile, createDirectoryIfMissing, doesDirectoryExist, getDirectoryContents, doesFileExist)
+import System.Directory (copyFile, createDirectoryIfMissing, doesDirectoryExist, doesFileExist)
import Control.Monad (unless, forM_, liftM)
import Prelude hiding (readFile)
import System.IO.UTF8
@@ -90,9 +90,11 @@ createTemplateIfMissing conf' = do
unless templateExists $ do
createDirectoryIfMissing True (templatesDir conf')
templatePath <- getDataFileName $ "data" </> "templates"
- templs <- liftM (filter (`notElem` [".",".."])) $
- getDirectoryContents templatePath
- forM_ templs $ \t -> do
+ -- templs <- liftM (filter (`notElem` [".",".."])) $
+ -- getDirectoryContents templatePath
+ -- Copy footer.st, since this is the component users
+ -- are most likely to want to customize:
+ forM_ ["footer.st"] $ \t -> do
copyFile (templatePath </> t) (templatesDir conf' </> t)
logM "gitit" WARNING $ "Created " ++ (templatesDir conf' </> t)
@@ -147,11 +149,12 @@ createStaticIfMissing conf = do
let cssdir = staticdir </> "css"
createDirectoryIfMissing True cssdir
cssDataDir <- getDataFileName $ "data" </> "static" </> "css"
- cssFiles <- liftM (filter (\f -> takeExtension f == ".css")) $ getDirectoryContents cssDataDir
- forM_ cssFiles $ \f -> do
+ -- cssFiles <- liftM (filter (\f -> takeExtension f == ".css")) $ getDirectoryContents cssDataDir
+ forM_ ["custom.css"] $ \f -> do
copyFile (cssDataDir </> f) (cssdir </> f)
logM "gitit" WARNING $ "Created " ++ (cssdir </> f)
+ {-
let icondir = staticdir </> "img" </> "icons"
createDirectoryIfMissing True icondir
iconDataDir <- getDataFileName $ "data" </> "static" </> "img" </> "icons"
@@ -159,11 +162,14 @@ createStaticIfMissing conf = do
forM_ iconFiles $ \f -> do
copyFile (iconDataDir </> f) (icondir </> f)
logM "gitit" WARNING $ "Created " ++ (icondir </> f)
+ -}
logopath <- getDataFileName $ "data" </> "static" </> "img" </> "gitit-dog.png"
+ createDirectoryIfMissing True $ staticdir </> "img"
copyFile logopath $ staticdir </> "img" </> "logo.png"
logM "gitit" WARNING $ "Created " ++ (staticdir </> "img" </> "logo.png")
+ {-
let jsdir = staticdir </> "js"
createDirectoryIfMissing True jsdir
jsDataDir <- getDataFileName $ "data" </> "static" </> "js"
@@ -171,5 +177,5 @@ createStaticIfMissing conf = do
forM_ javascripts $ \f -> do
copyFile (jsDataDir </> f) (jsdir </> f)
logM "gitit" WARNING $ "Created " ++ (jsdir </> f)
-
+ -}
View
4 TODO
@@ -21,11 +21,13 @@ x see proposal on mailing list about fall-through to
x do same for templates
-_ fix initialize so it doesn't copy everything.
+x fix initialize so it doesn't copy everything.
think about using a custom.css.
_ get rid of googlecode page/ move issues to github??
+_ images are being sent gzipped - fix
+
_ while we're at it, we cd do the same thing with cached files,
using a staticHandler to serve them and then falling back.
We'd need to change the names (no .page extension), and we'd
View
2  data/static/css/base-min.css
@@ -4,4 +4,4 @@ Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.7.0
*/
-body{margin:10px;}h1{font-size:138.5%;}h2{font-size:123.1%;}h3{font-size:108%;}h1,h2,h3{margin:1em 0;}h1,h2,h3,h4,h5,h6,strong,dt{font-weight:bold;}optgroup{font-weight:normal;}abbr,acronym{border-bottom:1px dotted #000;cursor:help;}em{font-style:italic;}del{text-decoration:line-through;}blockquote,ul,ol,dl{margin:1em;}ol,ul,dl{margin-left:2em;}ol li{list-style:decimal outside;}ul li{list-style:disc outside;}dl dd{margin-left:1em;}th,td{border:1px solid #000;padding:.5em;}th{font-weight:bold;text-align:center;}caption{margin-bottom:.5em;text-align:center;}sup{vertical-align:super;}sub{vertical-align:sub;}p,fieldset,table,pre{margin-bottom:1em;}button,input[type="checkbox"],input[type="radio"],input[type="reset"],input[type="submit"]{padding:1px;}
+body{margin:10px;}h1{font-size:138.5%;}h2{font-size:123.1%;}h3{font-size:108%;}h1,h2,h3{margin:1em 0;}h1,h2,h3,h4,h5,h6,strong,dt{font-weight:bold;}optgroup{font-weight:normal;}abbr,acronym{border-bottom:1px dotted #000;cursor:help;}em{font-style:italic;}del{text-decoration:line-through;}blockquote,ul,ol,dl{margin:1em;}ol,ul,dl{margin-left:2em;}ol li{list-style:decimal outside;}ul li{list-style:disc outside;}dl dd{margin-left:1em;}th,td{border:1px solid #000;padding:.5em;}th{font-weight:bold;text-align:center;}caption{margin-bottom:.5em;text-align:center;}sup{vertical-align:super;}sub{vertical-align:sub;}p,fieldset,table,pre{margin-bottom:1em;}button,input[type="checkbox"],input[type="radio"],input[type="reset"],input[type="submit"]{padding:1px;}
View
5 data/static/css/custom.css
@@ -0,0 +1,5 @@
+@import url("screen.css"); /* default gitit screen styles */
+@import url("hk-py.css"); /* for syntax highlighting */
+
+/* Put your custom style modifications here: */
+
View
3  data/static/css/screen.css
@@ -1,3 +1,6 @@
+@import url("reset-fonts-grids.css");
+@import url("base-min.css");
+
html { background: #f9f9f9; color: black; }
fieldset { border: 1px solid #ccc; padding: 1em; }
View
5 data/templates/page.st
@@ -14,10 +14,7 @@
$if(printable)$
<link href="$base$/css/print.css" rel="stylesheet" media="all" type= "text/css" />
$else$
- <link href="$base$/css/reset-fonts-grids.css" rel="stylesheet" media="screen, projection" type="text/css" />
- <link href="$base$/css/base-min.css" rel="stylesheet" media="screen, projection" type="text/css" />
- <link href="$base$/css/hk-pyg.css" rel="stylesheet" media="screen, projection" type="text/css" />
- <link href="$base$/css/screen.css" rel="stylesheet" media="screen, projection" type="text/css" />
+ <link href="$base$/css/custom.css" rel="stylesheet" media="screen, projection" type="text/css" />
<link href="$base$/css/print.css" rel="stylesheet" media="print" type= "text/css" />
$endif$
<!--[if IE]><link href="$base$/css/ie.css" rel="stylesheet" media="screen, projection" type="text/css" /><![endif]-->
View
1  gitit.cabal
@@ -44,6 +44,7 @@ stability: experimental
data-files: data/static/css/screen.css, data/static/css/print.css,
data/static/css/ie.css, data/static/css/hk-pyg.css,
data/static/css/reset-fonts-grids.css, data/static/css/base-min.css,
+ data/static/css/custom.css,
data/static/img/gitit-dog.png,
data/static/img/icons/folder.png, data/static/img/icons/page.png,
data/static/img/icons/cross.png, data/static/img/icons/doc.png,
View
6 gitit.hs
@@ -63,14 +63,14 @@ main = do
let conf' = conf{jsMath = jsMathExists, logLevel = level}
- -- initialize state
- initializeGititState conf'
-
-- setup the page repository, template, and static files, if they don't exist
createRepoIfMissing conf'
createStaticIfMissing conf'
createTemplateIfMissing conf'
+ -- initialize state
+ initializeGititState conf'
+
let serverConf = Conf { validator = Nothing, port = portNumber conf' }
-- start the server
simpleHTTP serverConf $ msum [
Please sign in to comment.
Something went wrong with that request. Please try again.