bamboo 2009.4.25 → 2009.4.26
raw patch · 4 files changed
+73/−125 lines, 4 filesdep −hyenadep ~hack
Dependencies removed: hyena
Dependency ranges changed: hack
Files
- bamboo.cabal +2/−4
- changelog.md +7/−0
- readme.md +59/−116
- src/Bamboo.hs +5/−5
bamboo.cabal view
@@ -1,5 +1,5 @@ Name: bamboo-Version: 2009.4.25+Version: 2009.4.26 Build-type: Simple Synopsis: A simple blog engine on Hack Description: A simple blog engine on Hack@@ -15,7 +15,7 @@ library ghc-options: -Wall -fno-warn-missing-signatures -fno-warn-name-shadowing -fno-warn-orphans -fno-warn-type-defaults- build-depends: base, cgi, network, haskell98, old-locale, old-time, time, unix, bytestring, template, base64-string, zlib, directory, ansi-wl-pprint, hyena, filepath, containers, process, mps >= 2008.11.6, parsedate >= 3000.0.0, rss >= 3000.0.1, xhtml, kibro >= 0.4.2, utf8-string >= 0.3.3, pandoc, parsec >= 2, MissingH, gravatar >= 0.3, data-default >= 0.2, hcheat >= 2008.11.6, hack >= 2009.4.25+ build-depends: base, cgi, network, haskell98, old-locale, old-time, time, unix, bytestring, template, base64-string, zlib, directory, ansi-wl-pprint, filepath, containers, process, mps >= 2008.11.6, parsedate >= 3000.0.0, rss >= 3000.0.1, xhtml, kibro >= 0.4.2, utf8-string >= 0.3.3, pandoc, parsec >= 2, MissingH, gravatar >= 0.3, data-default >= 0.2, hcheat >= 2008.11.6, hack >= 2009.4.28 hs-source-dirs: src/ exposed-modules: Bamboo@@ -72,5 +72,3 @@ Bamboo.View.Widget.RSS Bamboo.View.Widget.Body Bamboo.View.Widget.Footer- -
changelog.md view
@@ -1,3 +1,10 @@+2009.4.26+----------++### Feature++* Handler is now configured at Main.hs+ 2009.4.25 ----------
readme.md view
@@ -1,10 +1,10 @@ # Bamboo: a simple blog engine on Hack -Bamboo is a port of [Panda](http://github.com/nfjinjing/panda/tree), but runs on top of Hack. All features except comment works out of box. I intend to reduce the code size and make the app more robust by using the benefit of middlewares available in [Hack](http://github.com/nfjinjing/hack/tree).+Bamboo is a port of [Panda](http://github.com/nfjinjing/panda/tree), but runs on top of Hack. It's an experimental project but quite portable. ## Features -### simple file structure+### plain text as data source db |---- blog@@ -18,7 +18,7 @@ |---- static |---- About -### simple config file+### simple config blog_title = C大调 blog_subtitle = 野猫不吃薯片@@ -30,10 +30,6 @@ sidebar = Blogroll.md favicon = bamboo_icon.png -### standard web technology--extend/customize with pure css and javascript ( note the custom part in css and js from the last section )- ### hacker friendly * posts are in plain text@@ -50,152 +46,99 @@ Or [browser](http://github.com/nfjinjing/jinjing-blog/tree/master) online +Note: This blog is using the Kibro handler. It's running under lighttpd and in fcgi. Definitely more robust, but require some set up work. + ### config [jinjing's blog config file](http://github.com/nfjinjing/jinjing-blog/blob/401a541443d88bbf8d844874c1473d4b3bc81784/config/site.txt) ## Install -### Quick setup+### With Hyena handler -#### install bamboo+#### update cabal - cabal update; cabal install bamboo+ cabal update+ +#### install hyena -### Install lighttpd 1.4.19 (used by kibro)+ git clone git://github.com/tibbe/hyena.git+ cd hyena+ cabal install - wget http://www.lighttpd.net/download/lighttpd-1.4.19.tar.gz- tar zxfv lighttpd-1.4.19.tar.gz- cd lighttpd-1.4.19- ./configure --prefix=$HOME- make- make install+#### install bamboo -#### bootstrap+ cabal install happy; cabal install rss; cabal install bamboo - # bamboo is a kibro project- kibro new myblog+#### get blog starter kit ( template )++ mkdir myblog cd myblog # get a template to start git clone git://github.com/nfjinjing/bamboo-template.git db- sh db/extra/scripts/bootstrap.sh -#### run-- kibro start--It should be running on [http://127.0.0.1:3000](http://127.0.0.1:3000) now.--Since Bamboo is based on Kibro, it helps to read how [Kibro](http://chrisdone.com/blog/tag/Kibro) works.--### Goodies--Install `Ruby` / `Rake`, then `rake -T` to see a list of helper commands.--### Config--Edit `db/config/site.txt`-- blog_title = My shiny blog- host_name = yourhost.com- author_email = your_mail@yourhost.com--Restart required. (hint: `rake r`)--## User's guide--### posts--All posts are placed in `db/blog` folder, with naming convention [yy-mm-dd title], in Markdown format by default.--Markdown supports embedding HTML snippets, so embedding youtube video is a peace of cake.--<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/rEYg0Dqtogg&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/rEYg0Dqtogg&hl=en&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>+#### create a entry point -You can create static pages, in `db/static`, and link to them via `/static/static_file_name` inside your blogs.--For example `db/static/About`, where you can put some profile in.--### tagging--Create a file in `db/tag`, the name of the file will be the name of the new tag.-edit the tag file, insert the full name of a blog post, e.g. `08-09-04 Welcome to Bamboo`--### html / tex / restructured text format--Just create the file in blog as usual with an extension (e.g. html, rst, tex ), and you are all set.--### customize navigation bar--see example in `config/site`:-- navigation = About, Gallery--Multiple renderer supported, use extension as hints.--Note, the navigation configuration requires the full name of your static page, so you should include extension in configuration as well.--### customize sidebar--see example in `config/site`, `config/sidebar/Blogroll.md`-- sidebar = Blogroll.md- -Sidebar items are html snippets plugged into view. You can create these plugins in multiple formats, use extension.--### styling--Styling is done by editing `public/theme/blueprint/css/custom.css`, see the default `custom.css` for inspiration.--### theming+put these into Main.hs+ + module Main where -New theme can be created without touching `Bamboo` code, example blueprint theme in `db/config/theme/blueprint.txt`+ import Bamboo+ import Hack.Handler.Hyena - container = container- header = column span-12 first- navigation = column span-12 first large- main = column span-9 first- sidebar = column span-3 last- footer = footer+ main = run bamboo+ + +#### run - css = screen, blueprint-wp, custom- js = jquery-1.2.6.min, jquery.getUrlParam, jquery.highlight-2, custom+ ghc --make -O2 Main.hs+ ./Main -These are custom class names for each element block.+It should be running on [http://127.0.0.1:3000](http://127.0.0.1:3000) now. -You can create new themes by adding theme definition files in `db/config/theme`, put theme resources under `db/public/theme/your_theme_name` and place+### With Kibro handler - theme = your_new_theme+#### update cabal -inside `site.txt`.+ cabal update -note: `css` and `js` are required to be placed under `db/public/theme/your_theme_name/css` and `db/public/theme/your_theme_name/js`, leave out the file extensions in `site.txt`.+#### install hyena -### syntax highlighting+ git clone git://github.com/tibbe/hyena.git+ cd hyena+ cabal install - <object - type="text/html" \- data="http://www.flickr.com/slideShow/index.gne \- ?user_id=56167317@N00&tags=cat-hack" \- width="500" height="500">- </object>+#### install bamboo -Highlight for `HTML` is enabled by default, see `public/theme/blueprint/js/custom.js` for more language support.+ cabal install happy; cabal install rss; cabal install bamboo -Highlight style is configured at `config/theme/blueprint.txt`, just change `highlight/default` to any css inside `theme/blueprint/css/highlight`.+### Install lighttpd 1.4.19 (used by kibro) + wget http://www.lighttpd.net/download/lighttpd-1.4.19.tar.gz+ tar zxfv lighttpd-1.4.19.tar.gz+ cd lighttpd-1.4.19+ ./configure --prefix=$HOME+ make+ make install -### analytics+#### bootstrap -Google analytics is available, put your `tracker_id` in `site.txt`, make sure `analytics` extension is used by adding `analytics` to the `extension` option.+ # bamboo is a kibro project+ kibro new myblog+ cd myblog+ + # get a template to start+ git clone git://github.com/nfjinjing/bamboo-template.git db+ sh db/extra/scripts/bootstrap.sh+ +#### run -### final note+ kibro start -try to use `<h3>` for heading in your posts, at least `wordpress` is using this convention. `<h1>` is not styled in the blueprint theme, so they look kind of unfitted. But this does not stop anyone from styling `<h1>, <h2>` if wished.+It should be running on [http://127.0.0.1:3000](http://127.0.0.1:3000) now. ## Links * [Hack](http://github.com/nfjinjing/hack/tree)-* [Kibro](http://chrisdone.com/blog/tag/Kibro) * [Source](http://github.com/nfjinjing/bamboo/tree)
src/Bamboo.hs view
@@ -10,7 +10,6 @@ import Bamboo.Controller.Application (paths) -import Hack.Handler.Hyena import Hack.Utils import Hack import Hack.Contrib.RawRouter@@ -21,7 +20,7 @@ import Hack.Contrib.File import Hack.Contrib.Static import Hack.Contrib.ShowStatus-import Hack.Contrib.Lucky+import Hack.Contrib.Lambda import qualified Hack.Contrib.Head as H @@ -48,14 +47,15 @@ -- dispatch -- static serve- , lucky+ , lambda , static (Just "db/public") ["/theme", "/images", "/plugin", "/favicon.ico"] -- real app , route paths ] + app = dummy_app .use middleware_stack -bamboo :: IO ()-bamboo = run app+bamboo :: Application+bamboo = app