Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 72ee08b5ab | |||
| 45547624e4 | |||
| f928cfa8be | |||
| 988984846a | |||
| 1149618653 | |||
| 168a033903 | |||
| 6a765c9791 | |||
| e16ae7b511 | |||
| 174334ea44 | |||
| dbdf06930d | |||
| c93e65ddc3 | |||
| 56101ed264 | |||
| 8269c8e574 | |||
| 2246419d1e | |||
| 118a0c318b | |||
| 5401cf2910 | |||
| 432f9b8d2f | |||
| 66fc8a2d31 | |||
| 2f3dd3d227 | |||
| c43fd9fa6c | |||
| 868518e0f5 | |||
| 039b5cce98 | |||
| 4a421842d5 | |||
| cfbb124f81 | |||
| dcb147cde2 | |||
| 8d06b5e67e | |||
| 4776d0b422 |
+2
-2
@@ -4,5 +4,5 @@ rvm:
|
|||||||
notifications:
|
notifications:
|
||||||
disabled: true
|
disabled: true
|
||||||
before_install:
|
before_install:
|
||||||
- gem uninstall ffi -a
|
- sudo apt-get update
|
||||||
- sudo apt-get install -y asciidoc
|
- sudo apt-get install -y --force-yes asciidoc
|
||||||
@@ -295,7 +295,7 @@ This is useful for writing about the link syntax in your wiki pages.
|
|||||||
|
|
||||||
Gollum has a special tag to insert a table of contents (new in v2.1)
|
Gollum has a special tag to insert a table of contents (new in v2.1)
|
||||||
|
|
||||||
'[[_TOC_]]
|
[[_TOC_]]
|
||||||
|
|
||||||
This tag is case sensitive, use all upper case. The TOC tag can be inserted
|
This tag is case sensitive, use all upper case. The TOC tag can be inserted
|
||||||
into the `_Header`, `_Footer` or `_Sidebar` files too.
|
into the `_Header`, `_Footer` or `_Sidebar` files too.
|
||||||
@@ -547,17 +547,14 @@ 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
|
||||||
|
For z releases:
|
||||||
|
$ rake bump
|
||||||
|
$ rake release
|
||||||
|
|
||||||
For x.y releases:
|
For x.y releases:
|
||||||
Update VERSION in lib/gollum.rb
|
Update VERSION in lib/gollum.rb
|
||||||
$ rake gemspec
|
$ rake gemspec
|
||||||
|
$ rake release
|
||||||
For z releases:
|
|
||||||
$ rake bump
|
|
||||||
|
|
||||||
$ git tag vX.Y.Z
|
|
||||||
$ git push origin vX.Y.Z
|
|
||||||
$ gem build gollum.gemspec
|
|
||||||
$ gem push gollum-X.Y.Z.gem
|
|
||||||
|
|
||||||
## BUILDING THE GEM FROM MASTER
|
## BUILDING THE GEM FROM MASTER
|
||||||
$ gem uninstall -aIx gollum
|
$ gem uninstall -aIx gollum
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ task :gemspec => :validate do
|
|||||||
split("\n").
|
split("\n").
|
||||||
sort.
|
sort.
|
||||||
reject { |file| file =~ /^\./ }.
|
reject { |file| file =~ /^\./ }.
|
||||||
reject { |file| file =~ /^(rdoc|pkg|test)/ }.
|
reject { |file| file =~ /^(rdoc|pkg|test|Home\.md)/ }.
|
||||||
map { |file| " #{file}" }.
|
map { |file| " #{file}" }.
|
||||||
join("\n")
|
join("\n")
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -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.2.3'
|
s.version = '2.2.5'
|
||||||
s.date = '2012-10-10'
|
s.date = '2012-10-14'
|
||||||
s.rubyforge_project = 'gollum'
|
s.rubyforge_project = 'gollum'
|
||||||
|
|
||||||
s.summary = "A simple, Git-powered wiki."
|
s.summary = "A simple, Git-powered wiki."
|
||||||
@@ -47,7 +47,6 @@ Gem::Specification.new do |s|
|
|||||||
s.files = %w[
|
s.files = %w[
|
||||||
Gemfile
|
Gemfile
|
||||||
HISTORY.md
|
HISTORY.md
|
||||||
Home.md
|
|
||||||
LICENSE
|
LICENSE
|
||||||
README.md
|
README.md
|
||||||
Rakefile
|
Rakefile
|
||||||
|
|||||||
+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.2.3'
|
VERSION = '2.2.5'
|
||||||
|
|
||||||
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__))
|
||||||
|
|||||||
@@ -23,5 +23,12 @@ module Precious
|
|||||||
return url if url.nil?
|
return url if url.nil?
|
||||||
url.gsub('%2F','/').gsub(/^\/+/,'')
|
url.gsub('%2F','/').gsub(/^\/+/,'')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def trim_leading_slash url
|
||||||
|
return url if url.nil?
|
||||||
|
url.gsub!('%2F','/')
|
||||||
|
return '/' + url.gsub(/^\/+/,'') if url[0,1] == '/'
|
||||||
|
url
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -194,8 +194,8 @@ var previewSet = function( text ) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 'c', 'c++', 'cpp' are github specific and transformed to c_cpp for Ace.
|
// See pygmentsLanguageToAceMode for pygment to ace mode translations.
|
||||||
// 'coffeescript' is transformed to 'coffee' for Ace.
|
// TODO: Update languages and translation once Ace is upgraded to v1.0.
|
||||||
var languages = [ 'c', 'c++', 'cpp', 'clojure', 'coffee',
|
var languages = [ 'c', 'c++', 'cpp', 'clojure', 'coffee',
|
||||||
'coffeescript', 'coldfusion', 'csharp', 'css', 'diff', 'golang',
|
'coffeescript', 'coldfusion', 'csharp', 'css', 'diff', 'golang',
|
||||||
'groovy', 'haxe', 'html', 'java', 'javascript', 'json', 'latex',
|
'groovy', 'haxe', 'html', 'java', 'javascript', 'json', 'latex',
|
||||||
@@ -244,6 +244,31 @@ function highlight( element, language ) {
|
|||||||
element.parentNode.parentNode.replaceChild( newDiv, element.parentNode );
|
element.parentNode.parentNode.replaceChild( newDiv, element.parentNode );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pygments and Ace have different names for languages.
|
||||||
|
function pygmentsLanguageToAceMode( declaredLanguage ) {
|
||||||
|
declaredLanguage = declaredLanguage.toLowerCase();
|
||||||
|
|
||||||
|
switch ( declaredLanguage ) {
|
||||||
|
case 'bash':
|
||||||
|
return 'sh';
|
||||||
|
case 'c':
|
||||||
|
case 'c++':
|
||||||
|
case 'cpp':
|
||||||
|
case 'objective-c':
|
||||||
|
return 'c_cpp';
|
||||||
|
case 'c#':
|
||||||
|
return 'csharp';
|
||||||
|
case 'coffeescript':
|
||||||
|
return 'coffee';
|
||||||
|
case 'html+erb':
|
||||||
|
return 'html'
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assume language name is the same
|
||||||
|
// if it's not handled above.
|
||||||
|
return declaredLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
var makePreviewHtml = function () {
|
var makePreviewHtml = function () {
|
||||||
var text = editorSession.getValue();
|
var text = editorSession.getValue();
|
||||||
|
|
||||||
@@ -294,21 +319,7 @@ var makePreviewHtml = function () {
|
|||||||
// the syntax for code highlighting means all code, even one line, contains newlines.
|
// the syntax for code highlighting means all code, even one line, contains newlines.
|
||||||
if ( txt.length > 1 && codeHTML.match( /\n/ ) ) {
|
if ( txt.length > 1 && codeHTML.match( /\n/ ) ) {
|
||||||
var declaredLanguage = element.className.toLowerCase();
|
var declaredLanguage = element.className.toLowerCase();
|
||||||
var aceMode = declaredLanguage;
|
var aceMode = pygmentsLanguageToAceMode( declaredLanguage );
|
||||||
|
|
||||||
// GitHub supports 'c', 'c++', 'cpp'
|
|
||||||
// which must trigger the 'c_cpp' mode in Ace.
|
|
||||||
if ( declaredLanguage === 'c' ||
|
|
||||||
declaredLanguage === 'c++' ||
|
|
||||||
declaredLanguage === 'cpp' ) {
|
|
||||||
aceMode = 'c_cpp';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pygments's name for CoffeeScript is 'coffeescript', but Ace
|
|
||||||
// calls it 'coffee'.
|
|
||||||
if ( declaredLanguage === 'coffeescript' ) {
|
|
||||||
aceMode = 'coffee';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $.inArray( declaredLanguage, languages ) === -1 ) {
|
if ( $.inArray( declaredLanguage, languages ) === -1 ) {
|
||||||
// Unsupported language.
|
// Unsupported language.
|
||||||
|
|||||||
+34
-1
@@ -122,7 +122,7 @@ module Gollum
|
|||||||
end
|
end
|
||||||
node = Nokogiri::XML::Node.new('li', doc)
|
node = Nokogiri::XML::Node.new('li', doc)
|
||||||
# % -> %25 so anchors work on Firefox. See issue #475
|
# % -> %25 so anchors work on Firefox. See issue #475
|
||||||
node.add_child("<a href='##{id.gsub('%', '%25')}'>#{h.content}</a>")
|
node.add_child(%Q{<a href="##{id.gsub("%", "%25")}">#{h.content}</a>})
|
||||||
tail.add_child(node)
|
tail.add_child(node)
|
||||||
end
|
end
|
||||||
toc = toc.to_xhtml if toc != nil
|
toc = toc.to_xhtml if toc != nil
|
||||||
@@ -407,6 +407,12 @@ module Gollum
|
|||||||
presence = "present"
|
presence = "present"
|
||||||
end
|
end
|
||||||
link = ::File.join(@wiki.base_path, page ? page.escaped_url_path : CGI.escape(link_name))
|
link = ::File.join(@wiki.base_path, page ? page.escaped_url_path : CGI.escape(link_name))
|
||||||
|
|
||||||
|
# //page is invalid
|
||||||
|
# strip all duplicate forward slashes using helpers.rb trim_leading_slash
|
||||||
|
# //page => /page
|
||||||
|
link = trim_leading_slash link
|
||||||
|
|
||||||
%{<a class="internal #{presence}" href="#{link}#{extra}">#{name}</a>}
|
%{<a class="internal #{presence}" href="#{link}#{extra}">#{name}</a>}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -505,6 +511,33 @@ module Gollum
|
|||||||
#
|
#
|
||||||
# Returns the placeholder'd String data.
|
# Returns the placeholder'd String data.
|
||||||
def extract_code(data)
|
def extract_code(data)
|
||||||
|
data.gsub!(/^([ \t]*)(~~~+) ?([^\r\n]+)?\r?\n(.+?)\r?\n\1(~~~+)\r?$/m) do
|
||||||
|
m_indent = $1
|
||||||
|
m_start = $2 # ~~~
|
||||||
|
m_lang = $3
|
||||||
|
m_code = $4
|
||||||
|
m_end = $5 # ~~~
|
||||||
|
|
||||||
|
# start and finish tilde fence must be the same length
|
||||||
|
return '' if m_start.length != m_end.length
|
||||||
|
|
||||||
|
lang = m_lang ? m_lang.strip : nil
|
||||||
|
id = Digest::SHA1.hexdigest("#{lang}.#{m_code}")
|
||||||
|
cached = check_cache(:code, id)
|
||||||
|
|
||||||
|
# extract lang from { .ruby } or { #stuff .ruby .indent }
|
||||||
|
# see http://johnmacfarlane.net/pandoc/README.html#delimited-code-blocks
|
||||||
|
|
||||||
|
lang = lang.match(/\.([^}\s]+)/)
|
||||||
|
lang = lang[1] unless lang.nil?
|
||||||
|
|
||||||
|
@codemap[id] = cached ?
|
||||||
|
{ :output => cached } :
|
||||||
|
{ :lang => lang, :code => m_code, :indent => m_indent }
|
||||||
|
|
||||||
|
"#{m_indent}#{id}" # print the SHA1 ID with the proper indentation
|
||||||
|
end
|
||||||
|
|
||||||
data.gsub!(/^([ \t]*)``` ?([^\r\n]+)?\r?\n(.+?)\r?\n\1```\r?$/m) do
|
data.gsub!(/^([ \t]*)``` ?([^\r\n]+)?\r?\n(.+?)\r?\n\1```\r?$/m) do
|
||||||
lang = $2 ? $2.strip : nil
|
lang = $2 ? $2.strip : nil
|
||||||
id = Digest::SHA1.hexdigest("#{lang}.#{$3}")
|
id = Digest::SHA1.hexdigest("#{lang}.#{$3}")
|
||||||
|
|||||||
@@ -55,6 +55,21 @@ context "Markup" do
|
|||||||
#
|
#
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|
||||||
|
test "absolute link to non-existent page" do
|
||||||
|
@wiki.write_page("linktest", :markdown, "[[/Page]]", commit_details)
|
||||||
|
|
||||||
|
page = @wiki.page("linktest")
|
||||||
|
doc = Nokogiri::HTML page.formatted_data
|
||||||
|
paras = doc / :p
|
||||||
|
para = paras.first
|
||||||
|
anchors = para / :a
|
||||||
|
assert_equal 1, paras.size
|
||||||
|
assert_equal 1, anchors.size
|
||||||
|
assert_equal 'internal absent', anchors[0]['class']
|
||||||
|
assert_equal '/Page', anchors[0]['href']
|
||||||
|
assert_equal '/Page', anchors[0].text
|
||||||
|
end
|
||||||
|
|
||||||
test "double page links no space" do
|
test "double page links no space" do
|
||||||
@wiki.write_page("Bilbo Baggins", :markdown, "a [[Foo]][[Bar]] b", commit_details)
|
@wiki.write_page("Bilbo Baggins", :markdown, "a [[Foo]][[Bar]] b", commit_details)
|
||||||
|
|
||||||
@@ -197,6 +212,43 @@ context "Markup" do
|
|||||||
assert_equal expected, output
|
assert_equal expected, output
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "~~~ code blocks #537" do
|
||||||
|
page = 'test_rgx'
|
||||||
|
@wiki.write_page(page, :markdown,
|
||||||
|
%Q(~~~ {.ruby}
|
||||||
|
'hi'
|
||||||
|
~~~
|
||||||
|
), commit_details)
|
||||||
|
output = @wiki.page(page).formatted_data
|
||||||
|
expected = %Q{<div class=\"highlight\"><pre><span class=\"s1\">'hi'</span>\n</pre></div>}
|
||||||
|
assert_equal expected, output
|
||||||
|
end
|
||||||
|
|
||||||
|
test "~~~ code blocks #537 with more than one class" do
|
||||||
|
page = 'test_rgx'
|
||||||
|
@wiki.write_page(page, :markdown,
|
||||||
|
%Q(~~~ {#hi .ruby .sauce}
|
||||||
|
'hi'
|
||||||
|
~~~
|
||||||
|
), commit_details)
|
||||||
|
output = @wiki.page(page).formatted_data
|
||||||
|
expected = %Q{<div class=\"highlight\"><pre><span class=\"s1\">'hi'</span>\n</pre></div>}
|
||||||
|
assert_equal expected, output
|
||||||
|
end
|
||||||
|
|
||||||
|
test "~~~ code blocks #537 with lots of tildes" do
|
||||||
|
page = 'test_rgx'
|
||||||
|
@wiki.write_page(page, :markdown,
|
||||||
|
%Q(~~~~~~ {#hi .ruby .sauce}
|
||||||
|
~~
|
||||||
|
'hi'~
|
||||||
|
~~~~~~
|
||||||
|
), commit_details)
|
||||||
|
output = @wiki.page(page).formatted_data
|
||||||
|
expected = %Q{<div class=\"highlight\"><pre><span class=\"o\">~~</span>\n<span class=\"s1\">'hi'</span><span class=\"o\">~</span>\n</pre></div>}
|
||||||
|
assert_equal expected, output
|
||||||
|
end
|
||||||
|
|
||||||
test "wiki link within code block" do
|
test "wiki link within code block" do
|
||||||
@wiki.write_page("Potato", :markdown, " sed -i '' 's/[[:space:]]*$//'", commit_details)
|
@wiki.write_page("Potato", :markdown, " sed -i '' 's/[[:space:]]*$//'", commit_details)
|
||||||
page = @wiki.page("Potato")
|
page = @wiki.page("Potato")
|
||||||
|
|||||||
@@ -142,6 +142,16 @@ context "Wiki TOC" do
|
|||||||
assert_equal '<h1>Bilbo<a class="anchor" id="Bilbo" href="#Bilbo"></a></h1>', page.formatted_data.gsub(/\n/,"")
|
assert_equal '<h1>Bilbo<a class="anchor" id="Bilbo" href="#Bilbo"></a></h1>', page.formatted_data.gsub(/\n/,"")
|
||||||
assert_equal %{<div class="toc"><div class="toc-title">Table of Contents</div><ul><li><a href="#Bilbo">Bilbo</a></li></ul></div>}, page.toc_data.gsub(/\n */,"")
|
assert_equal %{<div class="toc"><div class="toc-title">Table of Contents</div><ul><li><a href="#Bilbo">Bilbo</a></li></ul></div>}, page.toc_data.gsub(/\n */,"")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Ensure ' creates valid links in TOC
|
||||||
|
# Incorrect: <a href=\"#a\" b=\"\">
|
||||||
|
# Correct: <a href=\"#a'b\">
|
||||||
|
test "' in link" do
|
||||||
|
page = @wiki.preview_page("Test", "# a'b", :markdown)
|
||||||
|
assert_equal "# a'b", page.raw_data
|
||||||
|
assert_equal %q{<h1>a'b<a class="anchor" id="a'b" href="#a'b"></a></h1>}, page.formatted_data.gsub(/\n/,"")
|
||||||
|
assert_equal %{<div class=\"toc\"><div class=\"toc-title\">Table of Contents</div><ul><li><a href=\"#a'b\">a'b</a></li></ul></div>}, page.toc_data.gsub(/\n */,"")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "Wiki page writing" do
|
context "Wiki page writing" do
|
||||||
|
|||||||
Reference in New Issue
Block a user