Permalink
Browse files

Add custom css

  • Loading branch information...
bootstraponline committed Nov 8, 2012
1 parent 3a56f39 commit 7c4052906c255881ff71ce259230661fa9cccfe0
View
@@ -536,6 +536,14 @@ Note that filenames on windows must not contain any of the following characters
Gollum optionally takes a `--config file`. See [config.rb](https://github.com/github/gollum/blob/master/config.rb) for an example.
+## CUSTOM CSS
+
+The `--css` flag will inject `custom.css` from the root of your git repository into each page. Here's an example of floating the sidebar to the left.
+
+```css
+#wiki-rightbar { float: left !important; }
+```
+
## CONTRIBUTE
If you'd like to hack on Gollum, start by forking my repo on GitHub:
View
@@ -45,6 +45,10 @@ opts = OptionParser.new do |opts|
options['irb'] = true
end
+ opts.on("--css", "Inject custom css. Uses custom.css from root repository") do
+ wiki_options[:css] = true
+ end
+
opts.on("--page-file-dir [PATH]", "Specify the sub directory for all page files (default: repository root).") do |path|
wiki_options[:page_file_dir] = path
end
@@ -238,6 +238,7 @@ def wiki_new
@content = @page.formatted_data
@toc_content = wiki.universal_toc ? @page.toc_data : nil
@mathjax = wiki.mathjax
+ @css = wiki.css
@editable = false
mustache :page
end
@@ -360,6 +361,7 @@ def show_page_or_file(fullpath)
@content = page.formatted_data
@toc_content = wiki.universal_toc ? @page.toc_data : nil
@mathjax = wiki.mathjax
+ @css = wiki.css
mustache :page
elsif file = wiki.file(fullpath)
content_type file.mime_type
@@ -6,6 +6,7 @@
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/editor.css" media="all">
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/dialog.css" media="all">
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/template.css" media="all">
+ {{#css}}<link rel="stylesheet" type="text/css" href="/custom.css" media="all">{{/css}}
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/ie7.css" media="all">
@@ -80,6 +80,10 @@ def mathjax
@mathjax
end
+ def css # custom css
+ @css
+ end
+
# Access to embedded metadata.
#
# Examples
View
@@ -137,6 +137,10 @@ def history_sanitization
# Gets the boolean live preview value.
attr_reader :live_preview
+ # Injects custom css from custom.css in root repo.
+ # Defaults to false
+ attr_reader :css
+
# Public: Initialize a new Gollum Repo.
#
# path - The String path to the Git repository that holds the Gollum
@@ -191,6 +195,7 @@ def initialize(path, options = {})
@mathjax = options.fetch :mathjax, false
@show_all = options.fetch :show_all, false
@collapse_tree = options.fetch :collapse_tree, false
+ @css = options.fetch :css, false
end
# Public: check whether the wiki's git repo exists on the filesystem.

0 comments on commit 7c40529

Please sign in to comment.