Compare commits

...

32 Commits

Author SHA1 Message Date
bootstraponline df75d2d60c Release 2.4.0 2012-11-11 15:08:45 -07:00
bootstraponline 2713aabeaf Update gemspec 2012-11-11 15:08:21 -07:00
bootstraponline 796d1b44c2 Update README.md 2012-11-11 14:46:58 -07:00
bootstraponline 470a7b8f52 Fix #579 2012-11-11 14:40:47 -07:00
bootstraponline f699b82a9f Fix #539 2012-11-11 14:18:14 -07:00
bootstraponline 44edb8c7da Merge pull request #576 from roman-zaharenkov/title_control
Page title control
2012-11-11 12:29:37 -08:00
bootstraponline bc4fc0edd9 Fix gitcode test 2012-11-11 13:14:25 -07:00
Roman Zaharenkov 6545fa691b Adjust page header / title generation.
Now page header can be generated by first h1 header from page content. But page title generated by URL is it was before.
2012-11-11 13:22:10 +03:00
Roman Zaharenkov 4954553927 Page title control
Allow to set page title by setting header inside page body. It will use header as title If header is present and page URL otherwise.
2012-11-11 13:20:14 +03:00
bootstraponline 9c50ba9eeb XSLT was never used 2012-11-10 17:02:27 -07:00
bootstraponline 9a67da145a Merge pull request #578 from github/fileview-hover-fix
Fileview hover fix
2012-11-10 15:59:28 -08:00
bootstraponline ca7d82278c Pretty print with nokogiri 2012-11-10 16:34:37 -07:00
bootstraponline f6245c53dd Add .gitattributes 2012-11-10 12:15:20 -07:00
bootstraponline 6888420cc6 Update file_view output 2012-11-10 12:15:19 -07:00
Daniel Kimsey c5631f5b7d Fixed a:hover not highlighting the a block correctly 2012-11-10 12:15:19 -07:00
Daniel Kimsey 34e0b49d72 Refactored the template generator to use new_page method 2012-11-10 12:15:19 -07:00
Daniel Kimsey bd072264ef Line-ending fix for _styles.css 2012-11-10 12:15:19 -07:00
bootstraponline cfb2d24c71 Merge pull request #577 from dekimsey/fix-page-metadata
Renamed page.meta_data => page.metadata
2012-11-09 18:03:12 -08:00
Daniel Kimsey fe0eb72fa3 Renamed page.meta_data to page.metadata for consistency with views 2012-11-09 18:29:49 -05:00
Daniel Kimsey 2783257f06 Added page.meta_data to tests 2012-11-09 18:25:33 -05:00
bootstraponline cc11cb866c Add css note
#572
2012-11-08 18:51:57 -07:00
bootstraponline 6a02643bda Merge pull request #573 from dekimsey/license-guidelines
Added bootstraponline's comment about licensing guidelines
2012-11-08 16:12:40 -08:00
Daniel Kimsey 7f269c8da3 Added bootstraponline's comment about licensing guidelines 2012-11-08 16:46:49 -05:00
bootstraponline ef7f7cebd1 Release 2.3.12 2012-11-07 20:37:50 -07:00
bootstraponline 05c24fd5e3 Fix #570
Fix #571
2012-11-07 20:35:57 -07:00
bootstraponline b08b97bd28 Release 2.3.11 2012-11-07 20:18:43 -07:00
bootstraponline dbb6ce2f71 Fix #570
Error in gollum.js broke new page button.
2012-11-07 20:17:50 -07:00
bootstraponline f66f14b593 Release 2.3.10 2012-11-07 19:47:09 -07:00
bootstraponline 8a52315dee Add base url to custom css 2012-11-07 19:46:27 -07:00
bootstraponline 7c4052906c Add custom css 2012-11-07 19:40:52 -07:00
bootstraponline 3a56f39f6a Fix readme 2012-11-07 19:17:49 -07:00
bootstraponline 6585ca5dd0 Fix space 2012-11-07 19:13:57 -07:00
37 changed files with 432 additions and 211 deletions
+25
View File
@@ -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
+15 -1
View File
@@ -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
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
A variety of Gollum tags use a double bracket syntax. For example:
@@ -534,7 +540,15 @@ Note that filenames on windows must not contain any of the following characters
## CONFIG FILE
Gollum optionaly takes a `--config file`. See [config.rb](https://github.com/github/gollum/blob/master/config.rb) for an example.
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
+1 -1
View File
@@ -146,7 +146,7 @@ task :gemspec => :validate do
split("\n").
sort.
reject { |file| file =~ /^\./ }.
reject { |file| file =~ /^(rdoc|pkg|test|Home\.md)/ }.
reject { |file| file =~ /^(rdoc|pkg|test|Home\.md|\.gitattributes)/ }.
map { |file| " #{file}" }.
join("\n")
+7
View File
@@ -45,6 +45,10 @@ opts = OptionParser.new do |opts|
options['irb'] = true
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|
wiki_options[:page_file_dir] = path
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
wiki_options[:collapse_tree] = true
end
opts.on("--h1-title", "Sets page title to value of first h1") do
wiki_options[:h1_title] = true
end
end
# Read command line options into `options` hash
+2 -2
View File
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
s.required_ruby_version = ">= 1.8.7"
s.name = 'gollum'
s.version = '2.3.9'
s.date = '2012-11-07'
s.version = '2.4.0'
s.date = '2012-11-11'
s.rubyforge_project = 'gollum'
s.summary = "A simple, Git-powered wiki."
+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.3.9'
VERSION = '2.4.0'
def self.assets_path
::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
+3 -8
View File
@@ -22,7 +22,7 @@ module Gollum
def new_page page
name = page.name
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
def new_folder folder_path
@@ -38,10 +38,7 @@ module Gollum
end
def end_folder
<<-HTML
</ol>
</li>
HTML
"</ol></li>\n"
end
def url_for_page page
@@ -85,13 +82,11 @@ module Gollum
# Handle special case of only one folder.
if (count - folder_start == 1)
page = @pages[ folder_start ]
name = page.name
url = url_for_page page
html += <<-HTML
<li>
<label>#{::File.dirname(page.path)}</label> <input type="checkbox" #{@checked} />
<ol>
<li class="file"><a href="#{url}">#{name}</a></li>
#{new_page page}
</ol>
</li>
HTML
+4
View File
@@ -238,6 +238,8 @@ module Precious
@content = @page.formatted_data
@toc_content = wiki.universal_toc ? @page.toc_data : nil
@mathjax = wiki.mathjax
@css = wiki.css
@h1_title = wiki.h1_title
@editable = false
mustache :page
end
@@ -360,6 +362,8 @@ module Precious
@content = page.formatted_data
@toc_content = wiki.universal_toc ? @page.toc_data : nil
@mathjax = wiki.mathjax
@css = wiki.css
@h1_title = wiki.h1_title
mustache :page
elsif file = wiki.file(fullpath)
content_type file.mime_type
@@ -72,16 +72,23 @@ ol.tree
}
li.file a
{
background: url(../images/fileview/document.png) 0 0 no-repeat;
color: #fff;
padding-left: 21px;
text-decoration: none;
display: block;
display: inline-block;
}
li.file a[href *= '.pdf'] { background: url(../images/fileview/document.png) 0 0 no-repeat; }
li.file a[href *= '.html'] { background: url(../images/fileview/document.png) 0 0 no-repeat; }
li.file a[href $= '.css'] { 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; }
li.file a span.icon
{
width: 14px;
height: 18px;
background: url(../images/fileview/document.png) 0 0 no-repeat;
display: inline-block;
margin-right: 7px;
vertical-align: text-top;
}
li.file a[href *= '.pdf'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
li.file a[href *= '.html'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
li.file a[href $= '.css'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
li.file a[href $= '.js'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
li input
{
position: absolute;
@@ -225,7 +225,7 @@ $(document).ready(function() {
$("#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}}' });
});
$.GollumEditor({ NewFile: true, MarkupType: default_markup });
}
});
@@ -8,5 +8,7 @@
</div>
</div>
</div>
<script type="text/javascript">
var default_markup = '{{default_markup}}';
</script>
{{something}}
@@ -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/dialog.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]>
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/ie7.css" media="all">
+1 -1
View File
@@ -7,7 +7,7 @@ Mousetrap.bind(['e'], function( e ) {
</script>
<div id="wiki-wrapper" class="page">
<div id="head">
<h1>{{title}}</h1>
<h1>{{page_header}}</h1>
<ul class="actions">
<li class="minibutton">
{{>searchbar}}
+56 -1
View File
@@ -8,7 +8,16 @@ module Precious
DEFAULT_AUTHOR = 'you'
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
def author
@@ -80,6 +89,10 @@ module Precious
@mathjax
end
def css # custom css
@css
end
# Access to embedded metadata.
#
# Examples
@@ -90,6 +103,48 @@ module Precious
def metadata
@page.metadata
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
+22 -1
View File
@@ -168,6 +168,27 @@ module Gollum
path
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.
#
# Returns the String url_path
@@ -221,7 +242,7 @@ module Gollum
# Public: Embedded metadata.
#
# Returns Hash of metadata.
def meta_data()
def metadata()
formatted_data if markup_class.metadata == nil
markup_class.metadata
end
+10
View File
@@ -137,6 +137,14 @@ module Gollum
# Gets the boolean live preview value.
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.
#
# path - The String path to the Git repository that holds the Gollum
@@ -191,6 +199,8 @@ module Gollum
@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
# Public: check whether the wiki's git repo exists on the filesystem.
+9
View File
@@ -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/
- group-folders.svg
- group-files.svg
+1
View File
@@ -5,3 +5,4 @@ a8ad3c09dd842a3517085bfadd37718856dee813 1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e
b16b3d9fad9d78e5a669e7f33d94c96da374eccd b0de6e794dfdc7ef3400e894225bfe23308aae5c kristi <kristi.dev@gmail.com> 1336984025 -0700 push
b0de6e794dfdc7ef3400e894225bfe23308aae5c cfea406f5f77afc7fb673a43e97721234385b1bd Darren Oakley <daz.oakley@gmail.com> 1341830099 +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
b0de6e794dfdc7ef3400e894225bfe23308aae5c cfea406f5f77afc7fb673a43e97721234385b1bd Darren Oakley <daz.oakley@gmail.com> 1341830099 +0100 push
cfea406f5f77afc7fb673a43e97721234385b1bd 629aa678272b017a4d136d35e77ac94d80b08dc2 Darren Oakley <daz.oakley@gmail.com> 1341830833 +0100 push
629aa678272b017a4d136d35e77ac94d80b08dc2 7d6aeab8b84c895f21f6c66b84a457b0fced9693 Daniel Kimsey <dekimsey@ufl.edu> 1352501984 -0500 push
@@ -0,0 +1,2 @@
xEOK1 Å=÷S<ëEaºzEYð ]¼g·™™`¦•´3ê··ãù½—4ps}{¶=!gtä;°ö.„{wZNѹ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ú
@@ -0,0 +1 @@
xÎ=j1@áÔ:Åt®ô?cC\ù³šY¼Ú
+1 -1
View File
@@ -1 +1 @@
629aa678272b017a4d136d35e77ac94d80b08dc2
7d6aeab8b84c895f21f6c66b84a457b0fced9693
+3 -1
View File
@@ -1,3 +1,5 @@
<ol class="tree">
<li class="file"><a href="0">0</a></li>
<li class="file">
<a href="0"><span class="icon"></span>0</a>
</li>
</ol>
+5 -2
View File
@@ -1,8 +1,11 @@
<ol class="tree">
<li>
<label>folder0</label> <input type="checkbox" checked />
<label>folder0</label>
<input type="checkbox" />
<ol>
<li class="file"><a href="folder0/0">0</a></li>
<li class="file">
<a href="folder0/0"><span class="icon"></span>0</a>
</li>
</ol>
</li>
</ol>
+5 -2
View File
@@ -1,8 +1,11 @@
<ol class="tree">
<li>
<label>.</label> <input type="checkbox" checked />
<label>.</label>
<input type="checkbox" />
<ol>
<li class="file"><a href="folder0">folder0</a></li>
<li class="file">
<a href="folder0"><span class="icon"></span>folder0</a>
</li>
</ol>
</li>
</ol>
+12 -4
View File
@@ -1,12 +1,20 @@
<ol class="tree">
<li>
<label>folder0</label> <input type="checkbox" checked />
<label>folder0</label>
<input type="checkbox" />
<ol>
<li class="file"><a href="folder0/0">0</a></li>
<li class="file">
<a href="folder0/0"><span class="icon"></span>0</a>
</li>
</ol>
</li>
<li>
<label>folder1</label> <input type="checkbox" checked />
<label>folder1</label>
<input type="checkbox" />
<ol>
<li class="file"><a href="folder1/1">1</a></li>
<li class="file">
<a href="folder1/1"><span class="icon"></span>1</a>
</li>
</ol>
</li>
</ol>
+15 -5
View File
@@ -1,13 +1,23 @@
<ol class="tree">
<li class="file"><a href="root">root</a></li>
<li class="file">
<a href="root"><span class="icon"></span>root</a>
</li>
<li>
<label>folder0</label> <input type="checkbox" checked />
<label>folder0</label>
<input type="checkbox" />
<ol>
<li class="file"><a href="folder0/0">0</a></li>
<li class="file">
<a href="folder0/0"><span class="icon"></span>0</a>
</li>
</ol>
</li>
<li>
<label>folder1</label> <input type="checkbox" checked />
<label>folder1</label>
<input type="checkbox" />
<ol>
<li class="file"><a href="folder1/1">1</a></li>
<li class="file">
<a href="folder1/1"><span class="icon"></span>1</a>
</li>
</ol>
</li>
</ol>
+21 -8
View File
@@ -1,20 +1,28 @@
<ol class="tree">
<li>
<label>folder0</label> <input type="checkbox" checked />
<label>folder0</label>
<input type="checkbox" />
<ol>
<li>
<label>folder1</label> <input type="checkbox" checked />
<label>folder1</label>
<input type="checkbox" />
<ol>
<li>
<label>folder2</label> <input type="checkbox" checked />
<label>folder2</label>
<input type="checkbox" />
<ol>
<li class="file"><a href="folder0/folder1/folder2/0">0</a></li>
<li class="file">
<a href="folder0/folder1/folder2/0"><span class="icon"></span>0</a>
</li>
</ol>
</li>
<li>
<label>folder3</label> <input type="checkbox" checked />
<label>folder3</label>
<input type="checkbox" />
<ol>
<li class="file"><a href="folder0/folder1/folder3/1">1</a></li>
<li class="file">
<a href="folder0/folder1/folder3/1"><span class="icon"></span>1</a>
</li>
</ol>
</li>
</ol>
@@ -22,7 +30,12 @@
</ol>
</li>
<li>
<label>folder4</label> <input type="checkbox" checked />
<label>folder4</label>
<input type="checkbox" />
<ol>
<li class="file"><a href="folder4/2">2</a></li>
<li class="file">
<a href="folder4/2"><span class="icon"></span>2</a>
</li>
</ol>
</li>
</ol>
+1 -1
View File
@@ -50,7 +50,7 @@ context "Wiki" do
end
test "parents with default master ref" do
ref = '629aa678272b017a4d136d35e77ac94d80b08dc2'
ref = '7d6aeab8b84c895f21f6c66b84a457b0fced9693'
committer = Gollum::Committer.new(@wiki)
assert_equal ref, committer.parents.first.sha
end
+15 -1
View File
@@ -68,10 +68,24 @@ def write file, content
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
pages = FakePages.new pages_array
expected = read name
actual = view pages
actual = to_html view pages
# Uncomment when updating tests
# write name, actual
assert_equal expected, actual
end
+1 -1
View File
@@ -18,7 +18,7 @@ context "GitAccess" do
assert @access.ref_map.empty?
assert @access.tree_map.empty?
@access.tree 'master'
assert_equal({"master"=>"629aa678272b017a4d136d35e77ac94d80b08dc2"}, @access.ref_map)
assert_equal({"master"=>"7d6aeab8b84c895f21f6c66b84a457b0fced9693"}, @access.ref_map)
@access.tree '1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e3'
map = @access.tree_map['1db89ebba7e2c14d93b94ff98cfa3708a4f0d4e3']
+2 -4
View File
@@ -25,15 +25,13 @@ context "gitcode" do
end
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\">&lt;ol</span> <span class=\"na\">class=</span><span class=\"s\">\"tree\"</span><span class=\"nt\">&gt;</span>\n <span class=\"nt\">&lt;li</span> <span class=\"na\">class=</span><span class=\"s\">\"file\"</span><span class=\"nt\">&gt;&lt;a</span> <span class=\"na\">href=</span><span class=\"s\">\"0\"</span><span class=\"nt\">&gt;</span>0<span class=\"nt\">&lt;/a&gt;&lt;/li&gt;</span>\n<span class=\"nt\">&lt;/ol&gt;</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\">&lt;ol</span> <span class=\"na\">class=</span><span class=\"s\">\"tree\"</span><span class=\"nt\">&gt;</span>\n <span class=\"nt\">&lt;li</span> <span class=\"na\">class=</span><span class=\"s\">\"file\"</span><span class=\"nt\">&gt;</span>\n <span class=\"nt\">&lt;a</span> <span class=\"na\">href=</span><span class=\"s\">\"0\"</span><span class=\"nt\">&gt;&lt;span</span> <span class=\"na\">class=</span><span class=\"s\">\"icon\"</span><span class=\"nt\">&gt;&lt;/span&gt;</span>0<span class=\"nt\">&lt;/a&gt;</span>\n <span class=\"nt\">&lt;/li&gt;</span>\n<span class=\"nt\">&lt;/ol&gt;</span>\n</pre></div>\n\n<p>b</p>}, @rendered
end
test 'contents' do
g = Gollum::Gitcode.new 'github/gollum/master/test/file_view/1_file.txt'
assert_equal g.contents, %{<ol class="tree">
<li class="file"><a href="0">0</a></li>
</ol>}
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}
end
teardown do
+3 -3
View File
@@ -656,7 +656,7 @@ np.array([[2,2],[1,3]],np.float)
page = @wiki.page("Bilbo Baggins")
rendered = Gollum::Markup.new(page).render
assert_equal output, rendered
assert_equal result, page.meta_data
assert_equal result, page.metadata
end
test "metadata blocks with newline" do
@@ -671,7 +671,7 @@ np.array([[2,2],[1,3]],np.float)
page = @wiki.page("Bilbo Baggins")
rendered = Gollum::Markup.new(page).render
assert_equal output, rendered
assert_equal result, page.meta_data
assert_equal result, page.metadata
end
test "metadata sanitation" do
@@ -686,7 +686,7 @@ np.array([[2,2],[1,3]],np.float)
page = @wiki.page("Bilbo Baggins")
rendered = Gollum::Markup.new(page).render
assert_equal output, rendered
assert_equal result, page.meta_data
assert_equal result, page.metadata
end
#########################################################################
+7
View File
@@ -227,5 +227,12 @@ context "within a sub-directory" do
assert page.header.raw_data =~ /^Hobbits/
assert page.footer.raw_data =~ /^Lord of the Rings/
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
+8
View File
@@ -198,6 +198,14 @@ context "Wiki page writing" do
assert_equal cd[:email], @wiki.repo.commits.first.author.email
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
@wiki.write_page("Gollum", :markdown, "# Gollum", commit_details)