Compare commits

...

27 Commits

Author SHA1 Message Date
bootstraponline 72ee08b5ab Release 2.2.5 2012-10-14 11:21:56 -06:00
bootstraponline 45547624e4 Improve tilde fence support
More than 3 tildes can be used. The code block must end with the same amount of tildes used to open the code block.

Fix #537

http://johnmacfarlane.net/pandoc/README.html#delimited-code-blocks
2012-10-14 11:02:45 -06:00
bootstraponline f928cfa8be Don't ship Lorem ipsum in gem 2012-10-13 20:21:08 -06:00
bootstraponline 988984846a Release 2.2.4 2012-10-13 20:01:57 -06:00
bootstraponline 1149618653 Fix #537 2012-10-13 19:53:41 -06:00
bootstraponline 168a033903 Remove old comment 2012-10-13 14:59:42 -06:00
bootstraponline 6a765c9791 Fix #537 2012-10-13 14:52:28 -06:00
bootstraponline e16ae7b511 Travis is having a bad day
E: There are problems and -y was used without --force-yes
before_install: 'sudo apt-get install -y asciidoc' returned false.
Done. Build script exited with: 1
2012-10-13 14:07:15 -06:00
bootstraponline 174334ea44 Remove comment 2012-10-13 13:58:56 -06:00
bootstraponline dbdf06930d Fix 2012-10-13 13:55:20 -06:00
bootstraponline c93e65ddc3 Merge branch 'master' of github.com:github/gollum 2012-10-13 13:32:19 -06:00
bootstraponline 56101ed264 Fix #535 and add test 2012-10-13 13:32:08 -06:00
bootstraponline 8269c8e574 TOC doesn't require ' 2012-10-13 13:11:31 -06:00
bootstraponline 2246419d1e Fix spacing 2012-10-13 13:09:20 -06:00
bootstraponline 118a0c318b Update comment 2012-10-13 13:06:15 -06:00
bootstraponline 5401cf2910 Fix #542 2012-10-13 13:04:51 -06:00
bootstraponline 432f9b8d2f Add test for #542 2012-10-13 12:57:58 -06:00
bootstraponline 66fc8a2d31 Revert "Fix #542"
This reverts commit 2f3dd3d227.
2012-10-13 12:55:43 -06:00
bootstraponline 2f3dd3d227 Fix #542
Page link may contain duplicate starting forward slashes.
//page points to http://page/ when what we want is
/page pointing to http://localhost:1234/page
2012-10-13 09:53:25 -06:00
bootstraponline c43fd9fa6c Update language comment 2012-10-12 21:19:24 -06:00
bootstraponline 868518e0f5 Bash is Ace mode sh 2012-10-12 20:58:05 -06:00
bootstraponline 039b5cce98 Try to fix Travis
FFI is no longer used in the new pygments.rb.
apt-get update may resolve the asciidoc install failure.
2012-10-12 20:24:31 -06:00
bootstraponline 4a421842d5 https://github.com/travis-ci/travis-ci/issues/725
Modified README to trigger a Travis CI build. It's currently broken.
2012-10-12 20:22:10 -06:00
bootstraponline cfbb124f81 Update README.md 2012-10-12 20:16:43 -06:00
bootstraponline dcb147cde2 Ensure declaredLanguage is lower case 2012-10-10 20:20:33 -06:00
bootstraponline 8d06b5e67e Fix pygments language to Ace mode translation 2012-10-10 20:16:04 -06:00
bootstraponline 4776d0b422 Use rake release in readme 2012-10-10 19:45:42 -06:00
10 changed files with 143 additions and 34 deletions
+2 -2
View File
@@ -4,5 +4,5 @@ rvm:
notifications:
disabled: true
before_install:
- gem uninstall ffi -a
- sudo apt-get install -y asciidoc
- sudo apt-get update
- sudo apt-get install -y --force-yes asciidoc
+6 -9
View File
@@ -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)
'[[_TOC_]]
[[_TOC_]]
This tag is case sensitive, use all upper case. The TOC tag can be inserted
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.
## RELEASING
For z releases:
$ rake bump
$ rake release
For x.y releases:
Update VERSION in lib/gollum.rb
$ rake gemspec
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
$ rake release
## BUILDING THE GEM FROM MASTER
$ gem uninstall -aIx gollum
+1 -1
View File
@@ -145,7 +145,7 @@ task :gemspec => :validate do
split("\n").
sort.
reject { |file| file =~ /^\./ }.
reject { |file| file =~ /^(rdoc|pkg|test)/ }.
reject { |file| file =~ /^(rdoc|pkg|test|Home\.md)/ }.
map { |file| " #{file}" }.
join("\n")
+2 -3
View File
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
s.required_ruby_version = ">= 1.8.7"
s.name = 'gollum'
s.version = '2.2.3'
s.date = '2012-10-10'
s.version = '2.2.5'
s.date = '2012-10-14'
s.rubyforge_project = 'gollum'
s.summary = "A simple, Git-powered wiki."
@@ -47,7 +47,6 @@ Gem::Specification.new do |s|
s.files = %w[
Gemfile
HISTORY.md
Home.md
LICENSE
README.md
Rakefile
+1 -1
View File
@@ -23,7 +23,7 @@ require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
module Gollum
VERSION = '2.2.3'
VERSION = '2.2.5'
def self.assets_path
::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
+7
View File
@@ -23,5 +23,12 @@ module Precious
return url if url.nil?
url.gsub('%2F','/').gsub(/^\/+/,'')
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
@@ -194,8 +194,8 @@ var previewSet = function( text ) {
}
};
// 'c', 'c++', 'cpp' are github specific and transformed to c_cpp for Ace.
// 'coffeescript' is transformed to 'coffee' for Ace.
// See pygmentsLanguageToAceMode for pygment to ace mode translations.
// TODO: Update languages and translation once Ace is upgraded to v1.0.
var languages = [ 'c', 'c++', 'cpp', 'clojure', 'coffee',
'coffeescript', 'coldfusion', 'csharp', 'css', 'diff', 'golang',
'groovy', 'haxe', 'html', 'java', 'javascript', 'json', 'latex',
@@ -244,6 +244,31 @@ function highlight( element, language ) {
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 text = editorSession.getValue();
@@ -294,21 +319,7 @@ var makePreviewHtml = function () {
// the syntax for code highlighting means all code, even one line, contains newlines.
if ( txt.length > 1 && codeHTML.match( /\n/ ) ) {
var declaredLanguage = element.className.toLowerCase();
var aceMode = 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';
}
var aceMode = pygmentsLanguageToAceMode( declaredLanguage );
if ( $.inArray( declaredLanguage, languages ) === -1 ) {
// Unsupported language.
+34 -1
View File
@@ -122,7 +122,7 @@ module Gollum
end
node = Nokogiri::XML::Node.new('li', doc)
# % -> %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)
end
toc = toc.to_xhtml if toc != nil
@@ -407,6 +407,12 @@ module Gollum
presence = "present"
end
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>}
end
end
@@ -505,6 +511,33 @@ module Gollum
#
# Returns the placeholder'd String 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
lang = $2 ? $2.strip : nil
id = Digest::SHA1.hexdigest("#{lang}.#{$3}")
+52
View File
@@ -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
@wiki.write_page("Bilbo Baggins", :markdown, "a [[Foo]][[Bar]] b", commit_details)
@@ -197,6 +212,43 @@ context "Markup" do
assert_equal expected, output
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
@wiki.write_page("Potato", :markdown, " sed -i '' 's/[[:space:]]*$//'", commit_details)
page = @wiki.page("Potato")
+10
View File
@@ -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 %{<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
# 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
context "Wiki page writing" do