Compare commits
55 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| df75d2d60c | |||
| 2713aabeaf | |||
| 796d1b44c2 | |||
| 470a7b8f52 | |||
| f699b82a9f | |||
| 44edb8c7da | |||
| bc4fc0edd9 | |||
| 6545fa691b | |||
| 4954553927 | |||
| 9c50ba9eeb | |||
| 9a67da145a | |||
| ca7d82278c | |||
| f6245c53dd | |||
| 6888420cc6 | |||
| c5631f5b7d | |||
| 34e0b49d72 | |||
| bd072264ef | |||
| cfb2d24c71 | |||
| fe0eb72fa3 | |||
| 2783257f06 | |||
| cc11cb866c | |||
| 6a02643bda | |||
| 7f269c8da3 | |||
| ef7f7cebd1 | |||
| 05c24fd5e3 | |||
| b08b97bd28 | |||
| dbb6ce2f71 | |||
| f66f14b593 | |||
| 8a52315dee | |||
| 7c4052906c | |||
| 3a56f39f6a | |||
| 6585ca5dd0 | |||
| 792abae07e | |||
| 74ce648c59 | |||
| 2686e96046 | |||
| 213e2bb432 | |||
| 79bb5c10ab | |||
| 7ea012d786 | |||
| 43591f75de | |||
| 05d82c0569 | |||
| 76c8d3206c | |||
| 00751d05b4 | |||
| b5be5df11a | |||
| 7d159273fc | |||
| 70127922ab | |||
| b95df93775 | |||
| dc06edcf5b | |||
| fdc437dcd5 | |||
| f6873c9612 | |||
| 93754ab32d | |||
| 5759334635 | |||
| f2f543b72d | |||
| 598b052be3 | |||
| a746062422 | |||
| c8868d369f |
@@ -0,0 +1,25 @@
|
|||||||
|
# https://help.github.com/articles/dealing-with-line-endings
|
||||||
|
# Set default behaviour, in case users don't have core.autocrlf set.
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
# Explicitly declare text files we want to always be normalized and converted
|
||||||
|
# to native line endings on checkout.
|
||||||
|
*.txt text
|
||||||
|
*.md text
|
||||||
|
*.rb text
|
||||||
|
*.js text
|
||||||
|
*.html text
|
||||||
|
*.yml text
|
||||||
|
*.mustache text
|
||||||
|
*.css text
|
||||||
|
Rakefile text
|
||||||
|
Gemfile text
|
||||||
|
LICENSE text
|
||||||
|
COPYRIGHT text
|
||||||
|
gollum text
|
||||||
|
.gitattributes text
|
||||||
|
.gitignore text
|
||||||
|
|
||||||
|
# Denote all files that are truly binary and should not be modified.
|
||||||
|
*.png binary
|
||||||
|
*.jpg binary
|
||||||
@@ -136,7 +136,13 @@ or JavaScript. These tags will be stripped from the converted HTML. See
|
|||||||
`docs/sanitization.md` for more details on what tags and attributes are
|
`docs/sanitization.md` for more details on what tags and attributes are
|
||||||
allowed.
|
allowed.
|
||||||
|
|
||||||
|
## TITLES
|
||||||
|
|
||||||
|
The first defined `h1` will override the default header on a page. There are two ways to set a page title. The metadata syntax:
|
||||||
|
|
||||||
|
`<!-- --- title: New Title -->`
|
||||||
|
|
||||||
|
The first `h1` tag can be set to always override the page title, without needing to use the metadata syntax. Start gollum with the `--h1-title` flag.
|
||||||
## BRACKET TAGS
|
## BRACKET TAGS
|
||||||
|
|
||||||
A variety of Gollum tags use a double bracket syntax. For example:
|
A variety of Gollum tags use a double bracket syntax. For example:
|
||||||
@@ -381,10 +387,10 @@ You may imbed sequence diagrams into your wiki page (rendered by
|
|||||||
[WebSequenceDiagrams](http://www.websequencediagrams.com) by using the
|
[WebSequenceDiagrams](http://www.websequencediagrams.com) by using the
|
||||||
following syntax:
|
following syntax:
|
||||||
|
|
||||||
{{{ blue-modern
|
{{{{{{ blue-modern
|
||||||
alice->bob: Test
|
alice->bob: Test
|
||||||
bob->alice: Test response
|
bob->alice: Test response
|
||||||
}}}
|
}}}}}}
|
||||||
|
|
||||||
You can replace the string "blue-modern" with any supported style.
|
You can replace the string "blue-modern" with any supported style.
|
||||||
|
|
||||||
@@ -532,9 +538,17 @@ Your Rack middleware can pass author details to Gollum in a Hash in the session
|
|||||||
## WINDOWS FILENAME VALIDATION
|
## WINDOWS FILENAME VALIDATION
|
||||||
Note that filenames on windows must not contain any of the following characters `\ / : * ? " < > |`. See [this support article](http://support.microsoft.com/kb/177506) for details.
|
Note that filenames on windows must not contain any of the following characters `\ / : * ? " < > |`. See [this support article](http://support.microsoft.com/kb/177506) for details.
|
||||||
|
|
||||||
## LIB.SO ERROR
|
## CONFIG FILE
|
||||||
|
|
||||||
`Could not open library 'lib.so'` may be solved by installing `python-devel` on Fedora or `python-dev` on Ubuntu. Gentoo requires a rubypython [patch](https://gist.github.com/2802480) to use python2.7.
|
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. `custom.css` must be commited to git or you will get a 302 redirect to the create page. Here's an example of floating the sidebar to the left.
|
||||||
|
|
||||||
|
```css
|
||||||
|
#wiki-rightbar { float: left !important; }
|
||||||
|
```
|
||||||
|
|
||||||
## CONTRIBUTE
|
## CONTRIBUTE
|
||||||
|
|
||||||
@@ -556,6 +570,8 @@ your changes merged back into core is as follows:
|
|||||||
1. Send a pull request to the github/gollum project.
|
1. Send a pull request to the github/gollum project.
|
||||||
|
|
||||||
## RELEASING
|
## RELEASING
|
||||||
|
x.y.z
|
||||||
|
|
||||||
For z releases:
|
For z releases:
|
||||||
$ rake bump
|
$ rake bump
|
||||||
$ rake release
|
$ rake release
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ task :gemspec => :validate do
|
|||||||
split("\n").
|
split("\n").
|
||||||
sort.
|
sort.
|
||||||
reject { |file| file =~ /^\./ }.
|
reject { |file| file =~ /^\./ }.
|
||||||
reject { |file| file =~ /^(rdoc|pkg|test|Home\.md)/ }.
|
reject { |file| file =~ /^(rdoc|pkg|test|Home\.md|\.gitattributes)/ }.
|
||||||
map { |file| " #{file}" }.
|
map { |file| " #{file}" }.
|
||||||
join("\n")
|
join("\n")
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,10 @@ opts = OptionParser.new do |opts|
|
|||||||
options['irb'] = true
|
options['irb'] = true
|
||||||
end
|
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|
|
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
|
wiki_options[:page_file_dir] = path
|
||||||
end
|
end
|
||||||
@@ -76,6 +80,9 @@ opts = OptionParser.new do |opts|
|
|||||||
opts.on("--collapse-tree", "Collapse file view tree. By default, expanded tree is shown.") do
|
opts.on("--collapse-tree", "Collapse file view tree. By default, expanded tree is shown.") do
|
||||||
wiki_options[:collapse_tree] = true
|
wiki_options[:collapse_tree] = true
|
||||||
end
|
end
|
||||||
|
opts.on("--h1-title", "Sets page title to value of first h1") do
|
||||||
|
wiki_options[:h1_title] = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Read command line options into `options` hash
|
# Read command line options into `options` hash
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# Example gollum config
|
||||||
|
# gollum ../wiki --config config.rb
|
||||||
|
#
|
||||||
|
# or run from source with
|
||||||
|
#
|
||||||
|
# bundle exec bin/gollum ../wiki/ --config config.rb
|
||||||
|
|
||||||
|
# Remove const to avoid
|
||||||
|
# warning: already initialized constant FORMAT_NAMES
|
||||||
|
#
|
||||||
|
# only remove if it's defined.
|
||||||
|
# constant Gollum::Page::FORMAT_NAMES not defined (NameError)
|
||||||
|
Gollum::Page.send :remove_const, :FORMAT_NAMES if defined? Gollum::Page::FORMAT_NAMES
|
||||||
|
# limit to one format
|
||||||
|
Gollum::Page::FORMAT_NAMES = { :markdown => "Markdown" }
|
||||||
|
|
||||||
|
=begin
|
||||||
|
Valid formats are:
|
||||||
|
{ :markdown => "Markdown",
|
||||||
|
:textile => "Textile",
|
||||||
|
:rdoc => "RDoc",
|
||||||
|
:org => "Org-mode",
|
||||||
|
:creole => "Creole",
|
||||||
|
:rest => "reStructuredText",
|
||||||
|
:asciidoc => "AsciiDoc",
|
||||||
|
:mediawiki => "MediaWiki",
|
||||||
|
:pod => "Pod" }
|
||||||
|
=end
|
||||||
+3
-2
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
|
|||||||
s.required_ruby_version = ">= 1.8.7"
|
s.required_ruby_version = ">= 1.8.7"
|
||||||
|
|
||||||
s.name = 'gollum'
|
s.name = 'gollum'
|
||||||
s.version = '2.3.4'
|
s.version = '2.4.0'
|
||||||
s.date = '2012-10-28'
|
s.date = '2012-11-11'
|
||||||
s.rubyforge_project = 'gollum'
|
s.rubyforge_project = 'gollum'
|
||||||
|
|
||||||
s.summary = "A simple, Git-powered wiki."
|
s.summary = "A simple, Git-powered wiki."
|
||||||
@@ -53,6 +53,7 @@ Gem::Specification.new do |s|
|
|||||||
README.md
|
README.md
|
||||||
Rakefile
|
Rakefile
|
||||||
bin/gollum
|
bin/gollum
|
||||||
|
config.rb
|
||||||
docs/sanitization.md
|
docs/sanitization.md
|
||||||
gollum.gemspec
|
gollum.gemspec
|
||||||
lib/gollum.rb
|
lib/gollum.rb
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
|
|||||||
require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
|
require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
|
||||||
|
|
||||||
module Gollum
|
module Gollum
|
||||||
VERSION = '2.3.4'
|
VERSION = '2.4.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__))
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ module Gollum
|
|||||||
def new_page page
|
def new_page page
|
||||||
name = page.name
|
name = page.name
|
||||||
url = url_for_page page
|
url = url_for_page page
|
||||||
%Q( <li class="file"><a href="#{url}">#{name}</a></li>\n)
|
%Q( <li class="file"><a href="#{url}"><span class="icon"></span>#{name}</a></li>)
|
||||||
end
|
end
|
||||||
|
|
||||||
def new_folder folder_path
|
def new_folder folder_path
|
||||||
@@ -38,10 +38,7 @@ module Gollum
|
|||||||
end
|
end
|
||||||
|
|
||||||
def end_folder
|
def end_folder
|
||||||
<<-HTML
|
"</ol></li>\n"
|
||||||
</ol>
|
|
||||||
</li>
|
|
||||||
HTML
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def url_for_page page
|
def url_for_page page
|
||||||
@@ -85,13 +82,11 @@ module Gollum
|
|||||||
# Handle special case of only one folder.
|
# Handle special case of only one folder.
|
||||||
if (count - folder_start == 1)
|
if (count - folder_start == 1)
|
||||||
page = @pages[ folder_start ]
|
page = @pages[ folder_start ]
|
||||||
name = page.name
|
|
||||||
url = url_for_page page
|
|
||||||
html += <<-HTML
|
html += <<-HTML
|
||||||
<li>
|
<li>
|
||||||
<label>#{::File.dirname(page.path)}</label> <input type="checkbox" #{@checked} />
|
<label>#{::File.dirname(page.path)}</label> <input type="checkbox" #{@checked} />
|
||||||
<ol>
|
<ol>
|
||||||
<li class="file"><a href="#{url}">#{name}</a></li>
|
#{new_page page}
|
||||||
</ol>
|
</ol>
|
||||||
</li>
|
</li>
|
||||||
HTML
|
HTML
|
||||||
|
|||||||
@@ -238,6 +238,8 @@ module Precious
|
|||||||
@content = @page.formatted_data
|
@content = @page.formatted_data
|
||||||
@toc_content = wiki.universal_toc ? @page.toc_data : nil
|
@toc_content = wiki.universal_toc ? @page.toc_data : nil
|
||||||
@mathjax = wiki.mathjax
|
@mathjax = wiki.mathjax
|
||||||
|
@css = wiki.css
|
||||||
|
@h1_title = wiki.h1_title
|
||||||
@editable = false
|
@editable = false
|
||||||
mustache :page
|
mustache :page
|
||||||
end
|
end
|
||||||
@@ -306,7 +308,8 @@ module Precious
|
|||||||
get '/search' do
|
get '/search' do
|
||||||
@query = params[:q]
|
@query = params[:q]
|
||||||
wiki = wiki_new
|
wiki = wiki_new
|
||||||
@results = wiki.search @query
|
# Sort wiki search results by count (desc) and then by name (asc)
|
||||||
|
@results = wiki.search(@query).sort{ |a, b| (a[:count] <=> b[:count]).nonzero? || b[:name] <=> a[:name] }.reverse
|
||||||
@name = @query
|
@name = @query
|
||||||
mustache :search
|
mustache :search
|
||||||
end
|
end
|
||||||
@@ -359,6 +362,8 @@ module Precious
|
|||||||
@content = page.formatted_data
|
@content = page.formatted_data
|
||||||
@toc_content = wiki.universal_toc ? @page.toc_data : nil
|
@toc_content = wiki.universal_toc ? @page.toc_data : nil
|
||||||
@mathjax = wiki.mathjax
|
@mathjax = wiki.mathjax
|
||||||
|
@css = wiki.css
|
||||||
|
@h1_title = wiki.h1_title
|
||||||
mustache :page
|
mustache :page
|
||||||
elsif file = wiki.file(fullpath)
|
elsif file = wiki.file(fullpath)
|
||||||
content_type file.mime_type
|
content_type file.mime_type
|
||||||
|
|||||||
@@ -1,121 +1,128 @@
|
|||||||
*, html {
|
*, html {
|
||||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
#results a:hover {
|
#results a:hover {
|
||||||
background-color: #4c4c4c;
|
background-color: #4c4c4c;
|
||||||
}
|
}
|
||||||
|
|
||||||
#home_button {
|
#home_button {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#home_button .minibutton {
|
#home_button .minibutton {
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
#results {
|
#results {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 60px;
|
top: 60px;
|
||||||
left: 10px;
|
left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
body, form, ul, li, p, h1, h2, h3, h4, h5 {
|
body, form, ul, li, p, h1, h2, h3, h4, h5 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: #606061;
|
background-color: #606061;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
margin: 0 0 1em 0;
|
margin: 0 0 1em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
html { font-size: 100%; /* IE hack */ }
|
html { font-size: 100%; /* IE hack */ }
|
||||||
body { font-size: 1em; /* Sets base font size to 16px */ }
|
body { font-size: 1em; /* Sets base font size to 16px */ }
|
||||||
table { font-size: 100%; /* IE hack */ }
|
table { font-size: 100%; /* IE hack */ }
|
||||||
input, select, textarea, th, td { font-size: 1em; }
|
input, select, textarea, th, td { font-size: 1em; }
|
||||||
|
|
||||||
/* Prevent wrapping on large file names. */
|
/* Prevent wrapping on large file names. */
|
||||||
li.file {
|
li.file {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CSS Tree menu styles */
|
/* CSS Tree menu styles */
|
||||||
ol.tree
|
ol.tree
|
||||||
{
|
{
|
||||||
padding: 0 0 0 30px;
|
padding: 0 0 0 30px;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
}
|
}
|
||||||
li
|
li
|
||||||
{
|
{
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-left: -15px;
|
margin-left: -15px;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
li.file
|
li.file
|
||||||
{
|
{
|
||||||
margin-left: -1px !important;
|
margin-left: -1px !important;
|
||||||
height: 1.5em;
|
height: 1.5em;
|
||||||
}
|
}
|
||||||
li.file a
|
li.file a
|
||||||
{
|
{
|
||||||
background: url(../images/fileview/document.png) 0 0 no-repeat;
|
color: #fff;
|
||||||
color: #fff;
|
text-decoration: none;
|
||||||
padding-left: 21px;
|
display: inline-block;
|
||||||
text-decoration: none;
|
}
|
||||||
display: block;
|
li.file a span.icon
|
||||||
}
|
{
|
||||||
li.file a[href *= '.pdf'] { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
width: 14px;
|
||||||
li.file a[href *= '.html'] { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
height: 18px;
|
||||||
li.file a[href $= '.css'] { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
background: url(../images/fileview/document.png) 0 0 no-repeat;
|
||||||
li.file a[href $= '.js'] { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
display: inline-block;
|
||||||
li input
|
margin-right: 7px;
|
||||||
{
|
vertical-align: text-top;
|
||||||
position: absolute;
|
}
|
||||||
left: 0;
|
li.file a[href *= '.pdf'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
||||||
margin-left: 0;
|
li.file a[href *= '.html'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
||||||
opacity: 0;
|
li.file a[href $= '.css'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
||||||
z-index: 2;
|
li.file a[href $= '.js'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
|
||||||
cursor: pointer;
|
li input
|
||||||
height: 1em;
|
{
|
||||||
width: 1em;
|
position: absolute;
|
||||||
top: 0;
|
left: 0;
|
||||||
}
|
margin-left: 0;
|
||||||
li input + ol
|
opacity: 0;
|
||||||
{
|
z-index: 2;
|
||||||
background: url(../images/fileview/toggle-small-expand.png) 40px 0 no-repeat;
|
cursor: pointer;
|
||||||
margin: -1.188em 0 0 -44px; /* 15px */
|
height: 1em;
|
||||||
height: 1.5em;
|
width: 1em;
|
||||||
}
|
top: 0;
|
||||||
li input + ol > li { display: none; margin-left: -14px !important; padding-left: 1px; }
|
}
|
||||||
li label
|
li input + ol
|
||||||
{
|
{
|
||||||
background: url(../images/fileview/folder-horizontal.png) 15px 1px no-repeat;
|
background: url(../images/fileview/toggle-small-expand.png) 40px 0 no-repeat;
|
||||||
cursor: pointer;
|
margin: -1.188em 0 0 -44px; /* 15px */
|
||||||
display: block;
|
height: 1.5em;
|
||||||
padding-left: 37px;
|
}
|
||||||
}
|
li input + ol > li { display: none; margin-left: -14px !important; padding-left: 1px; }
|
||||||
|
li label
|
||||||
li input:checked + ol
|
{
|
||||||
{
|
background: url(../images/fileview/folder-horizontal.png) 15px 1px no-repeat;
|
||||||
background: url(../images/fileview/toggle-small.png) 40px 5px no-repeat;
|
cursor: pointer;
|
||||||
margin: -1.5em 0 0 -44px; /* 20px */
|
display: block;
|
||||||
padding: 1.563em 0 0 80px;
|
padding-left: 37px;
|
||||||
height: auto;
|
}
|
||||||
}
|
|
||||||
li input:checked + ol > li { display: block; margin: 0 0 0.125em; /* 2px */}
|
li input:checked + ol
|
||||||
li input:checked + ol > li:last-child { margin: 0 0 0.063em; /* 1px */ }
|
{
|
||||||
|
background: url(../images/fileview/toggle-small.png) 40px 5px no-repeat;
|
||||||
|
margin: -1.5em 0 0 -44px; /* 20px */
|
||||||
|
padding: 1.563em 0 0 80px;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
li input:checked + ol > li { display: block; margin: 0 0 0.125em; /* 2px */}
|
||||||
|
li input:checked + ol > li:last-child { margin: 0 0 0.063em; /* 1px */ }
|
||||||
|
|
||||||
|
|||||||
@@ -212,4 +212,20 @@ $(document).ready(function() {
|
|||||||
$('#gollum-revert-form').submit();
|
$('#gollum-revert-form').submit();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( $('#wiki-wrapper.edit').length ){
|
||||||
|
$("#gollum-editor-submit").click( function() { window.onbeforeunload = null; } );
|
||||||
|
$("#gollum-editor-body").one('change', function(){
|
||||||
|
window.onbeforeunload = function(){ return "Leaving will discard all edits!" };
|
||||||
|
});
|
||||||
|
$.GollumEditor();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( $('#wiki-wrapper.create').length ){
|
||||||
|
$("#gollum-editor-submit").click( function() { window.onbeforeunload = null; } );
|
||||||
|
$("#gollum-editor-body").one('change', function(){
|
||||||
|
window.onbeforeunload = function(){ return "Leaving will not create a new page!" };
|
||||||
|
});
|
||||||
|
$.GollumEditor({ NewFile: true, MarkupType: default_markup });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -108,8 +108,9 @@ $.save = function( commitMessage ) {
|
|||||||
var msg = defaultCommitMessage();
|
var msg = defaultCommitMessage();
|
||||||
var newLocation = baseUrl;
|
var newLocation = baseUrl;
|
||||||
|
|
||||||
|
// Remove all duplicate slashes
|
||||||
function clean( str ) {
|
function clean( str ) {
|
||||||
return str.replace(/^\/+/, '/');
|
return str.replace(/\/+/g, '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 'a%2Fb' => a/b
|
// 'a%2Fb' => a/b
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div id="wiki-wrapper">
|
<div id="wiki-wrapper" class="create">
|
||||||
<div id="head">
|
<div id="head">
|
||||||
<h1>Create New Page</h1>
|
<h1>Create New Page</h1>
|
||||||
</div>
|
</div>
|
||||||
@@ -9,12 +9,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.onbeforeunload = function(){ return "Leaving will not create a new page!" };
|
var default_markup = '{{default_markup}}';
|
||||||
$("#gollum-editor-submit").click( function() { window.onbeforeunload = null; } );
|
|
||||||
|
|
||||||
jQuery(document).ready(function() {
|
|
||||||
$.GollumEditor({ NewFile: true, MarkupType: '{{default_markup}}' });
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{{something}}
|
{{something}}
|
||||||
|
|||||||
@@ -10,11 +10,3 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="wiki-content">{{>editor}}</div>
|
<div id="wiki-content">{{>editor}}</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
|
||||||
window.onbeforeunload = function(){ return "Leaving will discard all edits!" };
|
|
||||||
$("#gollum-editor-submit").click( function() { window.onbeforeunload = null; } );
|
|
||||||
|
|
||||||
jQuery(document).ready(function() {
|
|
||||||
$.GollumEditor();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|||||||
@@ -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/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/dialog.css" media="all">
|
||||||
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/template.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="{{base_url}}/custom.css" media="all">{{/css}}
|
||||||
|
|
||||||
<!--[if IE 7]>
|
<!--[if IE 7]>
|
||||||
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/ie7.css" media="all">
|
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/ie7.css" media="all">
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Mousetrap.bind(['e'], function( e ) {
|
|||||||
</script>
|
</script>
|
||||||
<div id="wiki-wrapper" class="page">
|
<div id="wiki-wrapper" class="page">
|
||||||
<div id="head">
|
<div id="head">
|
||||||
<h1>{{title}}</h1>
|
<h1>{{page_header}}</h1>
|
||||||
<ul class="actions">
|
<ul class="actions">
|
||||||
<li class="minibutton">
|
<li class="minibutton">
|
||||||
{{>searchbar}}
|
{{>searchbar}}
|
||||||
|
|||||||
@@ -8,7 +8,16 @@ module Precious
|
|||||||
DEFAULT_AUTHOR = 'you'
|
DEFAULT_AUTHOR = 'you'
|
||||||
|
|
||||||
def title
|
def title
|
||||||
@page.url_path.gsub("-", " ")
|
h1 = @h1_title ? page_header_from_content(@content) : false
|
||||||
|
h1 || @page.url_path_title
|
||||||
|
end
|
||||||
|
|
||||||
|
def page_header
|
||||||
|
page_header_from_content(@content) || title
|
||||||
|
end
|
||||||
|
|
||||||
|
def content
|
||||||
|
content_without_page_header(@content)
|
||||||
end
|
end
|
||||||
|
|
||||||
def author
|
def author
|
||||||
@@ -80,6 +89,10 @@ module Precious
|
|||||||
@mathjax
|
@mathjax
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def css # custom css
|
||||||
|
@css
|
||||||
|
end
|
||||||
|
|
||||||
# Access to embedded metadata.
|
# Access to embedded metadata.
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
@@ -90,6 +103,48 @@ module Precious
|
|||||||
def metadata
|
def metadata
|
||||||
@page.metadata
|
@page.metadata
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
# Wraps page formatted data to Nokogiri::HTML document.
|
||||||
|
#
|
||||||
|
def build_document(content)
|
||||||
|
Nokogiri::HTML(%{<div id="gollum-root">} + content + %{</div>})
|
||||||
|
end
|
||||||
|
|
||||||
|
# Finds header node inside Nokogiri::HTML document.
|
||||||
|
#
|
||||||
|
def find_header_node(doc)
|
||||||
|
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
|
||||||
|
end
|
||||||
|
|
||||||
|
# Extracts title from page if present.
|
||||||
|
#
|
||||||
|
def page_header_from_content(content)
|
||||||
|
doc = build_document(content)
|
||||||
|
title = find_header_node(doc)
|
||||||
|
Sanitize.clean(title.to_html).strip unless title.empty?
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns page content without title if it was extracted.
|
||||||
|
#
|
||||||
|
def content_without_page_header(content)
|
||||||
|
doc = build_document(content)
|
||||||
|
title = find_header_node(doc)
|
||||||
|
title.remove unless title.empty?
|
||||||
|
doc.css("div#gollum-root").inner_html
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -488,8 +488,10 @@ module Gollum
|
|||||||
# extract lang from { .ruby } or { #stuff .ruby .indent }
|
# extract lang from { .ruby } or { #stuff .ruby .indent }
|
||||||
# see http://johnmacfarlane.net/pandoc/README.html#delimited-code-blocks
|
# see http://johnmacfarlane.net/pandoc/README.html#delimited-code-blocks
|
||||||
|
|
||||||
lang = lang.match(/\.([^}\s]+)/)
|
if lang
|
||||||
lang = lang[1] unless lang.nil?
|
lang = lang.match(/\.([^}\s]+)/)
|
||||||
|
lang = lang[1] unless lang.nil?
|
||||||
|
end
|
||||||
|
|
||||||
@codemap[id] = cached ?
|
@codemap[id] = cached ?
|
||||||
{ :output => cached } :
|
{ :output => cached } :
|
||||||
|
|||||||
+22
-1
@@ -168,6 +168,27 @@ module Gollum
|
|||||||
path
|
path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Public: Defines title for page.rb
|
||||||
|
#
|
||||||
|
# Returns the String title
|
||||||
|
def url_path_title
|
||||||
|
metadata_title || url_path.gsub("-", " ")
|
||||||
|
end
|
||||||
|
|
||||||
|
# Public: Metadata title
|
||||||
|
#
|
||||||
|
# Set with <!-- --- title: New Title --> in page content
|
||||||
|
#
|
||||||
|
# Returns the String title or nil if not defined
|
||||||
|
def metadata_title
|
||||||
|
if metadata
|
||||||
|
title = metadata['title']
|
||||||
|
return title unless title.nil?
|
||||||
|
end
|
||||||
|
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
# Public: The url_path, but CGI escaped.
|
# Public: The url_path, but CGI escaped.
|
||||||
#
|
#
|
||||||
# Returns the String url_path
|
# Returns the String url_path
|
||||||
@@ -221,7 +242,7 @@ module Gollum
|
|||||||
# Public: Embedded metadata.
|
# Public: Embedded metadata.
|
||||||
#
|
#
|
||||||
# Returns Hash of metadata.
|
# Returns Hash of metadata.
|
||||||
def meta_data()
|
def metadata()
|
||||||
formatted_data if markup_class.metadata == nil
|
formatted_data if markup_class.metadata == nil
|
||||||
markup_class.metadata
|
markup_class.metadata
|
||||||
end
|
end
|
||||||
|
|||||||
+35
-20
@@ -137,6 +137,14 @@ module Gollum
|
|||||||
# Gets the boolean live preview value.
|
# Gets the boolean live preview value.
|
||||||
attr_reader :live_preview
|
attr_reader :live_preview
|
||||||
|
|
||||||
|
# Injects custom css from custom.css in root repo.
|
||||||
|
# Defaults to false
|
||||||
|
attr_reader :css
|
||||||
|
|
||||||
|
# Sets page title to value of first h1
|
||||||
|
# Defaults to false
|
||||||
|
attr_reader :h1_title
|
||||||
|
|
||||||
# Public: Initialize a new Gollum Repo.
|
# Public: Initialize a new Gollum Repo.
|
||||||
#
|
#
|
||||||
# path - The String path to the Git repository that holds the Gollum
|
# path - The String path to the Git repository that holds the Gollum
|
||||||
@@ -166,26 +174,33 @@ module Gollum
|
|||||||
options[:access] = path
|
options[:access] = path
|
||||||
path = path.path
|
path = path.path
|
||||||
end
|
end
|
||||||
@path = path
|
|
||||||
@repo_is_bare = options[:repo_is_bare]
|
# Use .fetch instead of ||
|
||||||
@page_file_dir = options[:page_file_dir]
|
#
|
||||||
@access = options[:access] || GitAccess.new(path, @page_file_dir, @repo_is_bare)
|
# o = { :a => false }
|
||||||
@base_path = options[:base_path] || "/"
|
# o[:a] || true # => true
|
||||||
@page_class = options[:page_class] || self.class.page_class
|
# o.fetch :a, true # => false
|
||||||
@file_class = options[:file_class] || self.class.file_class
|
|
||||||
@markup_classes = options[:markup_classes] || self.class.markup_classes
|
@path = path
|
||||||
@repo = @access.repo
|
@repo_is_bare = options.fetch :repo_is_bare, nil
|
||||||
@ref = options[:ref] || self.class.default_ref
|
@page_file_dir = options.fetch :page_file_dir, nil
|
||||||
@sanitization = options[:sanitization] || self.class.sanitization
|
@access = options.fetch :access, GitAccess.new(path, @page_file_dir, @repo_is_bare)
|
||||||
@ws_subs = options[:ws_subs] ||
|
@base_path = options.fetch :base_path, "/"
|
||||||
self.class.default_ws_subs
|
@page_class = options.fetch :page_class, self.class.page_class
|
||||||
@history_sanitization = options[:history_sanitization] ||
|
@file_class = options.fetch :file_class, self.class.file_class
|
||||||
self.class.history_sanitization
|
@markup_classes = options.fetch :markup_classes, self.class.markup_classes
|
||||||
@live_preview = options.fetch(:live_preview, true)
|
@repo = @access.repo
|
||||||
@universal_toc = options.fetch(:universal_toc, false)
|
@ref = options.fetch :ref, self.class.default_ref
|
||||||
@mathjax = options[:mathjax] || false
|
@sanitization = options.fetch :sanitization, self.class.sanitization
|
||||||
@show_all = options[:show_all] || false
|
@ws_subs = options.fetch :ws_subs, self.class.default_ws_subs
|
||||||
@collapse_tree = options[:collapse_tree] || false
|
@history_sanitization = options.fetch :history_sanitization, self.class.history_sanitization
|
||||||
|
@live_preview = options.fetch :live_preview, true
|
||||||
|
@universal_toc = options.fetch :universal_toc, false
|
||||||
|
@mathjax = options.fetch :mathjax, false
|
||||||
|
@show_all = options.fetch :show_all, false
|
||||||
|
@collapse_tree = options.fetch :collapse_tree, false
|
||||||
|
@css = options.fetch :css, false
|
||||||
|
@h1_title = options.fetch :h1_title, false
|
||||||
end
|
end
|
||||||
|
|
||||||
# Public: check whether the wiki's git repo exists on the filesystem.
|
# Public: check whether the wiki's git repo exists on the filesystem.
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
For gollum code, everything should fall under the existing MIT License.
|
||||||
|
Alternative permissive licenses (such as BSD) for 3rd party dependencies are
|
||||||
|
acceptable. For image assets in Gollum, CC BY or CC BY-SA is fine. Anything
|
||||||
|
released under a copyleft license (for example GPL, AGPL, LGPL, MPL, EPL,
|
||||||
|
etc.) is not permitted in gollum. Public domain, CC BY or CC BY-SA for code in
|
||||||
|
gollum is not permitted.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
The following PNGs are based on Ubuntu 11.10 SVG files located in /usr/share/icons/unity-icon-theme/places/svg/
|
The following PNGs are based on Ubuntu 11.10 SVG files located in /usr/share/icons/unity-icon-theme/places/svg/
|
||||||
- group-folders.svg
|
- group-folders.svg
|
||||||
- group-files.svg
|
- group-files.svg
|
||||||
|
|||||||
@@ -5,3 +5,4 @@ a8ad3c09dd842a3517085bfadd37718856dee813 1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e
|
|||||||
b16b3d9fad9d78e5a669e7f33d94c96da374eccd b0de6e794dfdc7ef3400e894225bfe23308aae5c kristi <kristi.dev@gmail.com> 1336984025 -0700 push
|
b16b3d9fad9d78e5a669e7f33d94c96da374eccd b0de6e794dfdc7ef3400e894225bfe23308aae5c kristi <kristi.dev@gmail.com> 1336984025 -0700 push
|
||||||
b0de6e794dfdc7ef3400e894225bfe23308aae5c cfea406f5f77afc7fb673a43e97721234385b1bd Darren Oakley <daz.oakley@gmail.com> 1341830099 +0100 push
|
b0de6e794dfdc7ef3400e894225bfe23308aae5c cfea406f5f77afc7fb673a43e97721234385b1bd Darren Oakley <daz.oakley@gmail.com> 1341830099 +0100 push
|
||||||
cfea406f5f77afc7fb673a43e97721234385b1bd 629aa678272b017a4d136d35e77ac94d80b08dc2 Darren Oakley <daz.oakley@gmail.com> 1341830833 +0100 push
|
cfea406f5f77afc7fb673a43e97721234385b1bd 629aa678272b017a4d136d35e77ac94d80b08dc2 Darren Oakley <daz.oakley@gmail.com> 1341830833 +0100 push
|
||||||
|
629aa678272b017a4d136d35e77ac94d80b08dc2 7d6aeab8b84c895f21f6c66b84a457b0fced9693 Daniel Kimsey <dekimsey@ufl.edu> 1352501984 -0500 push
|
||||||
|
|||||||
@@ -5,3 +5,4 @@ a8ad3c09dd842a3517085bfadd37718856dee813 1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e
|
|||||||
b16b3d9fad9d78e5a669e7f33d94c96da374eccd b0de6e794dfdc7ef3400e894225bfe23308aae5c kristi <kristi.dev@gmail.com> 1336984025 -0700 push
|
b16b3d9fad9d78e5a669e7f33d94c96da374eccd b0de6e794dfdc7ef3400e894225bfe23308aae5c kristi <kristi.dev@gmail.com> 1336984025 -0700 push
|
||||||
b0de6e794dfdc7ef3400e894225bfe23308aae5c cfea406f5f77afc7fb673a43e97721234385b1bd Darren Oakley <daz.oakley@gmail.com> 1341830099 +0100 push
|
b0de6e794dfdc7ef3400e894225bfe23308aae5c cfea406f5f77afc7fb673a43e97721234385b1bd Darren Oakley <daz.oakley@gmail.com> 1341830099 +0100 push
|
||||||
cfea406f5f77afc7fb673a43e97721234385b1bd 629aa678272b017a4d136d35e77ac94d80b08dc2 Darren Oakley <daz.oakley@gmail.com> 1341830833 +0100 push
|
cfea406f5f77afc7fb673a43e97721234385b1bd 629aa678272b017a4d136d35e77ac94d80b08dc2 Darren Oakley <daz.oakley@gmail.com> 1341830833 +0100 push
|
||||||
|
629aa678272b017a4d136d35e77ac94d80b08dc2 7d6aeab8b84c895f21f6c66b84a457b0fced9693 Daniel Kimsey <dekimsey@ufl.edu> 1352501984 -0500 push
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,2 @@
|
|||||||
|
xE�OK1Å=÷S<ëEaºz’EYð ]¼g·™™`¦•´3ê··ã<åù½—4ps}{¶=!gtä;°ö.„{w��ZNѹSÄ<g‹È=^eáYµCN¼vêȘdëlV¶²6³Æ6
|
||||||
|
ã‰$q„$÷"1*&«c«!µ`?J?¼Á“$š�)øwšµ®°·JV|¿&!æ‰}ç²Áï´)�<Ò—«þ¦cýƒHÐ s:²Õf£C»dŸõC8ah.Jß³qªˆl²P•ܤ›·ÿÁ§¶ï”«�s¿³6gú
|
||||||
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
x�Î=j1@áÔ:Åt®ô?cC\ù³šY¼Ú
|
||||||
@@ -1 +1 @@
|
|||||||
629aa678272b017a4d136d35e77ac94d80b08dc2
|
7d6aeab8b84c895f21f6c66b84a457b0fced9693
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
<ol class="tree">
|
<ol class="tree">
|
||||||
<li class="file"><a href="0">0</a></li>
|
<li class="file">
|
||||||
</ol>
|
<a href="0"><span class="icon"></span>0</a>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<ol class="tree">
|
<ol class="tree">
|
||||||
<li>
|
<li>
|
||||||
<label>folder0</label> <input type="checkbox" checked />
|
<label>folder0</label>
|
||||||
<ol>
|
<input type="checkbox" />
|
||||||
<li class="file"><a href="folder0/0">0</a></li>
|
<ol>
|
||||||
</ol>
|
<li class="file">
|
||||||
</li>
|
<a href="folder0/0"><span class="icon"></span>0</a>
|
||||||
</ol>
|
</li>
|
||||||
|
</ol>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<ol class="tree">
|
<ol class="tree">
|
||||||
<li>
|
<li>
|
||||||
<label>.</label> <input type="checkbox" checked />
|
<label>.</label>
|
||||||
<ol>
|
<input type="checkbox" />
|
||||||
<li class="file"><a href="folder0">folder0</a></li>
|
<ol>
|
||||||
</ol>
|
<li class="file">
|
||||||
</li>
|
<a href="folder0"><span class="icon"></span>folder0</a>
|
||||||
</ol>
|
</li>
|
||||||
|
</ol>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
|||||||
@@ -1,12 +1,20 @@
|
|||||||
<ol class="tree">
|
<ol class="tree">
|
||||||
<li>
|
<li>
|
||||||
<label>folder0</label> <input type="checkbox" checked />
|
<label>folder0</label>
|
||||||
<ol>
|
<input type="checkbox" />
|
||||||
<li class="file"><a href="folder0/0">0</a></li>
|
<ol>
|
||||||
</ol>
|
<li class="file">
|
||||||
|
<a href="folder0/0"><span class="icon"></span>0</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
</ol>
|
||||||
<label>folder1</label> <input type="checkbox" checked />
|
</li>
|
||||||
<ol>
|
<li>
|
||||||
<li class="file"><a href="folder1/1">1</a></li>
|
<label>folder1</label>
|
||||||
</ol>
|
<input type="checkbox" />
|
||||||
|
<ol>
|
||||||
|
<li class="file">
|
||||||
|
<a href="folder1/1"><span class="icon"></span>1</a>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
|||||||
@@ -1,13 +1,23 @@
|
|||||||
<ol class="tree">
|
<ol class="tree">
|
||||||
<li class="file"><a href="root">root</a></li>
|
<li class="file">
|
||||||
<li>
|
<a href="root"><span class="icon"></span>root</a>
|
||||||
<label>folder0</label> <input type="checkbox" checked />
|
</li>
|
||||||
<ol>
|
<li>
|
||||||
<li class="file"><a href="folder0/0">0</a></li>
|
<label>folder0</label>
|
||||||
</ol>
|
<input type="checkbox" />
|
||||||
|
<ol>
|
||||||
|
<li class="file">
|
||||||
|
<a href="folder0/0"><span class="icon"></span>0</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
</ol>
|
||||||
<label>folder1</label> <input type="checkbox" checked />
|
</li>
|
||||||
<ol>
|
<li>
|
||||||
<li class="file"><a href="folder1/1">1</a></li>
|
<label>folder1</label>
|
||||||
</ol>
|
<input type="checkbox" />
|
||||||
|
<ol>
|
||||||
|
<li class="file">
|
||||||
|
<a href="folder1/1"><span class="icon"></span>1</a>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
|||||||
@@ -1,28 +1,41 @@
|
|||||||
<ol class="tree">
|
<ol class="tree">
|
||||||
|
<li>
|
||||||
|
<label>folder0</label>
|
||||||
|
<input type="checkbox" />
|
||||||
|
<ol>
|
||||||
<li>
|
<li>
|
||||||
<label>folder0</label> <input type="checkbox" checked />
|
<label>folder1</label>
|
||||||
|
<input type="checkbox" />
|
||||||
<ol>
|
<ol>
|
||||||
<li>
|
<li>
|
||||||
<label>folder1</label> <input type="checkbox" checked />
|
<label>folder2</label>
|
||||||
<ol>
|
<input type="checkbox" />
|
||||||
<li>
|
<ol>
|
||||||
<label>folder2</label> <input type="checkbox" checked />
|
<li class="file">
|
||||||
<ol>
|
<a href="folder0/folder1/folder2/0"><span class="icon"></span>0</a>
|
||||||
<li class="file"><a href="folder0/folder1/folder2/0">0</a></li>
|
</li>
|
||||||
|
</ol>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label>folder3</label>
|
||||||
|
<input type="checkbox" />
|
||||||
|
<ol>
|
||||||
|
<li class="file">
|
||||||
|
<a href="folder0/folder1/folder3/1"><span class="icon"></span>1</a>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
</ol>
|
||||||
<label>folder3</label> <input type="checkbox" checked />
|
</li>
|
||||||
<ol>
|
<li>
|
||||||
<li class="file"><a href="folder0/folder1/folder3/1">1</a></li>
|
<label>folder4</label>
|
||||||
</ol>
|
<input type="checkbox" />
|
||||||
|
<ol>
|
||||||
|
<li class="file">
|
||||||
|
<a href="folder4/2"><span class="icon"></span>2</a>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label>folder4</label> <input type="checkbox" checked />
|
|
||||||
<ol>
|
|
||||||
<li class="file"><a href="folder4/2">2</a></li>
|
|
||||||
</ol>
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ context "Wiki" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "parents with default master ref" do
|
test "parents with default master ref" do
|
||||||
ref = '629aa678272b017a4d136d35e77ac94d80b08dc2'
|
ref = '7d6aeab8b84c895f21f6c66b84a457b0fced9693'
|
||||||
committer = Gollum::Committer.new(@wiki)
|
committer = Gollum::Committer.new(@wiki)
|
||||||
assert_equal ref, committer.parents.first.sha
|
assert_equal ref, committer.parents.first.sha
|
||||||
end
|
end
|
||||||
|
|||||||
+15
-1
@@ -68,10 +68,24 @@ def write file, content
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_html html
|
||||||
|
# Remove blank nodes for proper formatting
|
||||||
|
doc = Nokogiri.XML(html) do |cfg|
|
||||||
|
cfg.default_xml.noblanks
|
||||||
|
end
|
||||||
|
|
||||||
|
# Save as XHTML
|
||||||
|
doc.to_xml( { :save_with => Nokogiri::XML::Node::SaveOptions::DEFAULT_XHTML, :indent => 2, :encoding => 'UTF-8' } )
|
||||||
|
end
|
||||||
|
|
||||||
def check name, pages_array
|
def check name, pages_array
|
||||||
pages = FakePages.new pages_array
|
pages = FakePages.new pages_array
|
||||||
expected = read name
|
expected = read name
|
||||||
actual = view pages
|
actual = to_html view pages
|
||||||
|
|
||||||
|
# Uncomment when updating tests
|
||||||
|
# write name, actual
|
||||||
|
|
||||||
assert_equal expected, actual
|
assert_equal expected, actual
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ context "GitAccess" do
|
|||||||
assert @access.ref_map.empty?
|
assert @access.ref_map.empty?
|
||||||
assert @access.tree_map.empty?
|
assert @access.tree_map.empty?
|
||||||
@access.tree 'master'
|
@access.tree 'master'
|
||||||
assert_equal({"master"=>"629aa678272b017a4d136d35e77ac94d80b08dc2"}, @access.ref_map)
|
assert_equal({"master"=>"7d6aeab8b84c895f21f6c66b84a457b0fced9693"}, @access.ref_map)
|
||||||
|
|
||||||
@access.tree '1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e3'
|
@access.tree '1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e3'
|
||||||
map = @access.tree_map['1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e3']
|
map = @access.tree_map['1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e3']
|
||||||
|
|||||||
@@ -25,15 +25,13 @@ context "gitcode" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test 'that the rendered output is correctly fetched and rendered as html code' do
|
test 'that the rendered output is correctly fetched and rendered as html code' do
|
||||||
assert_equal %Q{<p>a</p>\n\n<div class=\"highlight\"><pre><span class=\"nt\"><ol</span> <span class=\"na\">class=</span><span class=\"s\">\"tree\"</span><span class=\"nt\">></span>\n <span class=\"nt\"><li</span> <span class=\"na\">class=</span><span class=\"s\">\"file\"</span><span class=\"nt\">><a</span> <span class=\"na\">href=</span><span class=\"s\">\"0\"</span><span class=\"nt\">></span>0<span class=\"nt\"></a></li></span>\n<span class=\"nt\"></ol></span>\n</pre></div>\n\n<p>b</p>}, @rendered
|
assert_equal %Q{<p>a</p>\n\n<div class=\"highlight\"><pre><span class=\"nt\"><ol</span> <span class=\"na\">class=</span><span class=\"s\">\"tree\"</span><span class=\"nt\">></span>\n <span class=\"nt\"><li</span> <span class=\"na\">class=</span><span class=\"s\">\"file\"</span><span class=\"nt\">></span>\n <span class=\"nt\"><a</span> <span class=\"na\">href=</span><span class=\"s\">\"0\"</span><span class=\"nt\">><span</span> <span class=\"na\">class=</span><span class=\"s\">\"icon\"</span><span class=\"nt\">></span></span>0<span class=\"nt\"></a></span>\n <span class=\"nt\"></li></span>\n<span class=\"nt\"></ol></span>\n</pre></div>\n\n<p>b</p>}, @rendered
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'contents' do
|
test 'contents' do
|
||||||
g = Gollum::Gitcode.new 'github/gollum/master/test/file_view/1_file.txt'
|
g = Gollum::Gitcode.new 'github/gollum/master/test/file_view/1_file.txt'
|
||||||
|
|
||||||
assert_equal g.contents, %{<ol class="tree">
|
assert_equal g.contents, %{<ol class=\"tree\">\n <li class=\"file\">\n <a href=\"0\"><span class=\"icon\"></span>0</a>\n </li>\n</ol>\n}
|
||||||
<li class="file"><a href="0">0</a></li>
|
|
||||||
</ol>}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
teardown do
|
teardown do
|
||||||
|
|||||||
+19
-6
@@ -212,7 +212,20 @@ context "Markup" do
|
|||||||
assert_equal expected, output
|
assert_equal expected, output
|
||||||
end
|
end
|
||||||
|
|
||||||
test "tilda code blocks #537" do
|
# Issue #568
|
||||||
|
test "tilde code blocks without a language" do
|
||||||
|
page = 'test_rgx'
|
||||||
|
@wiki.write_page(page, :markdown,
|
||||||
|
%Q(~~~
|
||||||
|
'hi'
|
||||||
|
~~~
|
||||||
|
), commit_details)
|
||||||
|
output = @wiki.page(page).formatted_data
|
||||||
|
expected = %Q{<div class=\"highlight\"><pre><span class=\"s\">'hi'</span>\n</pre></div>}
|
||||||
|
assert_equal expected, output
|
||||||
|
end
|
||||||
|
|
||||||
|
test "tilde code blocks #537" do
|
||||||
page = 'test_rgx'
|
page = 'test_rgx'
|
||||||
@wiki.write_page(page, :markdown,
|
@wiki.write_page(page, :markdown,
|
||||||
%Q(~~~ {.ruby}
|
%Q(~~~ {.ruby}
|
||||||
@@ -225,7 +238,7 @@ context "Markup" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Issue #537
|
# Issue #537
|
||||||
test "tilda code blocks with more than one class" do
|
test "tilde code blocks with more than one class" do
|
||||||
page = 'test_rgx'
|
page = 'test_rgx'
|
||||||
@wiki.write_page(page, :markdown,
|
@wiki.write_page(page, :markdown,
|
||||||
%Q(~~~ {#hi .ruby .sauce}
|
%Q(~~~ {#hi .ruby .sauce}
|
||||||
@@ -238,7 +251,7 @@ context "Markup" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Issue #537
|
# Issue #537
|
||||||
test "tilda code blocks with lots of tildes" do
|
test "tilde code blocks with lots of tildes" do
|
||||||
page = 'test_rgx'
|
page = 'test_rgx'
|
||||||
@wiki.write_page(page, :markdown,
|
@wiki.write_page(page, :markdown,
|
||||||
%Q(~~~~~~ {#hi .ruby .sauce}
|
%Q(~~~~~~ {#hi .ruby .sauce}
|
||||||
@@ -643,7 +656,7 @@ np.array([[2,2],[1,3]],np.float)
|
|||||||
page = @wiki.page("Bilbo Baggins")
|
page = @wiki.page("Bilbo Baggins")
|
||||||
rendered = Gollum::Markup.new(page).render
|
rendered = Gollum::Markup.new(page).render
|
||||||
assert_equal output, rendered
|
assert_equal output, rendered
|
||||||
assert_equal result, page.meta_data
|
assert_equal result, page.metadata
|
||||||
end
|
end
|
||||||
|
|
||||||
test "metadata blocks with newline" do
|
test "metadata blocks with newline" do
|
||||||
@@ -658,7 +671,7 @@ np.array([[2,2],[1,3]],np.float)
|
|||||||
page = @wiki.page("Bilbo Baggins")
|
page = @wiki.page("Bilbo Baggins")
|
||||||
rendered = Gollum::Markup.new(page).render
|
rendered = Gollum::Markup.new(page).render
|
||||||
assert_equal output, rendered
|
assert_equal output, rendered
|
||||||
assert_equal result, page.meta_data
|
assert_equal result, page.metadata
|
||||||
end
|
end
|
||||||
|
|
||||||
test "metadata sanitation" do
|
test "metadata sanitation" do
|
||||||
@@ -673,7 +686,7 @@ np.array([[2,2],[1,3]],np.float)
|
|||||||
page = @wiki.page("Bilbo Baggins")
|
page = @wiki.page("Bilbo Baggins")
|
||||||
rendered = Gollum::Markup.new(page).render
|
rendered = Gollum::Markup.new(page).render
|
||||||
assert_equal output, rendered
|
assert_equal output, rendered
|
||||||
assert_equal result, page.meta_data
|
assert_equal result, page.metadata
|
||||||
end
|
end
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|||||||
@@ -227,5 +227,12 @@ context "within a sub-directory" do
|
|||||||
assert page.header.raw_data =~ /^Hobbits/
|
assert page.header.raw_data =~ /^Hobbits/
|
||||||
assert page.footer.raw_data =~ /^Lord of the Rings/
|
assert page.footer.raw_data =~ /^Lord of the Rings/
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "get metadata on page" do
|
||||||
|
page = @wiki.page('Elrond')
|
||||||
|
assert_equal Gollum::Page, page.class
|
||||||
|
assert_equal 'elf', page.metadata['race']
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -198,6 +198,14 @@ context "Wiki page writing" do
|
|||||||
assert_equal cd[:email], @wiki.repo.commits.first.author.email
|
assert_equal cd[:email], @wiki.repo.commits.first.author.email
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "page title override with metadata" do
|
||||||
|
@wiki.write_page("Gollum", :markdown, "<!-- --- title: Over -->", commit_details)
|
||||||
|
|
||||||
|
page = @wiki.page("Gollum")
|
||||||
|
|
||||||
|
assert_equal 'Over', page.url_path_title
|
||||||
|
end
|
||||||
|
|
||||||
test "update page with format change" do
|
test "update page with format change" do
|
||||||
@wiki.write_page("Gollum", :markdown, "# Gollum", commit_details)
|
@wiki.write_page("Gollum", :markdown, "# Gollum", commit_details)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user