Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a2d296a6e | |||
| 8198b4d563 |
@@ -1,29 +0,0 @@
|
|||||||
name: Ruby Build
|
|
||||||
on: [push, pull_request]
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
ruby: [2.4.0, 2.6.0, 3.0.0, jruby-9.2.18.0]
|
|
||||||
steps:
|
|
||||||
- run: echo "The job was automatically triggered by a ${{ github.event_name }} event."
|
|
||||||
- run: echo "This job is now running on a ${{ runner.os }} server hosted by GitHub!"
|
|
||||||
- run: echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
|
|
||||||
- name: Check out repository code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- run: echo "The ${{ github.repository }} repository has been cloned to the runner."
|
|
||||||
- run: echo "The workflow is now ready to test your code on the runner."
|
|
||||||
- name: List files in the repository
|
|
||||||
run: |
|
|
||||||
ls ${{ github.workspace }}
|
|
||||||
- uses: actions/setup-java@v2
|
|
||||||
with:
|
|
||||||
distribution: 'adopt'
|
|
||||||
java-version: '9'
|
|
||||||
- uses: ruby/setup-ruby@v1
|
|
||||||
with:
|
|
||||||
ruby-version: ${{ matrix.ruby }}
|
|
||||||
bundler-cache: true
|
|
||||||
- name: exec rake
|
|
||||||
run: bundle exec rake
|
|
||||||
@@ -8,4 +8,3 @@ Gemfile.lock
|
|||||||
.*
|
.*
|
||||||
!.sprockets*
|
!.sprockets*
|
||||||
!lib/gollum/public/gollum/stylesheets/_styles.css
|
!lib/gollum/public/gollum/stylesheets/_styles.css
|
||||||
!.github*
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ rvm:
|
|||||||
- 2.4.0
|
- 2.4.0
|
||||||
- 2.6.0
|
- 2.6.0
|
||||||
- 3.0.0
|
- 3.0.0
|
||||||
- jruby-9.2.18.0
|
- jruby-9.2.9.0
|
||||||
jdk:
|
jdk:
|
||||||
- oraclejdk9
|
- oraclejdk9
|
||||||
before_install:
|
before_install:
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
# 5.2.3 2021-04-18
|
|
||||||
|
|
||||||
* Fix bug preventing page titles from being displayed
|
|
||||||
|
|
||||||
# 5.2.1 2021-02-25
|
# 5.2.1 2021-02-25
|
||||||
|
|
||||||
* Fix include call to a missing asset (@benjaminwil). This caused slow first page loads on JRuby.
|
* Fix include call to a missing asset (@benjaminwil). This caused slow first page loads on JRuby.
|
||||||
|
|||||||
@@ -2,11 +2,10 @@ gollum -- A git-based Wiki
|
|||||||
====================================
|
====================================
|
||||||
|
|
||||||
[](http://badge.fury.io/rb/gollum)
|
[](http://badge.fury.io/rb/gollum)
|
||||||

|
[](https://travis-ci.org/gollum/gollum)
|
||||||
[](https://www.codetriage.com/gollum/gollum)
|
[](https://www.codetriage.com/gollum/gollum)
|
||||||
[](https://dometto-cuttingedge.herokuapp.com/github/gollum/gollum/info)
|
[](https://dometto-cuttingedge.herokuapp.com/github/gollum/gollum/info)
|
||||||
|
|
||||||
|
|
||||||
**Gollum version 5.0 is out!** See [here](https://github.com/gollum/gollum/wiki/5.0-release-notes) for a list of changes and new features compared to Gollum version 4.x, and see some [Screenshots](https://github.com/gollum/gollum/wiki/Screenshots) of Gollum's features.
|
**Gollum version 5.0 is out!** See [here](https://github.com/gollum/gollum/wiki/5.0-release-notes) for a list of changes and new features compared to Gollum version 4.x, and see some [Screenshots](https://github.com/gollum/gollum/wiki/Screenshots) of Gollum's features.
|
||||||
|
|
||||||
## DESCRIPTION
|
## DESCRIPTION
|
||||||
@@ -46,7 +45,7 @@ Installation examples for individual systems can be seen [here](https://github.c
|
|||||||
|
|
||||||
To run, simply:
|
To run, simply:
|
||||||
|
|
||||||
1. Run: `gollum /path/to/wiki` where `/path/to/wiki` is an initialized Git repository.
|
1. Run: `gollum /path/to/wiki`.
|
||||||
2. Open `http://localhost:4567` in your browser.
|
2. Open `http://localhost:4567` in your browser.
|
||||||
|
|
||||||
See [below](#running-from-source) for information on running Gollum from source, as a Rack app, and more.
|
See [below](#running-from-source) for information on running Gollum from source, as a Rack app, and more.
|
||||||
|
|||||||
+7
-8
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
|
|||||||
s.required_ruby_version = '>= 1.9'
|
s.required_ruby_version = '>= 1.9'
|
||||||
|
|
||||||
s.name = 'gollum'
|
s.name = 'gollum'
|
||||||
s.version = '5.2.3'
|
s.version = '5.2.1'
|
||||||
s.date = '2021-04-18'
|
s.date = '2021-02-25'
|
||||||
s.license = 'MIT'
|
s.license = 'MIT'
|
||||||
|
|
||||||
s.summary = 'A simple, Git-powered wiki.'
|
s.summary = 'A simple, Git-powered wiki.'
|
||||||
@@ -39,7 +39,6 @@ Gem::Specification.new do |s|
|
|||||||
s.add_dependency 'rss', '~> 0.2.9'
|
s.add_dependency 'rss', '~> 0.2.9'
|
||||||
s.add_dependency 'therubyrhino', '~> 2.1.0'
|
s.add_dependency 'therubyrhino', '~> 2.1.0'
|
||||||
s.add_dependency 'webrick', '~> 1.7'
|
s.add_dependency 'webrick', '~> 1.7'
|
||||||
s.add_dependency 'i18n', '~> 1.8'
|
|
||||||
|
|
||||||
s.add_development_dependency 'rack-test', '~> 0.6.3'
|
s.add_development_dependency 'rack-test', '~> 0.6.3'
|
||||||
s.add_development_dependency 'shoulda', '~> 3.6.0'
|
s.add_development_dependency 'shoulda', '~> 3.6.0'
|
||||||
@@ -70,11 +69,11 @@ Gem::Specification.new do |s|
|
|||||||
lib/gollum/app.rb
|
lib/gollum/app.rb
|
||||||
lib/gollum/assets.rb
|
lib/gollum/assets.rb
|
||||||
lib/gollum/helpers.rb
|
lib/gollum/helpers.rb
|
||||||
lib/gollum/public/assets/.sprockets-manifest-de7bb79aec424e55af1acdcc4237b301.json
|
lib/gollum/public/assets/.sprockets-manifest-15b663a27211dc9de9a452b4b74462d7.json
|
||||||
lib/gollum/public/assets/app-0fd228e26bfbe6fe31a2da268eb0e98e780c1191c1a918adf383377946e9c838.js
|
lib/gollum/public/assets/app-7a0bbff2e8bad3033e7c17e0e0f886f336a9d23d3b912dcd2ae389c48b4b63e6.css
|
||||||
lib/gollum/public/assets/app-0fd228e26bfbe6fe31a2da268eb0e98e780c1191c1a918adf383377946e9c838.js.gz
|
lib/gollum/public/assets/app-7a0bbff2e8bad3033e7c17e0e0f886f336a9d23d3b912dcd2ae389c48b4b63e6.css.gz
|
||||||
lib/gollum/public/assets/app-ad43ca64b295d8444b10f22ee868f18429268af498f1bc515434878b690e37a2.css
|
lib/gollum/public/assets/app-7a4bd115f4bc7ece39bc8073ca0ffad7c5e55cc5837b1464a12dead4905cefb2.js
|
||||||
lib/gollum/public/assets/app-ad43ca64b295d8444b10f22ee868f18429268af498f1bc515434878b690e37a2.css.gz
|
lib/gollum/public/assets/app-7a4bd115f4bc7ece39bc8073ca0ffad7c5e55cc5837b1464a12dead4905cefb2.js.gz
|
||||||
lib/gollum/public/assets/criticmarkup-31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4.css
|
lib/gollum/public/assets/criticmarkup-31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4.css
|
||||||
lib/gollum/public/assets/criticmarkup-31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4.css.gz
|
lib/gollum/public/assets/criticmarkup-31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4.css.gz
|
||||||
lib/gollum/public/assets/editor-db10c8351306e92f1926ba225d0cd9c8e886482b3b9820a85825ec3abab5f1cf.js
|
lib/gollum/public/assets/editor-db10c8351306e92f1926ba225d0cd9c8e886482b3b9820a85825ec3abab5f1cf.js
|
||||||
|
|||||||
+18
-5
@@ -5,7 +5,6 @@ require 'digest/sha1'
|
|||||||
require 'ostruct'
|
require 'ostruct'
|
||||||
|
|
||||||
# external
|
# external
|
||||||
require 'i18n'
|
|
||||||
require 'github/markup'
|
require 'github/markup'
|
||||||
require 'rhino' if RUBY_PLATFORM == 'java'
|
require 'rhino' if RUBY_PLATFORM == 'java'
|
||||||
|
|
||||||
@@ -13,15 +12,28 @@ require 'rhino' if RUBY_PLATFORM == 'java'
|
|||||||
require File.expand_path('../gollum/uri_encode_component', __FILE__)
|
require File.expand_path('../gollum/uri_encode_component', __FILE__)
|
||||||
|
|
||||||
module Gollum
|
module Gollum
|
||||||
VERSION = '5.2.3'
|
VERSION = '5.2.1'
|
||||||
|
|
||||||
::I18n.available_locales = [:en]
|
|
||||||
::I18n.load_path = Dir[File.expand_path("lib/gollum/locales") + "/*.yml"]
|
|
||||||
|
|
||||||
def self.assets_path
|
def self.assets_path
|
||||||
::File.expand_path('gollum/public', ::File.dirname(__FILE__))
|
::File.expand_path('gollum/public', ::File.dirname(__FILE__))
|
||||||
end
|
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
|
class TemplateFilter
|
||||||
@@filters = {}
|
@@filters = {}
|
||||||
|
|
||||||
@@ -36,4 +48,5 @@ module Gollum
|
|||||||
data
|
data
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
+1
-5
@@ -1,5 +1,4 @@
|
|||||||
# encoding: UTF-8
|
# ~*~ encoding: utf-8 ~*~
|
||||||
|
|
||||||
require 'cgi'
|
require 'cgi'
|
||||||
require 'sinatra'
|
require 'sinatra'
|
||||||
require 'sinatra/namespace'
|
require 'sinatra/namespace'
|
||||||
@@ -15,7 +14,6 @@ require 'pathname'
|
|||||||
require 'gollum'
|
require 'gollum'
|
||||||
require 'gollum/assets'
|
require 'gollum/assets'
|
||||||
require 'gollum/views/helpers'
|
require 'gollum/views/helpers'
|
||||||
require 'gollum/views/helpers/locale_helpers'
|
|
||||||
require 'gollum/views/layout'
|
require 'gollum/views/layout'
|
||||||
require 'gollum/views/editable'
|
require 'gollum/views/editable'
|
||||||
require 'gollum/views/has_page'
|
require 'gollum/views/has_page'
|
||||||
@@ -71,8 +69,6 @@ module Precious
|
|||||||
register Sinatra::Namespace
|
register Sinatra::Namespace
|
||||||
include Precious::Helpers
|
include Precious::Helpers
|
||||||
|
|
||||||
Encoding.default_external = "UTF-8"
|
|
||||||
|
|
||||||
dir = File.dirname(File.expand_path(__FILE__))
|
dir = File.dirname(File.expand_path(__FILE__))
|
||||||
|
|
||||||
set :sprockets, ::Precious::Assets.sprockets(dir)
|
set :sprockets, ::Precious::Assets.sprockets(dir)
|
||||||
|
|||||||
@@ -1,82 +0,0 @@
|
|||||||
module Precious
|
|
||||||
module Views
|
|
||||||
module LocaleHelpers
|
|
||||||
NO_METHOD_MESSAGE = 'Argument must be a view method'
|
|
||||||
YAML_VARIABLE_REGEXP = /\%\{[\w]+\}/
|
|
||||||
|
|
||||||
# Returns all I18n translation strings for the current view class.
|
|
||||||
# This method support YAML arguments. For example:
|
|
||||||
#
|
|
||||||
# last_edited: This content was last edited at %{date}.
|
|
||||||
#
|
|
||||||
# Where the `date` argument must be a method available on the current
|
|
||||||
# class.
|
|
||||||
#
|
|
||||||
# Use this interface within Mustache templates to render any user
|
|
||||||
# interface strings in the current locale. For example:
|
|
||||||
#
|
|
||||||
# {{ t.last_edited }}
|
|
||||||
#
|
|
||||||
def t
|
|
||||||
autofill I18n.t(locale_klass_name)
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
# Recursively looks up I18n translation values and autofills any YAML
|
|
||||||
# arguments with the return value of the current class's matching method.
|
|
||||||
#
|
|
||||||
# When a translation value with an argument has no matching method, we
|
|
||||||
# then return that value transformed to include the `no_method_message`
|
|
||||||
#
|
|
||||||
def autofill(yaml)
|
|
||||||
yaml.map { |i18n_key, i18n_value|
|
|
||||||
if i18n_value.is_a? Hash
|
|
||||||
[i18n_key, autofill(i18n_value)]
|
|
||||||
elsif has_arguments?(i18n_value)
|
|
||||||
fill_argument_content(i18n_key, i18n_value)
|
|
||||||
else
|
|
||||||
[i18n_key, i18n_value]
|
|
||||||
end
|
|
||||||
}.to_h
|
|
||||||
end
|
|
||||||
|
|
||||||
def fill_argument_content(i18n_key, i18n_value)
|
|
||||||
i18n_value.gsub!(YAML_VARIABLE_REGEXP) do |argument|
|
|
||||||
method_name = argument.gsub(/[^\w]/, '')
|
|
||||||
|
|
||||||
next if method_name.nil?
|
|
||||||
|
|
||||||
begin
|
|
||||||
self.public_send(method_name)
|
|
||||||
rescue NoMethodError => error
|
|
||||||
no_method_message(method_name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
[i18n_key, i18n_value]
|
|
||||||
end
|
|
||||||
|
|
||||||
def has_arguments?(i18n_value)
|
|
||||||
i18n_value.match?(YAML_VARIABLE_REGEXP)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Returns the current class name in a format that is acceptable in YAML.
|
|
||||||
# To summarize its function:
|
|
||||||
#
|
|
||||||
# NameOfConstant => name_of_constant
|
|
||||||
#
|
|
||||||
def locale_klass_name
|
|
||||||
@locale_klass_name ||= self.class.name.gsub(/::/, '/').
|
|
||||||
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
|
||||||
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
|
||||||
tr('-', '_').
|
|
||||||
downcase
|
|
||||||
end
|
|
||||||
|
|
||||||
def no_method_message(method_name, message = NO_METHOD_MESSAGE)
|
|
||||||
"[#{message}: #{method_name}]"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -6,7 +6,6 @@ module Precious
|
|||||||
include Rack::Utils
|
include Rack::Utils
|
||||||
include Sprockets::Helpers
|
include Sprockets::Helpers
|
||||||
include Precious::Views::AppHelpers
|
include Precious::Views::AppHelpers
|
||||||
include Precious::Views::LocaleHelpers
|
|
||||||
include Precious::Views::SprocketsHelpers
|
include Precious::Views::SprocketsHelpers
|
||||||
include Precious::Views::RouteHelpers
|
include Precious::Views::RouteHelpers
|
||||||
include Precious::Views::OcticonHelpers
|
include Precious::Views::OcticonHelpers
|
||||||
@@ -48,7 +47,7 @@ module Precious
|
|||||||
end
|
end
|
||||||
|
|
||||||
def mathjax_js
|
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
|
end
|
||||||
|
|
||||||
def css # custom css
|
def css # custom css
|
||||||
|
|||||||
@@ -16,11 +16,6 @@ module Precious
|
|||||||
DEFAULT_AUTHOR = 'you'
|
DEFAULT_AUTHOR = 'you'
|
||||||
@@to_xml = { :save_with => Nokogiri::XML::Node::SaveOptions::DEFAULT_XHTML ^ 1, :indent => 0, :encoding => 'UTF-8' }
|
@@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
|
def page_header
|
||||||
title
|
title
|
||||||
end
|
end
|
||||||
@@ -268,6 +263,11 @@ module Precious
|
|||||||
end
|
end
|
||||||
result << "</tr>\n</table>\n"
|
result << "</tr>\n</table>\n"
|
||||||
end
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,134 +0,0 @@
|
|||||||
require_relative "../../helper"
|
|
||||||
require_relative "../../../lib/gollum/views/helpers"
|
|
||||||
|
|
||||||
describe Precious::Views::LocaleHelpers do
|
|
||||||
class TestClass < Mustache
|
|
||||||
include Precious::Views::LocaleHelpers
|
|
||||||
|
|
||||||
def author
|
|
||||||
"J.R.R."
|
|
||||||
end
|
|
||||||
|
|
||||||
def location
|
|
||||||
"Bloemfontein"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def setup
|
|
||||||
::I18n.available_locales = [:en, :de]
|
|
||||||
::I18n.load_path = Dir[File.expand_path("test/support/locales" + "/*.yml")]
|
|
||||||
end
|
|
||||||
|
|
||||||
def teardown
|
|
||||||
I18n.locale = :en
|
|
||||||
end
|
|
||||||
|
|
||||||
let(:dummy_instance) { TestClass.new }
|
|
||||||
|
|
||||||
describe "#t" do
|
|
||||||
describe "mustache usage" do
|
|
||||||
let(:subject) { dummy_instance.render(mustache_template) }
|
|
||||||
|
|
||||||
let(:mustache_template) { "{{ t.hello_world }}" }
|
|
||||||
|
|
||||||
describe "in the default locale" do
|
|
||||||
it "returns the translation string" do
|
|
||||||
_(subject).must_equal "Hello world"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "in the configured locale" do
|
|
||||||
it "returns the translation string" do
|
|
||||||
I18n.locale = :de
|
|
||||||
|
|
||||||
_(subject).must_equal "Hallo Welt"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "translations with YAML arguments" do
|
|
||||||
let(:mustache_template) { "{{ t.author_info.full }}" }
|
|
||||||
|
|
||||||
describe "in the default locale" do
|
|
||||||
it "autofills YAML arguments" do
|
|
||||||
_(subject).must_equal "Author J.R.R. is from Bloemfontein"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "in the configured locale" do
|
|
||||||
it "autofills YAML arguments" do
|
|
||||||
I18n.locale = :de
|
|
||||||
|
|
||||||
_(subject).must_equal "Autor J.R.R. ist vom Bloemfontein"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "translations with invalid arguments" do
|
|
||||||
let(:mustache_template) { "{{ t.has_invalid_argument }}" }
|
|
||||||
|
|
||||||
it "fails gracefully with embedded error message" do
|
|
||||||
expected_string = "Welcome to " \
|
|
||||||
"[#{TestClass::NO_METHOD_MESSAGE}: no_matching_method]"
|
|
||||||
|
|
||||||
_(subject).must_equal expected_string
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "out of scope translations" do
|
|
||||||
let(:mustache_template) { "{{ t.never_called }}" }
|
|
||||||
|
|
||||||
it "does not include translation keys from other classes" do
|
|
||||||
_(subject).must_be_empty
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "missing translations" do
|
|
||||||
let(:mustache_template) { "{{ t.nested.nonexistent_key }}" }
|
|
||||||
|
|
||||||
it "outputs an empty string" do
|
|
||||||
_(subject).must_be_empty
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "usage" do
|
|
||||||
let(:subject) { dummy_instance.t }
|
|
||||||
|
|
||||||
it "returns a hash" do
|
|
||||||
_(subject).must_be_kind_of Hash
|
|
||||||
end
|
|
||||||
|
|
||||||
it "returns translation keys under 'test_class'" do
|
|
||||||
i18n_keys = I18n.t("test_class").keys
|
|
||||||
|
|
||||||
_(subject.keys).must_equal i18n_keys
|
|
||||||
end
|
|
||||||
|
|
||||||
it "does not return translation keys under other classes" do
|
|
||||||
other_i18n_keys = I18n.t("nonexistant_test_class").keys
|
|
||||||
|
|
||||||
_(subject.keys).wont_include other_i18n_keys
|
|
||||||
end
|
|
||||||
|
|
||||||
it "returns nested keys" do
|
|
||||||
nested_keys = subject[:author_info].keys
|
|
||||||
|
|
||||||
_(nested_keys).must_equal [:full]
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "auto-filled YAML arguments" do
|
|
||||||
let(:subject) { dummy_instance.t[:author_info][:full] }
|
|
||||||
|
|
||||||
it "auto-fills in the default locale" do
|
|
||||||
_(subject).must_equal "Author J.R.R. is from Bloemfontein"
|
|
||||||
end
|
|
||||||
|
|
||||||
it "auto-fills in a configured locale" do
|
|
||||||
I18n.locale = :de
|
|
||||||
|
|
||||||
_(subject).must_equal "Autor J.R.R. ist vom Bloemfontein"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -5,7 +5,6 @@ require 'shoulda'
|
|||||||
require 'mocha/setup'
|
require 'mocha/setup'
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
require 'minitest/reporters'
|
require 'minitest/reporters'
|
||||||
require 'minitest/spec'
|
|
||||||
require 'twitter_cldr'
|
require 'twitter_cldr'
|
||||||
require 'tmpdir'
|
require 'tmpdir'
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
de:
|
|
||||||
test_class:
|
|
||||||
author_info:
|
|
||||||
full: Autor %{author} ist vom %{location}
|
|
||||||
has_invalid_argument: Willkommen in %{no_matching_method}
|
|
||||||
hello_world: Hallo Welt
|
|
||||||
nonexistant_test_class:
|
|
||||||
never_called: Nie angerufen
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
en:
|
|
||||||
test_class:
|
|
||||||
author_info:
|
|
||||||
full: Author %{author} is from %{location}
|
|
||||||
has_invalid_argument: Welcome to %{no_matching_method}
|
|
||||||
hello_world: Hello world
|
|
||||||
nonexistant_test_class:
|
|
||||||
never_called: Never called
|
|
||||||
+1
-1
@@ -953,7 +953,7 @@ context 'Frontend with base path' do
|
|||||||
test 'base path mathjax assets' do
|
test 'base path mathjax assets' do
|
||||||
get '/wiki/Home'
|
get '/wiki/Home'
|
||||||
assert last_response.ok?
|
assert last_response.ok?
|
||||||
assert last_response.body.include?('<script defer src="/wiki/gollum/assets/mathjax/MathJax.js?config=')
|
assert last_response.body.include?('<script defer src="/wiki/gollum/assets/mathjax/MathJax.js')
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'compare view' do
|
test 'compare view' do
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ def load_script(**args)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
unless ENV['CI']
|
unless ENV['TRAVIS']
|
||||||
|
|
||||||
context '4.x -> 5.x tag migrator' do
|
context '4.x -> 5.x tag migrator' do
|
||||||
include Rack::Test::Methods
|
include Rack::Test::Methods
|
||||||
|
|||||||
+1
-25
@@ -38,31 +38,7 @@ context "Precious::Views::Page" do
|
|||||||
assert_include @view.breadcrumb, "数学 📘"
|
assert_include @view.breadcrumb, "数学 📘"
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'page <title> is the page header from content, if present' do
|
test "page header retains unicde and ASCII characters" 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 = "数学 📘"
|
title = "数学 📘"
|
||||||
@wiki.write_page(title, :markdown, "How old is Bilbo?")
|
@wiki.write_page(title, :markdown, "How old is Bilbo?")
|
||||||
page = @wiki.page(title)
|
page = @wiki.page(title)
|
||||||
|
|||||||
Reference in New Issue
Block a user