Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e87142ef19 | |||
| aa823b5a2d | |||
| 9012dee888 | |||
| 81d5f1a8bb | |||
| d2b0a22a8f | |||
| 355e6b1f18 | |||
| 7a2c9107c3 | |||
| 127473fff8 | |||
| 9a79b0a800 | |||
| ca13298d00 | |||
| eaf82e6367 | |||
| cae290ded7 | |||
| a22208a0be | |||
| bc877dc9dc | |||
| 40b1775d42 | |||
| c2dc605adb | |||
| a1e1af07a4 | |||
| 76948130f6 | |||
| f71ba31bfe | |||
| b7caa228e6 | |||
| 0101dd2f65 | |||
| c8baa61fe3 | |||
| 104335706a |
+2
-1
@@ -1,7 +1,8 @@
|
||||
rvm:
|
||||
- 2.4.0
|
||||
- 2.6.0
|
||||
- jruby-9.2.9.0
|
||||
- 3.0.0
|
||||
- jruby-9.2.18.0
|
||||
jdk:
|
||||
- oraclejdk9
|
||||
before_install:
|
||||
|
||||
@@ -62,6 +62,8 @@ Pull Requests fixing bugs, implementing new features, or updating documentation
|
||||
```
|
||||
bundle exec rake test
|
||||
```
|
||||
|
||||
To profile slow tests, you can use `bundle exec rake test TESTOPTS="--verbose"`.
|
||||
|
||||
### Working with test repositories
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# 5.2.3 2021-04-18
|
||||
|
||||
* Fix bug preventing page titles from being displayed
|
||||
|
||||
# 5.2.1 2021-02-25
|
||||
|
||||
* Fix include call to a missing asset (@benjaminwil). This caused slow first page loads on JRuby.
|
||||
|
||||
+8
-8
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
|
||||
s.required_ruby_version = '>= 1.9'
|
||||
|
||||
s.name = 'gollum'
|
||||
s.version = '5.2.1'
|
||||
s.date = '2021-02-25'
|
||||
s.version = '5.2.3'
|
||||
s.date = '2021-04-18'
|
||||
s.license = 'MIT'
|
||||
|
||||
s.summary = 'A simple, Git-powered wiki.'
|
||||
@@ -38,6 +38,7 @@ Gem::Specification.new do |s|
|
||||
s.add_dependency 'sprockets-helpers', '~> 1.2'
|
||||
s.add_dependency 'rss', '~> 0.2.9'
|
||||
s.add_dependency 'therubyrhino', '~> 2.1.0'
|
||||
s.add_dependency 'webrick', '~> 1.7'
|
||||
|
||||
s.add_development_dependency 'rack-test', '~> 0.6.3'
|
||||
s.add_development_dependency 'shoulda', '~> 3.6.0'
|
||||
@@ -45,7 +46,6 @@ Gem::Specification.new do |s|
|
||||
s.add_development_dependency 'twitter_cldr', '~> 3.2.0'
|
||||
s.add_development_dependency 'mocha', '~> 1.8.0'
|
||||
s.add_development_dependency 'test-unit', '~> 3.3.0'
|
||||
s.add_development_dependency 'webrick', '~> 1.4.2'
|
||||
|
||||
# = MANIFEST =
|
||||
s.files = %w[
|
||||
@@ -69,11 +69,11 @@ Gem::Specification.new do |s|
|
||||
lib/gollum/app.rb
|
||||
lib/gollum/assets.rb
|
||||
lib/gollum/helpers.rb
|
||||
lib/gollum/public/assets/.sprockets-manifest-15b663a27211dc9de9a452b4b74462d7.json
|
||||
lib/gollum/public/assets/app-7a0bbff2e8bad3033e7c17e0e0f886f336a9d23d3b912dcd2ae389c48b4b63e6.css
|
||||
lib/gollum/public/assets/app-7a0bbff2e8bad3033e7c17e0e0f886f336a9d23d3b912dcd2ae389c48b4b63e6.css.gz
|
||||
lib/gollum/public/assets/app-7a4bd115f4bc7ece39bc8073ca0ffad7c5e55cc5837b1464a12dead4905cefb2.js
|
||||
lib/gollum/public/assets/app-7a4bd115f4bc7ece39bc8073ca0ffad7c5e55cc5837b1464a12dead4905cefb2.js.gz
|
||||
lib/gollum/public/assets/.sprockets-manifest-de7bb79aec424e55af1acdcc4237b301.json
|
||||
lib/gollum/public/assets/app-0fd228e26bfbe6fe31a2da268eb0e98e780c1191c1a918adf383377946e9c838.js
|
||||
lib/gollum/public/assets/app-0fd228e26bfbe6fe31a2da268eb0e98e780c1191c1a918adf383377946e9c838.js.gz
|
||||
lib/gollum/public/assets/app-ad43ca64b295d8444b10f22ee868f18429268af498f1bc515434878b690e37a2.css
|
||||
lib/gollum/public/assets/app-ad43ca64b295d8444b10f22ee868f18429268af498f1bc515434878b690e37a2.css.gz
|
||||
lib/gollum/public/assets/criticmarkup-31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4.css
|
||||
lib/gollum/public/assets/criticmarkup-31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4.css.gz
|
||||
lib/gollum/public/assets/editor-db10c8351306e92f1926ba225d0cd9c8e886482b3b9820a85825ec3abab5f1cf.js
|
||||
|
||||
+1
-17
@@ -12,27 +12,11 @@ require 'rhino' if RUBY_PLATFORM == 'java'
|
||||
require File.expand_path('../gollum/uri_encode_component', __FILE__)
|
||||
|
||||
module Gollum
|
||||
VERSION = '5.2.1'
|
||||
VERSION = '5.2.3'
|
||||
|
||||
def self.assets_path
|
||||
::File.expand_path('gollum/public', ::File.dirname(__FILE__))
|
||||
end
|
||||
|
||||
class Error < StandardError;
|
||||
end
|
||||
|
||||
class DuplicatePageError < Error
|
||||
attr_accessor :dir
|
||||
attr_accessor :existing_path
|
||||
attr_accessor :attempted_path
|
||||
|
||||
def initialize(dir, existing, attempted, message = nil)
|
||||
@dir = dir
|
||||
@existing_path = existing
|
||||
@attempted_path = attempted
|
||||
super(message || "Cannot write #{@dir}/#{@attempted_path}, found #{@dir}/#{@existing_path}.")
|
||||
end
|
||||
end
|
||||
|
||||
class TemplateFilter
|
||||
@@filters = {}
|
||||
|
||||
+17
-14
@@ -1,4 +1,5 @@
|
||||
# ~*~ encoding: utf-8 ~*~
|
||||
# encoding: UTF-8
|
||||
|
||||
require 'cgi'
|
||||
require 'sinatra'
|
||||
require 'sinatra/namespace'
|
||||
@@ -40,7 +41,7 @@ Gollum::set_git_max_filesize(190 * 10**6)
|
||||
# See the wiki.rb file for more details on wiki options
|
||||
|
||||
module Precious
|
||||
|
||||
|
||||
# For use with the --base-path option.
|
||||
class MapGollum
|
||||
def initialize(base_path)
|
||||
@@ -63,12 +64,14 @@ module Precious
|
||||
@mg.call(env)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
class App < Sinatra::Base
|
||||
register Mustache::Sinatra
|
||||
register Sinatra::Namespace
|
||||
include Precious::Helpers
|
||||
|
||||
|
||||
Encoding.default_external = "UTF-8"
|
||||
|
||||
dir = File.dirname(File.expand_path(__FILE__))
|
||||
|
||||
set :sprockets, ::Precious::Assets.sprockets(dir)
|
||||
@@ -102,7 +105,7 @@ module Precious
|
||||
@critic_markup = settings.wiki_options[:critic_markup]
|
||||
@redirects_enabled = settings.wiki_options.fetch(:redirects_enabled, true)
|
||||
@per_page_uploads = settings.wiki_options[:per_page_uploads]
|
||||
|
||||
|
||||
@wiki_title = settings.wiki_options.fetch(:title, 'Gollum Wiki')
|
||||
|
||||
forbid unless @allow_editing || request.request_method == 'GET'
|
||||
@@ -117,10 +120,10 @@ module Precious
|
||||
@js = settings.wiki_options[:js]
|
||||
@mathjax_config = settings.wiki_options[:mathjax_config]
|
||||
|
||||
@use_static_assets = settings.wiki_options.fetch(:static, settings.environment == :production || settings.environment == :staging)
|
||||
@use_static_assets = settings.wiki_options.fetch(:static, settings.environment != :development)
|
||||
@static_assets_path = settings.wiki_options.fetch(:static_assets_path, ::File.join(File.dirname(__FILE__), 'public/assets'))
|
||||
@mathjax_path = ::File.join(File.dirname(__FILE__), 'public/gollum/javascript/MathJax')
|
||||
|
||||
|
||||
Sprockets::Helpers.configure do |config|
|
||||
config.environment = settings.sprockets
|
||||
config.environment.context_class.class_variable_set(:@@base_url, @base_url)
|
||||
@@ -219,7 +222,7 @@ module Precious
|
||||
|
||||
# AJAX calls only
|
||||
post '/upload_file' do
|
||||
|
||||
|
||||
wiki = wiki_new
|
||||
halt 405 unless wiki.allow_uploads
|
||||
|
||||
@@ -235,7 +238,7 @@ module Precious
|
||||
dir.sub!(/^#{wiki.base_path}/, '') if wiki.base_path
|
||||
# remove base_url and gollum/* subpath if necessary
|
||||
dir.sub!(/^\/gollum\/[-\w]+\//, '')
|
||||
# remove file extension
|
||||
# remove file extension
|
||||
dir.sub!(/#{::File.extname(dir)}$/, '')
|
||||
# revert escaped whitespaces
|
||||
dir.gsub!(/%20/, ' ')
|
||||
@@ -317,7 +320,7 @@ module Precious
|
||||
end
|
||||
|
||||
post '/edit/*' do
|
||||
etag = params[:etag]
|
||||
etag = params[:etag]
|
||||
path = "/#{clean_url(sanitize_empty_params(params[:path]))}"
|
||||
wiki = wiki_new
|
||||
page = wiki.page(::File.join(path, params[:page]))
|
||||
@@ -327,7 +330,7 @@ module Precious
|
||||
# Signal edit collision and return the page's most recent version
|
||||
halt 412, {etag: page.sha, text_data: page.text_data}.to_json
|
||||
end
|
||||
|
||||
|
||||
committer = Gollum::Committer.new(wiki, commit_message)
|
||||
commit = { :committer => committer }
|
||||
|
||||
@@ -348,7 +351,7 @@ module Precious
|
||||
commit[:message] = "Deleted #{filepath}"
|
||||
wiki.delete_file(filepath, commit)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
get '/create/*' do
|
||||
forbid unless @allow_editing
|
||||
@@ -625,7 +628,7 @@ module Precious
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def show_file(file)
|
||||
return unless file
|
||||
if file.on_disk?
|
||||
@@ -683,4 +686,4 @@ module Precious
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"files":{"app-7a4bd115f4bc7ece39bc8073ca0ffad7c5e55cc5837b1464a12dead4905cefb2.js":{"logical_path":"app.js","mtime":"2021-02-24T23:16:14-08:00","size":135925,"digest":"7a4bd115f4bc7ece39bc8073ca0ffad7c5e55cc5837b1464a12dead4905cefb2","integrity":"sha256-ekvRFfS8fs45vIBzyg/618XlXMWDexRkoS3q1JBc77I="},"editor-db10c8351306e92f1926ba225d0cd9c8e886482b3b9820a85825ec3abab5f1cf.js":{"logical_path":"editor.js","mtime":"2021-02-24T23:16:14-08:00","size":744866,"digest":"db10c8351306e92f1926ba225d0cd9c8e886482b3b9820a85825ec3abab5f1cf","integrity":"sha256-2xDINRMG6S8ZJroiXQzZyOiGSCs7mCCoWCXsOrq18c8="},"app-7a0bbff2e8bad3033e7c17e0e0f886f336a9d23d3b912dcd2ae389c48b4b63e6.css":{"logical_path":"app.css","mtime":"2021-02-24T23:16:14-08:00","size":396661,"digest":"7a0bbff2e8bad3033e7c17e0e0f886f336a9d23d3b912dcd2ae389c48b4b63e6","integrity":"sha256-egu/8ui60wM+fBfg4PiG8zap0j07kS3NKuOJxItLY+Y="},"criticmarkup-31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4.css":{"logical_path":"criticmarkup.css","mtime":"2021-02-24T23:16:14-08:00","size":646,"digest":"31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4","integrity":"sha256-Ma5dMoK7uOe3w8mRfp+2jjMVprSnXabOxI0huIRpBcQ="},"print-512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb.css":{"logical_path":"print.css","mtime":"2021-02-24T23:16:14-08:00","size":75,"digest":"512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb","integrity":"sha256-USSYw2i+DT+xuhBd+oQomuSDgOyfy++Ui9TiOwsJW/s="}},"assets":{"app.js":"app-7a4bd115f4bc7ece39bc8073ca0ffad7c5e55cc5837b1464a12dead4905cefb2.js","editor.js":"editor-db10c8351306e92f1926ba225d0cd9c8e886482b3b9820a85825ec3abab5f1cf.js","app.css":"app-7a0bbff2e8bad3033e7c17e0e0f886f336a9d23d3b912dcd2ae389c48b4b63e6.css","criticmarkup.css":"criticmarkup-31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4.css","print.css":"print-512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb.css"}}
|
||||
{"files":{"app-0fd228e26bfbe6fe31a2da268eb0e98e780c1191c1a918adf383377946e9c838.js":{"logical_path":"app.js","mtime":"2021-03-23T08:40:11-07:00","size":136020,"digest":"0fd228e26bfbe6fe31a2da268eb0e98e780c1191c1a918adf383377946e9c838","integrity":"sha256-D9Io4mv75v4xotomjrDpjngMEZHBqRit84M3eUbpyDg="},"editor-db10c8351306e92f1926ba225d0cd9c8e886482b3b9820a85825ec3abab5f1cf.js":{"logical_path":"editor.js","mtime":"2021-02-24T23:16:14-08:00","size":744866,"digest":"db10c8351306e92f1926ba225d0cd9c8e886482b3b9820a85825ec3abab5f1cf","integrity":"sha256-2xDINRMG6S8ZJroiXQzZyOiGSCs7mCCoWCXsOrq18c8="},"app-ad43ca64b295d8444b10f22ee868f18429268af498f1bc515434878b690e37a2.css":{"logical_path":"app.css","mtime":"2021-03-23T08:40:11-07:00","size":396615,"digest":"ad43ca64b295d8444b10f22ee868f18429268af498f1bc515434878b690e37a2","integrity":"sha256-rUPKZLKV2ERLEPIu6GjxhCkmivSY8bxRVDSHi2kON6I="},"criticmarkup-31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4.css":{"logical_path":"criticmarkup.css","mtime":"2021-02-24T23:16:14-08:00","size":646,"digest":"31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4","integrity":"sha256-Ma5dMoK7uOe3w8mRfp+2jjMVprSnXabOxI0huIRpBcQ="},"print-512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb.css":{"logical_path":"print.css","mtime":"2021-02-24T23:16:14-08:00","size":75,"digest":"512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb","integrity":"sha256-USSYw2i+DT+xuhBd+oQomuSDgOyfy++Ui9TiOwsJW/s="}},"assets":{"app.js":"app-0fd228e26bfbe6fe31a2da268eb0e98e780c1191c1a918adf383377946e9c838.js","editor.js":"editor-db10c8351306e92f1926ba225d0cd9c8e886482b3b9820a85825ec3abab5f1cf.js","app.css":"app-ad43ca64b295d8444b10f22ee868f18429268af498f1bc515434878b690e37a2.css","criticmarkup.css":"criticmarkup-31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4.css","print.css":"print-512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb.css"}}
|
||||
+2
-2
File diff suppressed because one or more lines are too long
BIN
Binary file not shown.
+1
-1
File diff suppressed because one or more lines are too long
BIN
Binary file not shown.
@@ -380,8 +380,12 @@ $(document).ready(function() {
|
||||
active_tab = '#edit.tabnav-tab';
|
||||
}
|
||||
|
||||
$('.tabnav-tab.selected').removeAttr('aria-current');
|
||||
$('.tabnav-tab.selected').removeClass('selected');
|
||||
|
||||
$(active_tab).attr('aria-current', 'page');
|
||||
$(active_tab).addClass('selected');
|
||||
|
||||
$('.tabnav-div').hide();
|
||||
$(active_div).show();
|
||||
}
|
||||
|
||||
@@ -147,7 +147,3 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#gollum-dialog-dialog-buttons {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@@ -4,13 +4,15 @@
|
||||
<h1 class="py-4">Create New Page</h1>
|
||||
</div>
|
||||
<div id="wiki-content" class="create edit">
|
||||
<div class="tabnav">
|
||||
<nav class="tabnav-tabs" aria-label="Foo bar">
|
||||
<a href="#" id="edit" class="tabnav-tab selected" aria-current="edit">Edit</a>
|
||||
<a href="#" id="preview" class="tabnav-tab" aria-current="preview">Preview</a>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div class="tabnav">
|
||||
<nav class="tabnav-tabs" aria-label="Toggle edit or preview mode">
|
||||
<a href="#" id="edit" class="tabnav-tab selected" aria-current="page">
|
||||
Edit
|
||||
</a>
|
||||
<a href="#" id="preview" class="tabnav-tab">Preview</a>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div class="has-sidebar tabnav-div" id="edit-content">
|
||||
{{>editor}}
|
||||
</div>
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
</div>
|
||||
<div class="tabnav">
|
||||
<nav class="tabnav-tabs">
|
||||
<a href="#" id="edit" class="tabnav-tab selected" aria-current="edit">Edit</a>
|
||||
<a href="#" id="preview" class="tabnav-tab" aria-current="preview">Preview</a>
|
||||
<a href="#" id="edit" class="tabnav-tab selected" aria-current="page">
|
||||
Edit
|
||||
</a>
|
||||
<a href="#" id="preview" class="tabnav-tab">Preview</a>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="tabnav-div" id="edit-content">{{>editor}}</div>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<button class="btn btn-sm function-button" id="function-h3" title="Heading 3">h3</button>
|
||||
<span class="pr-2"></span>
|
||||
<button class="btn btn-sm function-button" id="function-link" title="Link">{{#octicon}}link{{/octicon}}</button>
|
||||
<button class="btn btn-sm function-button" id="function-image" title="Image">{{#octicon}}file-media{{/octicon}}</button>
|
||||
<button class="btn btn-sm function-button" id="function-image" title="Image">{{#octicon}}image{{/octicon}}</button>
|
||||
<span class="pr-2"></span>
|
||||
{{#critic_markup}}
|
||||
<button class="btn btn-sm function-button" id="function-critic-accept" title="Accept Selected CriticMarkup">{{#octicon}}plus{{/octicon}}</button>
|
||||
|
||||
@@ -1,105 +1,103 @@
|
||||
<nav class="actions pt-4 px-2 px-lg-0 overflow-x-scroll">
|
||||
<div class="TableObject">
|
||||
<div class="TableObject-item hide-lg hide-xl">
|
||||
{{>mobilenav}}
|
||||
</div>
|
||||
<nav class="TableObject actions pt-4 px-2 px-lg-0 overflow-x-scroll">
|
||||
<div class="TableObject-item hide-lg hide-xl">
|
||||
{{>mobilenav}}
|
||||
</div>
|
||||
|
||||
<div class="TableObject-item hide-sm hide-md">
|
||||
<a class="btn btn-sm" id="minibutton-home" href="{{page_route}}">
|
||||
Home
|
||||
</a>
|
||||
</div>
|
||||
<div class="TableObject-item hide-sm hide-md">
|
||||
<a class="btn btn-sm" id="minibutton-home" href="{{page_route}}">
|
||||
Home
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="TableObject-item TableObject-item--primary px-2"
|
||||
{{^search}}style="visibility:hidden"{{/search}}
|
||||
>
|
||||
{{>searchbar}}
|
||||
</div>
|
||||
<div
|
||||
class="TableObject-item TableObject-item--primary px-2"
|
||||
{{^search}}style="visibility:hidden"{{/search}}
|
||||
>
|
||||
{{>searchbar}}
|
||||
</div>
|
||||
|
||||
<div class="TableObject-item hide-sm hide-md">
|
||||
<div class="BtnGroup" style="display: flex;">
|
||||
{{#overview}}
|
||||
<a
|
||||
class="btn BtnGroup-item btn-sm"
|
||||
href="{{overview_path}}"
|
||||
id="minibutton-overview"
|
||||
>
|
||||
Overview
|
||||
</a>
|
||||
{{/overview}}
|
||||
|
||||
{{#latest_changes}}
|
||||
<a
|
||||
class="btn BtnGroup-item btn-sm"
|
||||
href="{{latest_changes_path}}"
|
||||
id="minibutton-latest-changes"
|
||||
>
|
||||
Latest Changes
|
||||
</a>
|
||||
{{/latest_changes}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{#history}}
|
||||
<div class="TableObject-item pl-2 hide-sm hide-md">
|
||||
<div class="TableObject-item hide-sm hide-md">
|
||||
<div class="BtnGroup d-flex">
|
||||
{{#overview}}
|
||||
<a
|
||||
class="btn btn-sm"
|
||||
class="btn BtnGroup-item btn-sm"
|
||||
href="{{overview_path}}"
|
||||
id="minibutton-overview"
|
||||
>
|
||||
Overview
|
||||
</a>
|
||||
{{/overview}}
|
||||
|
||||
{{#latest_changes}}
|
||||
<a
|
||||
class="btn BtnGroup-item btn-sm"
|
||||
href="{{latest_changes_path}}"
|
||||
id="minibutton-latest-changes"
|
||||
>
|
||||
Latest Changes
|
||||
</a>
|
||||
{{/latest_changes}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="TableObject-item px-2">
|
||||
<div class="BtnGroup d-flex">
|
||||
{{#history}}
|
||||
<a
|
||||
class="btn BtnGroup-item btn-sm hide-sm hide-md"
|
||||
href="{{history_path}}/{{escaped_url_path}}"
|
||||
id="minibutton-history"
|
||||
>
|
||||
Page History
|
||||
History
|
||||
</a>
|
||||
{{/history}}
|
||||
|
||||
{{#allow_editing}}
|
||||
{{#allow_uploads}}
|
||||
<button
|
||||
class="btn BtnGroup-item btn-sm hide-sm hide-md
|
||||
minibutton-upload-page"
|
||||
>
|
||||
Upload
|
||||
</button>
|
||||
{{/allow_uploads}}
|
||||
|
||||
{{#editable}}
|
||||
<button
|
||||
class="btn BtnGroup-item btn-sm hide-sm hide-md
|
||||
minibutton-rename-page"
|
||||
>
|
||||
Rename
|
||||
</button>
|
||||
<a
|
||||
class="btn BtnGroup-item btn-sm hide-sm hide-md"
|
||||
href="{{edit_path}}/{{escaped_url_path}}"
|
||||
id="minibutton-edit-page"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
{{/editable}}
|
||||
{{/allow_editing}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{#allow_editing}}
|
||||
{{#editable}}
|
||||
<div class="TableObject-item">
|
||||
<a class="btn btn-primary btn-sm minibutton-new-page" href="#">
|
||||
New
|
||||
</a>
|
||||
</div>
|
||||
{{/history}}
|
||||
{{/editable}}
|
||||
|
||||
{{#allow_editing}}
|
||||
<div class="TableObject-item px-2">
|
||||
<div class="BtnGroup" style="display: flex;">
|
||||
{{#allow_uploads}}
|
||||
<a
|
||||
class="btn BtnGroup-item btn-sm hide-sm hide-md
|
||||
minibutton-upload-page"
|
||||
>
|
||||
Upload
|
||||
</a>
|
||||
{{/allow_uploads}}
|
||||
|
||||
{{#editable}}
|
||||
<a
|
||||
class="btn BtnGroup-item btn-sm hide-sm hide-md
|
||||
minibutton-rename-page"
|
||||
>
|
||||
Rename
|
||||
</a>
|
||||
<a
|
||||
class="btn BtnGroup-item btn-sm hide-sm hide-md"
|
||||
href="{{edit_path}}/{{escaped_url_path}}"
|
||||
id="minibutton-edit-page"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
{{/editable}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{#editable}}
|
||||
{{^editable}}
|
||||
{{#newable}}
|
||||
<div class="TableObject-item">
|
||||
<a class="btn btn-primary btn-sm minibutton-new-page" href="#">
|
||||
New
|
||||
</a>
|
||||
</div>
|
||||
{{/editable}}
|
||||
|
||||
{{^editable}}
|
||||
{{#newable}}
|
||||
<div class="TableObject-item">
|
||||
<a class="btn btn-primary btn-sm minibutton-new-page" href="#">
|
||||
New
|
||||
</a>
|
||||
</div>
|
||||
{{/newable}}
|
||||
{{/editable}}
|
||||
{{/allow_editing}}
|
||||
</div>
|
||||
{{/newable}}
|
||||
{{/editable}}
|
||||
{{/allow_editing}}
|
||||
</nav>
|
||||
|
||||
@@ -47,7 +47,7 @@ module Precious
|
||||
end
|
||||
|
||||
def mathjax_js
|
||||
page_route("gollum/assets/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML")
|
||||
"#{page_route('gollum/assets/mathjax/MathJax.js')}?config=TeX-AMS-MML_HTMLorMML"
|
||||
end
|
||||
|
||||
def css # custom css
|
||||
|
||||
@@ -16,6 +16,11 @@ module Precious
|
||||
DEFAULT_AUTHOR = 'you'
|
||||
@@to_xml = { :save_with => Nokogiri::XML::Node::SaveOptions::DEFAULT_XHTML ^ 1, :indent => 0, :encoding => 'UTF-8' }
|
||||
|
||||
def title
|
||||
h1 = @h1_title ? page_header_from_content(@content) : false
|
||||
h1 || @page.url_path_title # url_path_title is the metadata title if present, otherwise the filename-based title
|
||||
end
|
||||
|
||||
def page_header
|
||||
title
|
||||
end
|
||||
@@ -263,11 +268,6 @@ module Precious
|
||||
end
|
||||
result << "</tr>\n</table>\n"
|
||||
end
|
||||
|
||||
def title
|
||||
h1 = @h1_title ? page_header_from_content(@content) : false
|
||||
h1 || @page.url_path_title # url_path_title is the metadata title if present, otherwise the filename-based title
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+1
-1
@@ -953,7 +953,7 @@ context 'Frontend with base path' do
|
||||
test 'base path mathjax assets' do
|
||||
get '/wiki/Home'
|
||||
assert last_response.ok?
|
||||
assert last_response.body.include?('<script defer src="/wiki/gollum/assets/mathjax/MathJax.js')
|
||||
assert last_response.body.include?('<script defer src="/wiki/gollum/assets/mathjax/MathJax.js?config=')
|
||||
end
|
||||
|
||||
test 'compare view' do
|
||||
|
||||
+25
-1
@@ -38,7 +38,31 @@ context "Precious::Views::Page" do
|
||||
assert_include @view.breadcrumb, "数学 📘"
|
||||
end
|
||||
|
||||
test "page header retains unicde and ASCII characters" do
|
||||
test 'page <title> is the page header from content, if present' do
|
||||
page_title = 'Page header from content'
|
||||
@wiki.write_page(page_title, :markdown, 'Contents', commit_details)
|
||||
|
||||
@view = Precious::Views::Page.new.tap do |view|
|
||||
view.instance_variable_set :@page, @wiki.page(page_title)
|
||||
view.instance_variable_set :@h1_title, true
|
||||
end
|
||||
|
||||
assert_equal @view.title, 'Page header from content'
|
||||
end
|
||||
|
||||
test 'page <title> is URL path title if no h1 present' do
|
||||
@wiki.write_page('dir/My path title', :markdown, 'Contents', commit_details)
|
||||
page = @wiki.page('dir/My path title')
|
||||
|
||||
@view = Precious::Views::Page.new.tap do |view|
|
||||
view.instance_variable_set :@page, page
|
||||
view.instance_variable_set :@h1_title, false
|
||||
end
|
||||
|
||||
assert_equal @view.title, 'My path title'
|
||||
end
|
||||
|
||||
test "page header retains unicode and ASCII characters" do
|
||||
title = "数学 📘"
|
||||
@wiki.write_page(title, :markdown, "How old is Bilbo?")
|
||||
page = @wiki.page(title)
|
||||
|
||||
Reference in New Issue
Block a user