Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 66e08a6b17 | |||
| 7898db70ed | |||
| 7c357116ff | |||
| 69ce0eb0d0 | |||
| 4db31a297b | |||
| e1fca457e4 | |||
| 7f8485ce80 | |||
| 290061fd11 | |||
| a507836936 | |||
| 6524d20a96 | |||
| f1c523aa30 | |||
| 87c08f5613 | |||
| 82913cea20 | |||
| 2ad743e4bd | |||
| fa97b57a96 | |||
| 1b952b6d56 | |||
| 90cc512bd1 | |||
| b82556c9c0 | |||
| fbe3b4bb3b | |||
| 5ffd98ad31 | |||
| cb9dd4d228 | |||
| cd823bf10c | |||
| 5560ec52c2 | |||
| 065151a77f |
@@ -1,4 +1,4 @@
|
|||||||
source "http://rubygems.org"
|
source 'http://rubygems.org'
|
||||||
|
|
||||||
gemspec
|
gemspec
|
||||||
gem "rake", "~> 0.9.2.2"
|
gem 'rake', '~> 0.9'
|
||||||
@@ -2,6 +2,7 @@ gollum -- A wiki built on top of Git
|
|||||||
====================================
|
====================================
|
||||||
|
|
||||||
[](http://travis-ci.org/github/gollum)
|
[](http://travis-ci.org/github/gollum)
|
||||||
|
[](https://gemnasium.com/github/gollum)
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
|
|
||||||
@@ -18,6 +19,11 @@ number of ways depending on your needs. You can edit your wiki locally:
|
|||||||
Gollum follows the rules of [Semantic Versioning](http://semver.org/) and uses
|
Gollum follows the rules of [Semantic Versioning](http://semver.org/) and uses
|
||||||
[TomDoc](http://tomdoc.org/) for inline documentation.
|
[TomDoc](http://tomdoc.org/) for inline documentation.
|
||||||
|
|
||||||
|
## SYSTEM REQUIREMENTS
|
||||||
|
- Python 2.5+ (2.7.3 recommended)
|
||||||
|
- Ruby 1.8.7+ (1.9.3 recommended)
|
||||||
|
- Unix like operating system (OS X, Ubuntu, Debian, and more)
|
||||||
|
- Will not work on Windows (because of [grit](https://github.com/github/grit))
|
||||||
|
|
||||||
## INSTALLATION
|
## INSTALLATION
|
||||||
|
|
||||||
@@ -413,6 +419,17 @@ By default, internal wiki links are all absolute from the root. To specify a dif
|
|||||||
|
|
||||||
wiki = Gollum::Wiki.new("my-gollum-repo.git", :base_path => "/wiki")
|
wiki = Gollum::Wiki.new("my-gollum-repo.git", :base_path => "/wiki")
|
||||||
|
|
||||||
|
Note that base_path just modifies the links. To map gollum to a non-root location:
|
||||||
|
|
||||||
|
- Use the gollum binary: `gollum path/to/wiki --base-path mywiki`
|
||||||
|
- Define config.ru with `map`. See [#532](https://github.com/github/gollum/issues/532) for an example.
|
||||||
|
|
||||||
|
> :base_path - String base path for all Wiki links.
|
||||||
|
>
|
||||||
|
> The String base path to prefix to internal links. For example, when set
|
||||||
|
> to "/wiki", the page "Hobbit" will be linked as "/wiki/Hobbit". Defaults
|
||||||
|
> to "/".
|
||||||
|
|
||||||
Get the latest version of the given human or canonical page name:
|
Get the latest version of the given human or canonical page name:
|
||||||
|
|
||||||
page = wiki.page('page-name')
|
page = wiki.page('page-name')
|
||||||
|
|||||||
+27
-1
@@ -141,5 +141,31 @@ else
|
|||||||
require cfg
|
require cfg
|
||||||
end
|
end
|
||||||
|
|
||||||
Precious::App.run!(options)
|
base_path = wiki_options[:base_path]
|
||||||
|
|
||||||
|
if wiki_options[:base_path].nil?
|
||||||
|
Precious::App.run!(options)
|
||||||
|
else
|
||||||
|
require 'rack'
|
||||||
|
|
||||||
|
class MapGollum
|
||||||
|
def initialize base_path
|
||||||
|
@mg = Rack::Builder.new do
|
||||||
|
map '/' do
|
||||||
|
run Proc.new { [ 302, {'Location'=> "/#{base_path}" }, [] ] }
|
||||||
|
end
|
||||||
|
|
||||||
|
map "/#{base_path}" do
|
||||||
|
run Precious::App
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def call(env)
|
||||||
|
@mg.call(env)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
# Rack::Handler does not work with Ctrl + C. Use Rack::Server instead.
|
||||||
|
Rack::Server.new(:app => MapGollum.new(base_path), :Port => options['port']).start
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+9
-11
@@ -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.6'
|
s.version = '2.3.0'
|
||||||
s.date = '2012-10-14'
|
s.date = '2012-10-21'
|
||||||
s.rubyforge_project = 'gollum'
|
s.rubyforge_project = 'gollum'
|
||||||
|
|
||||||
s.summary = "A simple, Git-powered wiki."
|
s.summary = "A simple, Git-powered wiki."
|
||||||
@@ -26,22 +26,21 @@ Gem::Specification.new do |s|
|
|||||||
s.add_dependency('grit', '~> 2.5.0')
|
s.add_dependency('grit', '~> 2.5.0')
|
||||||
s.add_dependency('github-markup', ['>= 0.7.4', '< 1.0.0'])
|
s.add_dependency('github-markup', ['>= 0.7.4', '< 1.0.0'])
|
||||||
s.add_dependency('github-markdown', '~> 0.5.1')
|
s.add_dependency('github-markdown', '~> 0.5.1')
|
||||||
s.add_dependency('pygments.rb', '~> 0.3.1')
|
s.add_dependency('pygments.rb', '~> 0.3.2')
|
||||||
s.add_dependency('escape_utils', '0.2.4')
|
|
||||||
s.add_dependency('sinatra', '~> 1.3.3')
|
s.add_dependency('sinatra', '~> 1.3.3')
|
||||||
s.add_dependency('mustache', ['>= 0.99.4', '< 1.0.0'])
|
s.add_dependency('mustache', ['>= 0.99.4', '< 1.0.0'])
|
||||||
s.add_dependency('sanitize', '~> 2.0.3')
|
s.add_dependency('sanitize', '~> 2.0.3')
|
||||||
s.add_dependency('nokogiri', '~> 1.5.5')
|
s.add_dependency('nokogiri', '~> 1.5.5')
|
||||||
s.add_dependency('useragent', '~> 0.4.10')
|
s.add_dependency('useragent', '~> 0.4.12')
|
||||||
s.add_dependency('stringex', '~> 1.4.0')
|
s.add_dependency('stringex', '~> 1.4.0')
|
||||||
|
|
||||||
s.add_development_dependency('RedCloth', '~> 4.2.9')
|
s.add_development_dependency('RedCloth', '~> 4.2.9')
|
||||||
s.add_development_dependency('mocha', '~> 0.12.6')
|
s.add_development_dependency('mocha', '~> 0.12.7')
|
||||||
s.add_development_dependency('org-ruby', '~> 0.7.1')
|
s.add_development_dependency('org-ruby', '~> 0.7.2')
|
||||||
s.add_development_dependency('shoulda', '~> 3.1.1')
|
s.add_development_dependency('shoulda', '~> 3.3.1')
|
||||||
s.add_development_dependency('rack-test', '~> 0.6.2')
|
s.add_development_dependency('rack-test', '~> 0.6.2')
|
||||||
s.add_development_dependency('wikicloth', '~> 0.8.0')
|
s.add_development_dependency('wikicloth', '~> 0.8.0')
|
||||||
s.add_development_dependency('rake', '~> 0.9.2.2')
|
s.add_development_dependency('rake', '~> 0.9')
|
||||||
|
|
||||||
# = MANIFEST =
|
# = MANIFEST =
|
||||||
s.files = %w[
|
s.files = %w[
|
||||||
@@ -458,7 +457,6 @@ Gem::Specification.new do |s|
|
|||||||
lib/gollum/page.rb
|
lib/gollum/page.rb
|
||||||
lib/gollum/pagination.rb
|
lib/gollum/pagination.rb
|
||||||
lib/gollum/sanitization.rb
|
lib/gollum/sanitization.rb
|
||||||
lib/gollum/tex.rb
|
|
||||||
lib/gollum/web_sequence_diagram.rb
|
lib/gollum/web_sequence_diagram.rb
|
||||||
lib/gollum/wiki.rb
|
lib/gollum/wiki.rb
|
||||||
licenses/css_tree_menu_thecssninja/license.txt
|
licenses/css_tree_menu_thecssninja/license.txt
|
||||||
@@ -470,4 +468,4 @@ Gem::Specification.new do |s|
|
|||||||
# = MANIFEST =
|
# = MANIFEST =
|
||||||
|
|
||||||
s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
|
s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
|
||||||
end
|
end
|
||||||
|
|||||||
+1
-2
@@ -18,12 +18,11 @@ require File.expand_path('../gollum/file', __FILE__)
|
|||||||
require File.expand_path('../gollum/file_view', __FILE__)
|
require File.expand_path('../gollum/file_view', __FILE__)
|
||||||
require File.expand_path('../gollum/markup', __FILE__)
|
require File.expand_path('../gollum/markup', __FILE__)
|
||||||
require File.expand_path('../gollum/sanitization', __FILE__)
|
require File.expand_path('../gollum/sanitization', __FILE__)
|
||||||
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__)
|
||||||
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.6'
|
VERSION = '2.3.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__))
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ module Precious
|
|||||||
end
|
end
|
||||||
|
|
||||||
get '/' do
|
get '/' do
|
||||||
redirect File.join(settings.wiki_options[:base_path].to_s, 'Home')
|
redirect File.join(settings.wiki_options[:page_file_dir].to_s,settings.wiki_options[:base_path].to_s, 'Home')
|
||||||
end
|
end
|
||||||
|
|
||||||
# path is set to name if path is nil.
|
# path is set to name if path is nil.
|
||||||
@@ -145,6 +145,7 @@ module Precious
|
|||||||
page_name = CGI.unescape(params[:page])
|
page_name = CGI.unescape(params[:page])
|
||||||
wiki = wiki_new
|
wiki = wiki_new
|
||||||
page = wiki.paged(page_name, path, exact = true)
|
page = wiki.paged(page_name, path, exact = true)
|
||||||
|
return if page.nil?
|
||||||
rename = params[:rename].to_url if params[:rename]
|
rename = params[:rename].to_url if params[:rename]
|
||||||
name = rename || page.name
|
name = rename || page.name
|
||||||
committer = Gollum::Committer.new(wiki, commit_message)
|
committer = Gollum::Committer.new(wiki, commit_message)
|
||||||
@@ -190,13 +191,20 @@ module Precious
|
|||||||
path = '' if path.nil?
|
path = '' if path.nil?
|
||||||
format = params[:format].intern
|
format = params[:format].intern
|
||||||
|
|
||||||
|
page_dir = File.join(settings.wiki_options[:page_file_dir].to_s,
|
||||||
|
settings.wiki_options[:base_path].to_s)
|
||||||
|
# Home is a special case.
|
||||||
|
path = '' if name.downcase == 'home'
|
||||||
|
|
||||||
|
page_dir = File.join(page_dir, path)
|
||||||
|
|
||||||
# write_page is not directory aware so use wiki_options to emulate dir support.
|
# write_page is not directory aware so use wiki_options to emulate dir support.
|
||||||
wiki_options = settings.wiki_options.merge({ :page_file_dir => path })
|
wiki_options = settings.wiki_options.merge({ :page_file_dir => page_dir })
|
||||||
wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options)
|
wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
wiki.write_page(name, format, params[:content], commit_message)
|
wiki.write_page(name, format, params[:content], commit_message)
|
||||||
redirect to("/#{clean_url(CGI.escape(::File.join(path,name)))}")
|
redirect to("/#{clean_url(CGI.escape(::File.join(page_dir,name)))}")
|
||||||
rescue Gollum::DuplicatePageError => e
|
rescue Gollum::DuplicatePageError => e
|
||||||
@message = "Duplicate page: #{e.message}"
|
@message = "Duplicate page: #{e.message}"
|
||||||
mustache :error
|
mustache :error
|
||||||
|
|||||||
@@ -18,7 +18,11 @@
|
|||||||
<script type="text/javascript" src="{{base_url}}/javascript/gollum.dialog.js"></script>
|
<script type="text/javascript" src="{{base_url}}/javascript/gollum.dialog.js"></script>
|
||||||
<script type="text/javascript" src="{{base_url}}/javascript/gollum.placeholder.js"></script>
|
<script type="text/javascript" src="{{base_url}}/javascript/gollum.placeholder.js"></script>
|
||||||
<script type="text/javascript" src="{{base_url}}/javascript/editor/gollum.editor.js"></script>
|
<script type="text/javascript" src="{{base_url}}/javascript/editor/gollum.editor.js"></script>
|
||||||
{{#mathjax}}<script>(function(d,j){
|
{{#mathjax}}
|
||||||
|
<script type="text/x-mathjax-config">
|
||||||
|
MathJax.Hub.Config({ TeX: { extensions: ["autoload-all.js"] }});
|
||||||
|
</script>
|
||||||
|
<script>(function(d,j){
|
||||||
j = d.createElement('script');
|
j = d.createElement('script');
|
||||||
j.src = 'https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
|
j.src = 'https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
|
||||||
(d.head || d.getElementsByTagName('head')[0]).appendChild(j);
|
(d.head || d.getElementsByTagName('head')[0]).appendChild(j);
|
||||||
|
|||||||
+2
-45
@@ -33,7 +33,6 @@ module Gollum
|
|||||||
@dir = ::File.dirname(page.path)
|
@dir = ::File.dirname(page.path)
|
||||||
@tagmap = {}
|
@tagmap = {}
|
||||||
@codemap = {}
|
@codemap = {}
|
||||||
@texmap = {}
|
|
||||||
@wsdmap = {}
|
@wsdmap = {}
|
||||||
@premap = {}
|
@premap = {}
|
||||||
@toc = nil
|
@toc = nil
|
||||||
@@ -57,7 +56,6 @@ module Gollum
|
|||||||
data = extract_metadata(data)
|
data = extract_metadata(data)
|
||||||
data = extract_gitcode(data)
|
data = extract_gitcode(data)
|
||||||
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
|
||||||
@@ -79,7 +77,6 @@ module Gollum
|
|||||||
data = doc.to_xhtml
|
data = doc.to_xhtml
|
||||||
|
|
||||||
data = process_toc_tags(data)
|
data = process_toc_tags(data)
|
||||||
data = process_tex(data)
|
|
||||||
data = process_wsd(data)
|
data = process_wsd(data)
|
||||||
data.gsub!(/<p><\/p>/) do
|
data.gsub!(/<p><\/p>/) do
|
||||||
''
|
''
|
||||||
@@ -95,7 +92,8 @@ module Gollum
|
|||||||
def process_headers(doc)
|
def process_headers(doc)
|
||||||
toc = nil
|
toc = nil
|
||||||
doc.css('h1,h2,h3,h4,h5,h6').each do |h|
|
doc.css('h1,h2,h3,h4,h5,h6').each do |h|
|
||||||
h_name = h.content.gsub(' ','-')
|
# must escape "
|
||||||
|
h_name = h.content.gsub(' ','-').gsub('"','%22')
|
||||||
|
|
||||||
level = h.name.gsub(/[hH]/,'').to_i
|
level = h.name.gsub(/[hH]/,'').to_i
|
||||||
|
|
||||||
@@ -125,47 +123,6 @@ module Gollum
|
|||||||
[doc, toc]
|
[doc, toc]
|
||||||
end
|
end
|
||||||
|
|
||||||
#########################################################################
|
|
||||||
#
|
|
||||||
# TeX
|
|
||||||
#
|
|
||||||
#########################################################################
|
|
||||||
|
|
||||||
# Extract all TeX into the texmap and replace with placeholders.
|
|
||||||
#
|
|
||||||
# data - The raw String data.
|
|
||||||
#
|
|
||||||
# Returns the placeholder'd String data.
|
|
||||||
def extract_tex(data)
|
|
||||||
data.gsub(/\\\[\s*(.*?)\s*\\\]/m) do
|
|
||||||
tag = CGI.escapeHTML($1)
|
|
||||||
id = Digest::SHA1.hexdigest(tag)
|
|
||||||
@texmap[id] = [:block, tag]
|
|
||||||
id
|
|
||||||
end.gsub(/\\\(\s*(.*?)\s*\\\)/m) do
|
|
||||||
tag = CGI.escapeHTML($1)
|
|
||||||
id = Digest::SHA1.hexdigest(tag)
|
|
||||||
@texmap[id] = [:inline, tag]
|
|
||||||
id
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Process all TeX from the texmap and replace the placeholders with the
|
|
||||||
# final markup.
|
|
||||||
#
|
|
||||||
# data - The String data (with placeholders).
|
|
||||||
#
|
|
||||||
# Returns the marked up String data.
|
|
||||||
def process_tex(data)
|
|
||||||
@texmap.each do |id, spec|
|
|
||||||
type, tex = *spec
|
|
||||||
data.gsub!(id) do
|
|
||||||
Gollum::Tex.to_html(tex, type)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
data
|
|
||||||
end
|
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
#
|
#
|
||||||
# Tags
|
# Tags
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
require 'escape_utils'
|
|
||||||
|
|
||||||
module Gollum
|
|
||||||
module Tex
|
|
||||||
TEX_URL = "http://www.mathtran.org/cgi-bin/toy/"
|
|
||||||
TEX_SIZES = { :inline => 2, :block => 4 }
|
|
||||||
|
|
||||||
def self.to_html(tex, type = :inline)
|
|
||||||
tex_uri = EscapeUtils.escape_uri(tex)
|
|
||||||
tex_alt = EscapeUtils.escape_html(tex)
|
|
||||||
%{<img src="#{TEX_URL}?D=#{TEX_SIZES[type]};tex=#{tex_uri}" alt="#{tex_alt}">}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
+5
-1
@@ -184,7 +184,7 @@ context "Frontend" do
|
|||||||
name = "A"
|
name = "A"
|
||||||
post "/create", :content => 'abc', :page => name,
|
post "/create", :content => 'abc', :page => name,
|
||||||
:format => 'markdown', :message => 'def'
|
:format => 'markdown', :message => 'def'
|
||||||
follow_redirect!
|
|
||||||
assert last_response.ok?
|
assert last_response.ok?
|
||||||
|
|
||||||
@wiki.clear_cache
|
@wiki.clear_cache
|
||||||
@@ -273,6 +273,9 @@ context "Frontend" do
|
|||||||
Precious::App.set(:wiki_options, { :base_path => '/wiki/' })
|
Precious::App.set(:wiki_options, { :base_path => '/wiki/' })
|
||||||
get "/"
|
get "/"
|
||||||
assert_match "http://example.org/wiki/Home", last_response.headers['Location']
|
assert_match "http://example.org/wiki/Home", last_response.headers['Location']
|
||||||
|
|
||||||
|
# Reset base path
|
||||||
|
Precious::App.set(:wiki_options, { :base_path => nil })
|
||||||
end
|
end
|
||||||
|
|
||||||
test "author details in session are used" do
|
test "author details in session are used" do
|
||||||
@@ -377,6 +380,7 @@ context "Frontend with lotr" do
|
|||||||
test "edit pages within sub-directories" do
|
test "edit pages within sub-directories" do
|
||||||
post "/create", :content => 'big smelly creatures', :page => 'Orc',
|
post "/create", :content => 'big smelly creatures', :page => 'Orc',
|
||||||
:path => 'Mordor', :format => 'markdown', :message => 'oooh, scary'
|
:path => 'Mordor', :format => 'markdown', :message => 'oooh, scary'
|
||||||
|
|
||||||
assert_equal 'http://example.org/Mordor/orc', last_response.headers['Location']
|
assert_equal 'http://example.org/Mordor/orc', last_response.headers['Location']
|
||||||
|
|
||||||
post "/edit/Mordor/Orc", :content => 'not so big smelly creatures',
|
post "/edit/Mordor/Orc", :content => 'not so big smelly creatures',
|
||||||
|
|||||||
@@ -758,24 +758,6 @@ end
|
|||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
#########################################################################
|
|
||||||
#
|
|
||||||
# TeX
|
|
||||||
#
|
|
||||||
#########################################################################
|
|
||||||
|
|
||||||
test "TeX block syntax" do
|
|
||||||
content = 'a \[ a^2 \] b'
|
|
||||||
output = "<p>a<imgsrc=\"http://www.mathtran.org/cgi-bin/toy/?D=4;tex=a%5E2\"alt=\"a^2\">b</p>"
|
|
||||||
compare(content, output, 'md')
|
|
||||||
end
|
|
||||||
|
|
||||||
test "TeX inline syntax" do
|
|
||||||
content = 'a \( a^2 \) b'
|
|
||||||
output = "<p>a<imgsrc=\"http://www.mathtran.org/cgi-bin/toy/?D=2;tex=a%5E2\"alt=\"a^2\">b</p>"
|
|
||||||
compare(content, output, 'md')
|
|
||||||
end
|
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# Asciidoc
|
# Asciidoc
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|||||||
@@ -42,21 +42,21 @@ context "Unicode Support" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "create and read non-latin page with anchor 2" do
|
test "create and read non-latin page with anchor 2" do
|
||||||
@wiki.write_page("test", :markdown, "# La faune d'Édiacara")
|
@wiki.write_page("test", :markdown, "# \"La\" faune d'Édiacara")
|
||||||
|
|
||||||
page = @wiki.page("test")
|
page = @wiki.page("test")
|
||||||
assert_equal Gollum::Page, page.class
|
assert_equal Gollum::Page, page.class
|
||||||
assert_equal "# La faune d'Édiacara", utf8(page.raw_data)
|
assert_equal "# \"La\" faune d'Édiacara", utf8(page.raw_data)
|
||||||
|
|
||||||
# markup.rb
|
# markup.rb test: ', ", É
|
||||||
doc = Nokogiri::HTML page.formatted_data
|
doc = Nokogiri::HTML page.formatted_data
|
||||||
h1s = doc / :h1
|
h1s = doc / :h1
|
||||||
h1 = h1s.first
|
h1 = h1s.first
|
||||||
anchors = h1 / :a
|
anchors = h1 / :a
|
||||||
assert_equal 1, h1s.size
|
assert_equal 1, h1s.size
|
||||||
assert_equal 1, anchors.size
|
assert_equal 1, anchors.size
|
||||||
assert_equal %q(#La-faune-d'Édiacara), anchors[0]['href']
|
assert_equal %q(#%22La%22-faune-d'Édiacara), anchors[0]['href']
|
||||||
assert_equal %q(La-faune-d'Édiacara), anchors[0]['id']
|
assert_equal %q(%22La%22-faune-d'Édiacara), anchors[0]['id']
|
||||||
assert_equal 'anchor', anchors[0]['class']
|
assert_equal 'anchor', anchors[0]['class']
|
||||||
assert_equal '', anchors[0].text
|
assert_equal '', anchors[0].text
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user