Compare commits

...

40 Commits

Author SHA1 Message Date
Corey Donohoe d817a4fdb6 fixup page versioning, fixes #174
Thanks @nealpoole and @arr2036
2012-05-06 13:30:23 -07:00
Corey Donohoe 19635b06cf gemspec updates 2012-05-06 12:08:25 -07:00
Corey Donohoe 872776660b next version will be 2.0 2012-05-06 12:08:12 -07:00
Corey Donohoe 9644d4b00e dupe sanitization attrs initialized by constants, fixes #200 2012-05-06 12:07:41 -07:00
Corey Donohoe 9a1dddaccf whitelist apt uri schemes, fixes #233 2012-05-05 11:56:01 -07:00
Corey Donohoe 4110ab5a82 Merge pull request #308 from bootstraponline/title
Title defined by filename only.
2012-05-04 15:35:32 -07:00
Corey Donohoe 5d1844e491 Merge pull request #313 from kristi/frontend-tweak
Fix searchbar scaling issue
2012-05-04 09:44:23 -07:00
kristi 6a126d46ee Fix searchbar scaling issue 2012-05-04 09:35:27 -07:00
kristi f834a0c84f searchbar fix for ie9 2012-05-04 09:24:20 -07:00
Corey Donohoe 9dfeb237e7 Merge pull request #312 from kristi/frontend-tweak
searchbar fix for ie9
2012-05-04 09:21:45 -07:00
Corey Donohoe b769ba2974 Merge pull request #310 from kristi/frontend-tweak
Frontend tweaks
2012-05-04 08:32:17 -07:00
Corey Donohoe fc1feb280f let's use 0.8.0 if at all 2012-05-04 08:25:01 -07:00
Corey Donohoe bface83af7 Merge pull request #309 from nricciar/master
Gollum using very old version of wikicloth
2012-05-04 08:24:14 -07:00
Vicent Martí 2bea800a37 Proper ordering for markup processing, fixes #135
Code blocks get extracted first.
2012-05-02 18:53:41 -07:00
kristi 4c1ff7deb7 fixup the compare revisions page 2012-05-02 16:55:16 -07:00
kristi 5a7cb129bb Fixup css styling for pages, editor, history 2012-05-02 15:52:15 -07:00
kristi b29d22e99b Make navbar flow nicely for narrow windows 2012-05-02 13:51:26 -07:00
David 12cf102543 removing hardcoded reference to old version of wikicloth 2012-05-02 20:45:46 +00:00
kristi 3d95730880 Fix navbar and searchbar css 2012-05-02 13:00:46 -07:00
bootstraponline c5d807dd58 Fix tests. 2012-05-02 12:13:18 -06:00
bootstraponline d40df79dce Title defined by filename only. 2012-05-02 12:05:57 -06:00
Corey Donohoe 3cfa297b49 hide the page title as before 2012-05-02 19:29:17 +02:00
Corey Donohoe e435769345 remove executable bit 2012-05-02 19:20:57 +02:00
bootstraponline 9a73877b3e Fix search bar and restore title. 2012-05-02 11:03:37 -06:00
Corey Donohoe e2cd8d93f4 Merge pull request #306 from pdeschen/master
README Installation requirements sub section for mathematical equations support
2012-05-01 16:33:51 -07:00
Corey Donohoe afc6ec468f bit of testing info 2012-05-02 01:33:15 +02:00
Corey Donohoe 391838cfc3 no more rbx 2012-05-02 01:25:52 +02:00
Corey Donohoe 36a11ded4f Merge pull request #304 from rwfowler/asciidocLinksWithTravis
Disable internal link processing for asciidoc
2012-05-01 16:10:51 -07:00
Corey Donohoe f540ef2e06 Merge pull request #305 from rwfowler/goForGreen
Fix the test_normalizes_commit_hash on Travis-CI
2012-05-01 16:04:39 -07:00
Corey Donohoe b061e0f859 2.0 is unnecessary 2012-05-02 00:49:44 +02:00
Corey Donohoe 4972fbbc7b this doesn't build on 1.9.x /cc @brianmario 2012-05-02 00:44:17 +02:00
Pascal Deschenes 1f318de812 add missing note about dvips in installation requirements sub section + associated section text 2012-05-01 18:15:01 -04:00
Pascal Deschenes 0ceeadd75b add installation requirements regarding mathematical equations support 2012-05-01 18:10:21 -04:00
Ryan Fowler b9dad32707 Fix the test_normalizes_commit_hash on Travis-CI 2012-05-01 17:02:50 -05:00
Ryan Fowler d1cf698b45 Disable internal link processing for asciidoc
asciidoc's representation of section identifiers interferes with
Gollum's page linking. This disables Gollum's page link tag
extraction for asciidoc files.

Adds "apt-get install -y asciidoc" to .travis.yml so tests pass
on @travis-ci.
2012-05-01 14:23:26 -05:00
Corey Donohoe 9dba3f9c58 Revert "Merge pull request #303 from rwfowler/asciidocLinks"
This reverts commit 8fbbe40300, reversing
changes made to b7fb4c5950.
2012-05-01 19:51:05 +02:00
Corey Donohoe 8fbbe40300 Merge pull request #303 from rwfowler/asciidocLinks
Fix for #52 - Disable internal link processing for asciidoc
2012-05-01 10:42:31 -07:00
Ryan Fowler f73c925ad9 Disable internal link processing for asciidoc
asciidoc's representation of section identifiers interferes with
Gollum's page linking. This disables Gollum's page link tag
extraction for asciidoc files.
2012-05-01 11:43:27 -05:00
Corey Donohoe b7fb4c5950 Merge pull request #302 from kristi/master
fix Rack config.ru documentation
2012-05-01 02:32:07 -07:00
kristi fed49bb98b Fix gollum_path in rack setup documentation 2012-05-01 01:37:17 -07:00
21 changed files with 154 additions and 108 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
rvm: rvm:
- 1.8.7 - 1.8.7
- 1.9.2
- rbx-2.0
notifications: notifications:
disabled: true disabled: true
before_install:
- sudo apt-get install -y asciidoc
+13
View File
@@ -311,6 +311,7 @@ backticks.
## MATHEMATICAL EQUATIONS ## MATHEMATICAL EQUATIONS
Page files may contain mathematic equations in TeX syntax that will be nicely Page files may contain mathematic equations in TeX syntax that will be nicely
typeset into the expected output. A block-style equation is delimited by `\[` typeset into the expected output. A block-style equation is delimited by `\[`
and `\]`. For example: and `\]`. For example:
@@ -322,6 +323,13 @@ inline with regular text. For example:
The Pythagorean theorem is \( a^2 + b^2 = c^2 \). The Pythagorean theorem is \( a^2 + b^2 = c^2 \).
### INSTALLATION REQUIREMENTS
In order to get the mathematical equations rendering to work, you need the following binaries:
* LaText, TeTex or MacTex/BasicTeX (latex, dvips)
* ImageMagick (convert)
* Ghostscript (gs)
## SEQUENCE DIAGRAMS ## SEQUENCE DIAGRAMS
@@ -454,9 +462,14 @@ like Rack::Auth, OmniAuth, etc.
require 'gollum/frontend/app' require 'gollum/frontend/app'
gollum_path = File.expand_path(File.dirname(__FILE__)) # CHANGE THIS TO POINT TO YOUR OWN WIKI REPO gollum_path = File.expand_path(File.dirname(__FILE__)) # CHANGE THIS TO POINT TO YOUR OWN WIKI REPO
Precious::App.set(:gollum_path, gollum_path)
Precious::App.set(:default_markup, :markdown) # set your favorite markup language Precious::App.set(:default_markup, :markdown) # set your favorite markup language
run Precious::App run Precious::App
## Testing
[![Build Status](https://secure.travis-ci.org/github/gollum.png?branch=master)](http://travis-ci.org/github/gollum)
## CONTRIBUTE ## CONTRIBUTE
If you'd like to hack on Gollum, start by forking my repo on GitHub: If you'd like to hack on Gollum, start by forking my repo on GitHub:
+3 -3
View File
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
s.rubygems_version = '1.3.5' s.rubygems_version = '1.3.5'
s.name = 'gollum' s.name = 'gollum'
s.version = '1.4.3' s.version = '2.0.0'
s.date = '2012-04-25' s.date = '2012-05-06'
s.rubyforge_project = 'gollum' s.rubyforge_project = 'gollum'
s.summary = "A simple, Git-powered wiki." s.summary = "A simple, Git-powered wiki."
@@ -37,7 +37,7 @@ Gem::Specification.new do |s|
s.add_development_dependency('org-ruby', '~>0.6.2') s.add_development_dependency('org-ruby', '~>0.6.2')
s.add_development_dependency('shoulda') s.add_development_dependency('shoulda')
s.add_development_dependency('rack-test') s.add_development_dependency('rack-test')
s.add_development_dependency('wikicloth', '~> 0.6.3') s.add_development_dependency('wikicloth', '~>0.8.0')
s.add_development_dependency('rake', '~> 0.9.2') s.add_development_dependency('rake', '~> 0.9.2')
# = MANIFEST = # = MANIFEST =
+1 -1
View File
@@ -21,7 +21,7 @@ require File.expand_path('../gollum/tex', __FILE__)
require File.expand_path('../gollum/web_sequence_diagram', __FILE__) require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
module Gollum module Gollum
VERSION = '1.4.3' VERSION = '2.0.0'
def self.assets_path def self.assets_path
::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__)) ::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
+1
View File
@@ -47,6 +47,7 @@ module Precious
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options) wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
if page = wiki.page(@name) if page = wiki.page(@name)
@page = page @page = page
@page.version = wiki.repo.log(wiki.ref, @page.path).first
@content = page.raw_data @content = page.raw_data
mustache :edit mustache :edit
else else
@@ -30,6 +30,7 @@ a {
-webkit-border-radius: 1em; -webkit-border-radius: 1em;
} }
.ff #gollum-editor,
.ie #gollum-editor { .ie #gollum-editor {
padding-bottom: 1em; padding-bottom: 1em;
} }
@@ -51,9 +52,9 @@ a {
background: #fff; background: #fff;
border: 1px solid #ddd; border: 1px solid #ddd;
color: #000; color: #000;
font-size: 1.3em; font-size: 1.1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
line-height: 1.8em; line-height: 1.5em;
margin: 1em 0 0.4em; margin: 1em 0 0.4em;
padding: 0.5em; padding: 0.5em;
width: 98%; width: 98%;
@@ -192,44 +193,36 @@ a#function-help:hover span { background-position: -405px -28px; }
#gollum-editor #gollum-editor-function-bar #gollum-editor-format-selector { #gollum-editor #gollum-editor-function-bar #gollum-editor-format-selector {
overflow: hidden; overflow: hidden;
padding: 0 0 1.1em 0; padding: .2em 0 .5em 0;
} }
#gollum-editor #gollum-editor-function-bar #gollum-editor #gollum-editor-function-bar
#gollum-editor-format-selector select { #gollum-editor-format-selector select {
background-color: #f9f9f9; background-color: #f9f9f9;
border: 1px solid transparent; border: 1px solid #ddd;
color: #333;
float: right; float: right;
font-size: 1.1em; font-size: 1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: bold; font-weight: bold;
line-height: 1.6em; line-height: 1.6em;
padding: 0.5em 0.7em; padding: 0.3em 0.4em;
margin-bottom: 0;
border-radius: 0.5em; border-radius: 0.5em;
-moz-border-radius: 0.5em; -moz-border-radius: 0.5em;
-webkit-border-radius: 0.5em; -webkit-border-radius: 0.5em;
-moz-outline: none;
}
#gollum-editor #gollum-editor-function-bar
#gollum-editor-format-selector select:hover {
background-color: #fff;
border: 1px solid #ddd;
-moz-outline: none;
} }
#gollum-editor #gollum-editor-function-bar #gollum-editor #gollum-editor-function-bar
#gollum-editor-format-selector label { #gollum-editor-format-selector label {
color: #999; color: #999;
float: right; float: right;
font-size: 1.1em; font-size: 1em;
font-weight: bold; font-weight: bold;
line-height: 1.6em; line-height: 1.6em;
padding: 0.6em 0.5em 0 0; padding: .3em 0.5em 0 0;
} }
#gollum-editor #gollum-editor-function-bar #gollum-editor #gollum-editor-function-bar
@@ -243,9 +236,9 @@ a#function-help:hover span { background-position: -405px -28px; }
#gollum-editor textarea#gollum-editor-body { #gollum-editor textarea#gollum-editor-body {
background: #fff; background: #fff;
border: 1px solid #ddd; border: 1px solid #ddd;
font-size: 1.3em; font-size: 1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
line-height: 1.8em; line-height: 1.4em;
margin: 1em 0 0.4em; margin: 1em 0 0.4em;
padding: 0.5em; /* I don't really like mixing pct & em here… */ padding: 0.5em; /* I don't really like mixing pct & em here… */
width: 98%; width: 98%;
@@ -259,7 +252,7 @@ a#function-help:hover span { background-position: -405px -28px; }
cursor: pointer; cursor: pointer;
display: block; display: block;
float: left; float: left;
font-size: 1.2em; font-size: 1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: bold; font-weight: bold;
margin: 0; margin: 0;
@@ -403,7 +396,7 @@ a#function-help:hover span { background-position: -405px -28px; }
color: #333; color: #333;
cursor: pointer; cursor: pointer;
display: block; display: block;
font-size: 1.2em; font-size: 1em;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: bold; font-weight: bold;
line-height: 1.2em; line-height: 1.2em;
@@ -37,13 +37,13 @@ a:hover, a:visited {
/* @section head */ /* @section head */
#head { #head {
border-bottom: 1px solid #ddd;
margin: 4.5em 0 0.5em; margin: 4.5em 0 0.5em;
padding: 0.5em 0;
overflow: hidden; overflow: hidden;
} }
#head h1 { #head h1 {
display: none; display: none;
} }
#head ul.actions { #head ul.actions {
@@ -142,6 +142,7 @@ a:hover, a:visited {
} }
/* @section footer */ /* @section footer */
#wiki-footer { #wiki-footer {
clear: both; clear: both;
margin: 2em 0 5em; margin: 2em 0 5em;
@@ -208,6 +209,7 @@ a:hover, a:visited {
/* @section page-footer */ /* @section page-footer */
.page #footer { .page #footer {
border-top: 1px solid #ddd;
margin: 1em 0 7em; margin: 1em 0 7em;
} }
@@ -235,12 +237,12 @@ a:hover, a:visited {
} }
#wiki-history { #wiki-history {
margin-top: 3em; margin-top: 2em;
} }
#wiki-history fieldset { #wiki-history fieldset {
border: 0; border: 0;
margin: 2em 0; margin: 1em 0;
padding: 0; padding: 0;
} }
@@ -262,14 +264,14 @@ a:hover, a:visited {
#wiki-history table tr td { #wiki-history table tr td {
border: 1px solid #c0dce9; border: 1px solid #c0dce9;
font-size: 1.2em; font-size: 1em;
line-height: 1.6em; line-height: 1.6em;
margin: 0; margin: 0;
padding: 0.3em 0.7em; padding: 0.3em 0.7em;
} }
#wiki-history table tr td.checkbox { #wiki-history table tr td.checkbox {
min-width: 2em; width: 4em;
padding: 0.3em; padding: 0.3em;
} }
@@ -278,7 +280,9 @@ a:hover, a:visited {
display: block; display: block;
padding-right: 0; padding-right: 0;
padding-top: 0.4em; padding-top: 0.4em;
margin-right: -0.2em; margin: 0 auto;
width: 1.2em;
height: 1.2em;
} }
#wiki-history table tr:nth-child(2n), #wiki-history table tr:nth-child(2n),
@@ -331,6 +335,10 @@ a:hover, a:visited {
padding: 0 0.2em; padding: 0 0.2em;
} }
.history #footer {
margin-bottom: 7em;
}
.history #wiki-history ul.actions li, .history #wiki-history ul.actions li,
.history #footer ul.actions li { .history #footer ul.actions li {
margin: 0 0.6em 0 0; margin: 0 0.6em 0 0;
@@ -410,10 +418,14 @@ a:hover, a:visited {
.compare .data { .compare .data {
border: 1px solid #ddd; border: 1px solid #ddd;
margin-top: 1em; margin: 1em 0 2em;
overflow: auto; overflow: auto;
} }
.compare .data table {
width: 100%;
}
.compare .data pre { .compare .data pre {
margin: 0; margin: 0;
padding: 0; padding: 0;
@@ -426,11 +438,15 @@ a:hover, a:visited {
.compare .data tr td { .compare .data tr td {
font-family: "Consolas", "Monaco", "Andale Mono", "Courier New", monospace; font-family: "Consolas", "Monaco", "Andale Mono", "Courier New", monospace;
font-size: 1.2em; font-size: 1.2em;
line-height: 1.8em; line-height: 1.2em;
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
.compare .data tr td + td + td {
width: 100%;
}
.compare .data td.line_numbers { .compare .data td.line_numbers {
background: #f7f7f7; background: #f7f7f7;
border-right: 1px solid #999; border-right: 1px solid #999;
@@ -444,6 +460,10 @@ a:hover, a:visited {
margin-right: 0.6em; margin-right: 0.6em;
} }
.compare #footer {
margin-bottom: 7em;
}
/* @control syntax */ /* @control syntax */
@@ -481,8 +501,9 @@ ul.actions {
ul.actions li { ul.actions li {
float: left; float: left;
font-size: 1.2em; font-size: 0.9em;
margin-left: 0.6em; margin-left: 0.6em;
margin-bottom: 0.6em;
} }
.minibutton a { .minibutton a {
@@ -586,7 +607,6 @@ ul.actions {
/* @control searchbar */ /* @control searchbar */
#head #searchbar { #head #searchbar {
float: right; float: right;
margin: 1em 0 0 0;
padding: 0; padding: 0;
overflow: hidden; overflow: hidden;
} }
@@ -595,6 +615,7 @@ ul.actions {
background: #fff; background: #fff;
border: 1px solid #d4d4d4; border: 1px solid #d4d4d4;
overflow: hidden; overflow: hidden;
height: 2.2em;
border-radius: 0.3em; border-radius: 0.3em;
-moz-border-radius: 0.3em; -moz-border-radius: 0.3em;
@@ -606,18 +627,15 @@ ul.actions {
color: #000; color: #000;
float: left; float: left;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 1.2em; font-size: 1em;
height: 1.8em; height: inherit;
padding: 0 .5em;
-webkit-focus-ring: none; -webkit-focus-ring: none;
} }
.ff #head #searchbar #searchbar-fauxtext input#search-query { .ie8 #head #searchbar #searchbar-fauxtext input#search-query {
padding: 0.2em 0 0.2em 0.5em; padding: 0.5em 0 0 0.5em;
}
.ie #head #searchbar #searchbar-fauxtext input#search-query {
padding: 0.4em 0 0 0.5em;
} }
#head #searchbar #searchbar-fauxtext input#search-query.ph { #head #searchbar #searchbar-fauxtext input#search-query.ph {
@@ -631,7 +649,7 @@ ul.actions {
margin: 0 !important; margin: 0 !important;
padding: 0; padding: 0;
float: right; float: right;
font-size: 1.2em; height: inherit;
border-radius: 0 3px 3px 0; border-radius: 0 3px 3px 0;
-moz-border-radius: 0 3px 3px 0; -moz-border-radius: 0 3px 3px 0;
@@ -643,7 +661,7 @@ ul.actions {
background-position: -431px -1px; background-position: -431px -1px;
background-repeat: no-repeat; background-repeat: no-repeat;
display: block; display: block;
height: 2em; height: inherit;
overflow: hidden; overflow: hidden;
text-indent: -5000px; text-indent: -5000px;
width: 28px; width: 28px;
@@ -10,7 +10,7 @@
html, body { html, body {
color: black; color: #333;
} }
body { body {
@@ -24,7 +24,7 @@ img {
#template { #template {
font-size: 14px; font-size: 14px;
line-height: 1.4; line-height: 1.6;
margin-bottom: 40px; margin-bottom: 40px;
} }
@@ -35,7 +35,7 @@ a.absent {
/* Primary Body Copy */ /* Primary Body Copy */
#template p { #template p {
margin: 1em 0; margin: 1.4em 0;
padding: 0; padding: 0;
} }
@@ -52,17 +52,17 @@ a.absent {
} }
#template h1 { #template h1 {
border-bottom: 1px solid #ccc; font-size: 28px;
font-size: 33px; /* was 32, GH is 33px */
line-height: normal; line-height: normal;
padding: .08em 0 0 0; padding: 10px 0 0 0;
margin: 0; margin: 30px 0 10px;
} }
#template h2 { #template h2 {
border-bottom: 1px solid #ddd;
font-size: 22px; font-size: 22px;
line-height: normal; line-height: 1.6;
margin: 22px 0 0; margin: 22px 0 10px;
padding: 7px 0 0; padding: 7px 0 0;
} }
@@ -110,16 +110,16 @@ a.absent {
/* Border Reset for headers with horizontal rules */ /* Border Reset for headers with horizontal rules */
#template > h2:first-child, #template > h2:first-child,
#template > h1:first-child { #template > h1:first-child {
margin: 12px 0 0; margin: 12px 0 10px;
padding: 10px 0 0; padding: 10px 0 10px;
} }
/* Lists, Blockquotes & Such */ /* Lists, Blockquotes & Such */
#template ul, #template ul,
#template ol { #template ol {
margin-top: 1.5em; margin: 15px 0;
margin-left: 2.6em; padding-left: 30px;
} }
/* Nested Lists */ /* Nested Lists */
@@ -132,7 +132,7 @@ a.absent {
#template ul ul, #template ul ul,
#template ol ol { #template ol ol {
padding: 0; padding: 0;
margin: .5em 0; margin: 15px 0;
} }
#template dl { #template dl {
@@ -286,7 +286,7 @@ a.absent {
background-color: #f8f8f8; background-color: #f8f8f8;
border: 1px solid #dedede; border: 1px solid #dedede;
font-size: 13px; font-size: 13px;
padding: 0; padding: 1px 5px;
-moz-border-radius: 3px; -moz-border-radius: 3px;
-webkit-border-radius: 3px; -webkit-border-radius: 3px;
@@ -313,6 +313,7 @@ pre, code {
#template pre code, #template pre tt { #template pre code, #template pre tt {
background-color: transparent; background-color: transparent;
border: none; border: none;
padding: 0;
} }
/* /*
+12 -2
View File
@@ -3,10 +3,16 @@
<h1>History for <strong>{{path}}</strong></h1> <h1>History for <strong>{{path}}</strong></h1>
<ul class="actions"> <ul class="actions">
<li class="minibutton">
{{>searchbar}}
</li>
<li class="minibutton"><a href="/{{escaped_name}}"
class="action-view-page">View Page</a></li>
<li class="minibutton"><a href="/edit/{{escaped_name}}"
class="action-edit-page">Edit Page</a></li>
<li class="minibutton"><a href="/history/{{escaped_name}}" <li class="minibutton"><a href="/history/{{escaped_name}}"
class="action-page-history">Back to Page History</a></li> class="action-page-history">Page History</a></li>
</ul> </ul>
{{>searchbar}}
</div> </div>
{{#message}} {{#message}}
@@ -17,6 +23,8 @@
{{#show_revert}} {{#show_revert}}
<ul class="actions"> <ul class="actions">
<li class="minibutton"><a href="/history/{{escaped_name}}"
class="action-page-history">Back to Page History</a></li>
<li class="minibutton"> <li class="minibutton">
<form name="gollum-revert" action="/revert/{{escaped_name}}/{{before}}/{{after}}" method="post" id="gollum-revert-form"> <form name="gollum-revert" action="/revert/{{escaped_name}}/{{before}}/{{after}}" method="post" id="gollum-revert-form">
<a href="#" class="gollum-revert-button">Revert Changes</a> <a href="#" class="gollum-revert-button">Revert Changes</a>
@@ -41,6 +49,8 @@
</div> </div>
<div id="footer"> <div id="footer">
<ul class="actions"> <ul class="actions">
<li class="minibutton"><a href="/history/{{escaped_name}}"
class="action-page-history">Back to Page History</a></li>
{{#show_revert}} {{#show_revert}}
<li class="minibutton"> <li class="minibutton">
<a href="#" class="gollum-revert-button">Revert Changes</a> <a href="#" class="gollum-revert-button">Revert Changes</a>
View File
+3 -1
View File
@@ -2,12 +2,14 @@
<div id="head"> <div id="head">
<h1>History for <strong>{{title}}</strong></h1> <h1>History for <strong>{{title}}</strong></h1>
<ul class="actions"> <ul class="actions">
<li class="minibutton">
{{>searchbar}}
</li>
<li class="minibutton"><a href="/{{escaped_name}}" <li class="minibutton"><a href="/{{escaped_name}}"
class="action-view-page">View Page</a></li> class="action-view-page">View Page</a></li>
<li class="minibutton"><a href="/edit/{{escaped_name}}" <li class="minibutton"><a href="/edit/{{escaped_name}}"
class="action-edit-page">Edit Page</a></li> class="action-edit-page">Edit Page</a></li>
</ul> </ul>
{{>searchbar}}
</div> </div>
<div id="wiki-history"> <div id="wiki-history">
View File
+3 -1
View File
@@ -2,6 +2,9 @@
<div id="head"> <div id="head">
<h1>{{title}}</h1> <h1>{{title}}</h1>
<ul class="actions"> <ul class="actions">
<li class="minibutton">
{{>searchbar}}
</li>
<li class="minibutton"><a href="/pages" <li class="minibutton"><a href="/pages"
class="action-all-pages">All Pages</a></li> class="action-all-pages">All Pages</a></li>
<li class="minibutton" class="jaws"> <li class="minibutton" class="jaws">
@@ -13,7 +16,6 @@
<li class="minibutton"><a href="/history/{{escaped_name}}" <li class="minibutton"><a href="/history/{{escaped_name}}"
class="action-page-history">Page History</a></li> class="action-page-history">Page History</a></li>
</ul> </ul>
{{>searchbar}}
</div> </div>
<div id="wiki-content"> <div id="wiki-content">
<div class="wrap {{#has_footer}} has-footer {{/has_footer}} {{#has_sidebar}} has-rightbar{{/has_sidebar}}"> <div class="wrap {{#has_footer}} has-footer {{/has_footer}} {{#has_sidebar}} has-rightbar{{/has_sidebar}}">
+3 -1
View File
@@ -2,10 +2,12 @@
<div id="head"> <div id="head">
<h1>{{title}}</h1> <h1>{{title}}</h1>
<ul class="actions"> <ul class="actions">
<li class="minibutton">
{{>searchbar}}
</li>
<li class="minibutton"><a href="/" <li class="minibutton"><a href="/"
class="action-edit-page">Home</a></li> class="action-edit-page">Home</a></li>
</ul> </ul>
{{>searchbar}}
</div> </div>
<div id="results"> <div id="results">
@@ -2,10 +2,12 @@
<div id="head"> <div id="head">
<h1>Search Results for <strong>{{query}}</strong></h1> <h1>Search Results for <strong>{{query}}</strong></h1>
<ul class="actions"> <ul class="actions">
<li class="minibutton">
{{>searchbar}}
</li>
<li class="minibutton"><a href="/" <li class="minibutton"><a href="/"
class="action-edit-page">Home</a></li> class="action-edit-page">Home</a></li>
</ul> </ul>
{{>searchbar}}
</div> </div>
<div id="results"> <div id="results">
+5 -1
View File
@@ -38,8 +38,9 @@ module Gollum
@wiki.history_sanitizer : @wiki.history_sanitizer :
@wiki.sanitizer @wiki.sanitizer
data = extract_tex(@data.dup) data = @data.dup
data = extract_code(data) data = extract_code(data)
data = extract_tex(data)
data = extract_wsd(data) data = extract_wsd(data)
data = extract_tags(data) data = extract_tags(data)
begin begin
@@ -116,6 +117,9 @@ module Gollum
# #
# Returns the placeholder'd String data. # Returns the placeholder'd String data.
def extract_tags(data) def extract_tags(data)
if @format == :asciidoc
return data
end
data.gsub!(/(.?)\[\[(.+?)\]\]([^\[]?)/m) do data.gsub!(/(.?)\[\[(.+?)\]\]([^\[]?)/m) do
if $1 == "'" && $3 != "'" if $1 == "'" && $3 != "'"
"[[#{$2}]]#{$3}" "[[#{$2}]]#{$3}"
+2 -24
View File
@@ -124,35 +124,13 @@ module Gollum
self.class.canonicalize_filename(filename) self.class.canonicalize_filename(filename)
end end
# Public: If the first element of a formatted page is an <h1> tag it can # Public: The title will be constructed from the
# be considered the title of the page and used in the display. If the
# first element is NOT an <h1> tag, the title will be constructed from the
# filename by stripping the extension and replacing any dashes with # filename by stripping the extension and replacing any dashes with
# spaces. # spaces.
# #
# Returns the fully sanitized String title. # Returns the fully sanitized String title.
def title def title
doc = Nokogiri::HTML(%{<div id="gollum-root">} + self.formatted_data + %{</div>}) header = Sanitize.clean(name).strip
header =
case self.format
when :asciidoc
doc.css("div#gollum-root > div#header > h1:first-child")
when :org
doc.css("div#gollum-root > p.title:first-child")
when :pod
doc.css("div#gollum-root > a.dummyTopAnchor:first-child + h1")
when :rest
doc.css("div#gollum-root > div > div > h1:first-child")
else
doc.css("div#gollum-root > h1:first-child")
end
if !header.empty?
Sanitize.clean(header.to_html)
else
Sanitize.clean(name)
end.strip
end end
# Public: The path of the page within the repo. # Public: The path of the page within the repo.
+6 -6
View File
@@ -43,7 +43,7 @@ module Gollum
# Default whitelisted protocols for URLs. # Default whitelisted protocols for URLs.
PROTOCOLS = { PROTOCOLS = {
'a' => {'href' => ['http', 'https', 'mailto', 'ftp', 'irc', :relative]}, 'a' => {'href' => ['http', 'https', 'mailto', 'ftp', 'irc', 'apt', :relative]},
'img' => {'src' => ['http', 'https', :relative]} 'img' => {'src' => ['http', 'https', :relative]}
}.freeze }.freeze
@@ -120,12 +120,12 @@ module Gollum
attr_writer :allow_comments attr_writer :allow_comments
def initialize def initialize
@elements = ELEMENTS @elements = ELEMENTS.dup
@attributes = ATTRIBUTES @attributes = ATTRIBUTES.dup
@protocols = PROTOCOLS @protocols = PROTOCOLS.dup
@transformers = TRANSFORMERS @transformers = TRANSFORMERS.dup
@add_attributes = {} @add_attributes = {}
@remove_contents = REMOVE_CONTENTS @remove_contents = REMOVE_CONTENTS.dup
@allow_comments = false @allow_comments = false
@id_prefix = 'wiki-' @id_prefix = 'wiki-'
yield self if block_given? yield self if block_given?
+2 -2
View File
@@ -8,8 +8,8 @@ context "Wiki" do
test "normalizes commit hash" do test "normalizes commit hash" do
commit = {:message => 'abc'} commit = {:message => 'abc'}
name = @wiki.repo.config['user.name'] name = @wiki.repo.config['user.name'] || @wiki.default_committer_name
email = @wiki.repo.config['user.email'] email = @wiki.repo.config['user.email'] || @wiki.default_committer_email
committer = Gollum::Committer.new(@wiki, commit) committer = Gollum::Committer.new(@wiki, commit)
assert_equal name, committer.actor.name assert_equal name, committer.actor.name
assert_equal email, committer.actor.email assert_equal email, committer.actor.email
+20
View File
@@ -495,6 +495,13 @@ np.array([[2,2],[1,3]],np.float)
compare(content, output) compare(content, output)
end end
test "allows apt uri schemes" do
content = "[Hack me](apt:gettext)"
output = "<p><a href=\"apt:gettext\">Hackme</a></p>"
compare(content, output)
end
test "removes style blocks completely" do test "removes style blocks completely" do
content = "<style>body { color: red }</style>foobar" content = "<style>body { color: red }</style>foobar"
output = "<p>foobar</p>" output = "<p>foobar</p>"
@@ -588,6 +595,19 @@ np.array([[2,2],[1,3]],np.float)
compare(content, output, 'md') compare(content, output, 'md')
end end
#########################################################################
# Asciidoc
#########################################################################
test "asciidoc header" do
compare("= Book Title\n\n== Heading", '<div class="sect1"><h2 id="wiki-_heading">Heading</h2><div class="sectionbody"></div></div>', 'asciidoc')
end
test "internal links with asciidoc" do
compare("= Book Title\n\n[[anid]]\n== Heading", '<div class="sect1"><h2 id="wiki-anid">Heading</h2><div class="sectionbody"></div></div>', 'asciidoc')
end
######################################################################### #########################################################################
# #
# Helpers # Helpers
+3 -3
View File
@@ -104,12 +104,12 @@ context "Page" do
assert_equal 'My Precious', page.title assert_equal 'My Precious', page.title
end end
test "title from h1 with normal contents" do test "title from filename with normal contents" do
page = @wiki.page('Home') page = @wiki.page('Home')
assert_equal "The LOTR Wiki", page.title assert_equal "Home", page.title
end end
test "title from h1 with html contents" do test "title from filename with html contents" do
page = @wiki.page('Eye Of Sauron') page = @wiki.page('Eye Of Sauron')
assert_equal "Eye Of Sauron", page.title assert_equal "Eye Of Sauron", page.title
end end