alula 0.2.3 → 0.4.0b
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/Gemfile +7 -0
- data/Guardfile +9 -0
- data/Rakefile +12 -1
- data/VERSION +1 -1
- data/alula.gemspec +20 -4
- data/lib/alula/attachment_processor.rb +77 -0
- data/lib/alula/cdn.rb +30 -0
- data/lib/alula/cdns/edgecast.rb +16 -0
- data/lib/alula/cdns/hosts.rb +14 -0
- data/lib/alula/cli.rb +90 -39
- data/lib/alula/compressors.rb +22 -10
- data/lib/alula/config.rb +141 -0
- data/lib/alula/content.rb +113 -0
- data/lib/alula/contents/attachment.rb +8 -0
- data/lib/alula/contents/item.rb +409 -0
- data/lib/alula/contents/metadata.rb +73 -0
- data/lib/alula/contents/page.rb +9 -0
- data/lib/alula/contents/post.rb +32 -0
- data/lib/alula/context.rb +72 -0
- data/lib/alula/core_ext.rb +5 -0
- data/lib/alula/core_ext/environment.rb +20 -0
- data/lib/alula/core_ext/filter.rb +20 -0
- data/lib/alula/core_ext/filters/smilies.rb +36 -0
- data/lib/alula/core_ext/manifest.rb +30 -0
- data/lib/alula/core_ext/tag.rb +100 -0
- data/lib/alula/core_ext/tags/attachment.rb +28 -0
- data/lib/alula/core_ext/tags/blockquote.rb +21 -0
- data/lib/alula/core_ext/tags/image.rb +48 -0
- data/lib/alula/core_ext/tags/locale.rb +17 -0
- data/lib/alula/core_ext/tags/video.rb +103 -0
- data/lib/alula/generator.rb +31 -0
- data/lib/alula/generators/feedbuilder.rb +44 -0
- data/lib/alula/generators/paginate.rb +88 -0
- data/lib/alula/generators/sitemap.rb +26 -0
- data/lib/alula/helpers.rb +2 -0
- data/lib/alula/helpers/addons.rb +12 -0
- data/lib/alula/helpers/assets.rb +56 -0
- data/lib/alula/helpers/url_helpers.rb +16 -0
- data/lib/alula/plugin.rb +32 -0
- data/lib/alula/processor.rb +86 -0
- data/lib/alula/processors/dummy.rb +24 -0
- data/lib/alula/processors/image.rb +52 -0
- data/lib/alula/processors/magick.rb +83 -0
- data/lib/alula/processors/video.rb +97 -0
- data/lib/alula/processors/zencoder.rb +199 -0
- data/lib/alula/progress.rb +95 -0
- data/lib/alula/progressbar.rb +66 -0
- data/lib/alula/site.rb +331 -262
- data/lib/alula/storage.rb +46 -0
- data/lib/alula/storages/file_item.rb +43 -0
- data/lib/alula/storages/filestorage.rb +96 -0
- data/lib/alula/storages/item.rb +12 -0
- data/lib/alula/support/commonlogger.rb +30 -0
- data/lib/alula/theme.rb +70 -13
- data/lib/alula/theme/layout.rb +56 -0
- data/lib/alula/theme/view.rb +43 -0
- data/lib/alula/version.rb +1 -1
- data/locales/en.yml +9 -0
- data/locales/fi.yml +10 -0
- data/locales/l10n/ar.yml +199 -0
- data/locales/l10n/az.yml +199 -0
- data/locales/l10n/bg.yml +199 -0
- data/locales/l10n/bn-IN.yml +182 -0
- data/locales/l10n/bs.yml +242 -0
- data/locales/l10n/ca.yml +199 -0
- data/locales/l10n/cs.yml +198 -0
- data/locales/l10n/csb.yml +210 -0
- data/locales/l10n/cy.yml +199 -0
- data/locales/l10n/da.yml +199 -0
- data/locales/l10n/de-AT.yml +203 -0
- data/locales/l10n/de-CH.yml +203 -0
- data/locales/l10n/de.yml +203 -0
- data/locales/l10n/dsb.yml +215 -0
- data/locales/l10n/el.yml +199 -0
- data/locales/l10n/en-AU.yml +205 -0
- data/locales/l10n/en-CA.yml +214 -0
- data/locales/l10n/en-GB.yml +205 -0
- data/locales/l10n/en-IN.yml +205 -0
- data/locales/l10n/en-US.yml +205 -0
- data/locales/l10n/en.yml +205 -0
- data/locales/l10n/eo.yml +201 -0
- data/locales/l10n/es-AR.yml +205 -0
- data/locales/l10n/es-CL.yml +199 -0
- data/locales/l10n/es-CO.yml +205 -0
- data/locales/l10n/es-MX.yml +205 -0
- data/locales/l10n/es-PE.yml +181 -0
- data/locales/l10n/es-VE.yml +205 -0
- data/locales/l10n/es.yml +199 -0
- data/locales/l10n/et.yml +199 -0
- data/locales/l10n/eu.yml +199 -0
- data/locales/l10n/fa.yml +199 -0
- data/locales/l10n/fi.yml +199 -0
- data/locales/l10n/fr-CA.yml +207 -0
- data/locales/l10n/fr-CH.yml +207 -0
- data/locales/l10n/fr.yml +222 -0
- data/locales/l10n/fur.yml +199 -0
- data/locales/l10n/gl-ES.yml +178 -0
- data/locales/l10n/gsw-CH.yml +199 -0
- data/locales/l10n/he.yml +201 -0
- data/locales/l10n/hi-IN.yml +199 -0
- data/locales/l10n/hi.yml +199 -0
- data/locales/l10n/hr.yml +237 -0
- data/locales/l10n/hsb.yml +214 -0
- data/locales/l10n/hu.yml +199 -0
- data/locales/l10n/id.yml +200 -0
- data/locales/l10n/is.yml +213 -0
- data/locales/l10n/it.yml +205 -0
- data/locales/l10n/ja.yml +197 -0
- data/locales/l10n/kn.yml +199 -0
- data/locales/l10n/ko.yml +197 -0
- data/locales/l10n/lo.yml +186 -0
- data/locales/l10n/lt.yml +182 -0
- data/locales/l10n/lv.yml +215 -0
- data/locales/l10n/mk.yml +170 -0
- data/locales/l10n/mn.yml +205 -0
- data/locales/l10n/nb.yml +207 -0
- data/locales/l10n/nl.yml +199 -0
- data/locales/l10n/nn.yml +160 -0
- data/locales/l10n/pl.yml +221 -0
- data/locales/l10n/pt-BR.yml +207 -0
- data/locales/l10n/pt-PT.yml +207 -0
- data/locales/l10n/quotes.yml +24 -0
- data/locales/l10n/rm.yml +182 -0
- data/locales/l10n/ro.yml +199 -0
- data/locales/l10n/ru.yml +257 -0
- data/locales/l10n/sk.yml +213 -0
- data/locales/l10n/sl.yml +210 -0
- data/locales/l10n/sr-Latn.yml +170 -0
- data/locales/l10n/sr.yml +170 -0
- data/locales/l10n/sv-SE.yml +199 -0
- data/locales/l10n/sw.yml +197 -0
- data/locales/l10n/th.yml +173 -0
- data/locales/l10n/tl.yml +229 -0
- data/locales/l10n/tr.yml +199 -0
- data/locales/l10n/uk.yml +257 -0
- data/locales/l10n/vi.yml +201 -0
- data/locales/l10n/wo.yml +205 -0
- data/locales/l10n/zh-CN.yml +199 -0
- data/locales/l10n/zh-TW.yml +199 -0
- data/template/Gemfile.erb +14 -4
- data/template/README +16 -0
- data/template/config.yml.erb +42 -38
- data/test/fixtures/config_001_simple.yml +2 -0
- data/test/fixtures/config_002_l10n.yml +5 -0
- data/test/fixtures/pages/invalid-page.markdown +1 -0
- data/test/fixtures/pages/multilingual-page.markdown +20 -0
- data/test/fixtures/pages/section/subpage.markdown +5 -0
- data/test/fixtures/pages/simple-page.markdown +7 -0
- data/test/fixtures/posts/2012-07-02-invalid-post.markdown +1 -0
- data/test/fixtures/posts/2012-07-02-simple.markdown +7 -0
- data/test/fixtures/posts/2012-07-03-full-metadata.markdown +8 -0
- data/test/fixtures/posts/2012-07-03-multilingual-full-metadata.markdown +20 -0
- data/test/fixtures/theme/test/layouts/default.html.erb +1 -0
- data/test/fixtures/theme/test/views/page.html.erb +1 -0
- data/test/fixtures/theme/test/views/post.html.erb +1 -0
- data/test/minitest_helper.rb +14 -0
- data/test/test_config.rb +33 -0
- data/test/test_content.rb +30 -0
- data/test/test_metadata.rb +83 -0
- data/test/test_page.rb +81 -0
- data/test/test_post.rb +123 -0
- data/test/test_storage.rb +23 -0
- data/test/test_storage_file.rb +32 -0
- data/test/test_theme.rb +45 -0
- data/vendor/assets/images/favicon.png +0 -0
- data/vendor/assets/images/grey.gif +0 -0
- data/vendor/assets/javascripts/jquery.alula.js.coffee +16 -0
- data/vendor/{javascripts → assets/javascripts}/jquery.js +0 -0
- data/vendor/assets/javascripts/jquery.lazyload.js +210 -0
- data/vendor/assets/javascripts/lazyload.js.coffee +15 -0
- data/vendor/layouts/feed.xml.builder +19 -0
- data/vendor/layouts/sitemap.xml.builder +10 -0
- data/vendor/views/feed_post.html.haml +1 -0
- metadata +529 -50
- data/lib/alula.rb +0 -5
- data/lib/alula/assethelper.rb +0 -75
- data/lib/alula/plugins.rb +0 -23
- data/lib/alula/plugins/assets.rb +0 -82
- data/lib/alula/plugins/pagination.rb +0 -121
- data/lib/alula/rake_tasks.rb +0 -42
- data/lib/alula/tasks.rb +0 -2
data/template/Gemfile.erb
CHANGED
@@ -1,5 +1,15 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
|
4
|
-
gem "alula
|
5
|
-
gem "alula-themes
|
3
|
+
<% if options["path"] %>
|
4
|
+
gem 'alula', path: '<%= options["path"] %>/alula'
|
5
|
+
gem 'alula-themes', path: '<%= options["path"] %>/alula-themes'
|
6
|
+
gem 'alula-plugins', path: '<%= options["path"] %>/alula-plugins'
|
7
|
+
<% elsif options["edge"] %>
|
8
|
+
gem 'alula', git: 'git://github.com/owlforestry/alula.git'
|
9
|
+
gem 'alula-themes', git: 'git://github.com/owlforestry/alula-themes.git'
|
10
|
+
gem 'alula-plugins', git: 'git://github.com/owlforestry/alula-plugins.git'
|
11
|
+
<% else %>
|
12
|
+
gem 'alula'
|
13
|
+
gem 'alula-themes'
|
14
|
+
#gem 'alula-plugins'
|
15
|
+
<% end %>
|
data/template/README
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
Alula Blog
|
2
|
+
|
3
|
+
Directories:
|
4
|
+
|
5
|
+
- content/ This has blog contents, posts, pages, attachments
|
6
|
+
posts/ Put all posts here
|
7
|
+
pages/ Put all static pages here
|
8
|
+
static/ Put all files that needs to be just copied to public here
|
9
|
+
attachments/ Put all attachments, photos, videos here
|
10
|
+
- custom/ Blog customisation
|
11
|
+
stylesheets/ Custom stylesheets
|
12
|
+
custom.css Add your blog customisations here, you may use sprockets directives here
|
13
|
+
javascripts/ Custom javascripts, not yet implemented
|
14
|
+
images/ Custom images, fonts, etc.
|
15
|
+
- cache/ Contains generated content, it is a good idea to keep this around...
|
16
|
+
- public/ Contains your generated blog ready for publishing
|
data/template/config.yml.erb
CHANGED
@@ -1,38 +1,42 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
|
5
|
-
|
6
|
-
#
|
7
|
-
title
|
8
|
-
|
9
|
-
#
|
10
|
-
|
11
|
-
|
12
|
-
#
|
13
|
-
|
14
|
-
|
15
|
-
#
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
#
|
22
|
-
|
23
|
-
|
24
|
-
#
|
25
|
-
|
26
|
-
|
27
|
-
#
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
1
|
+
#
|
2
|
+
# Alula Configuration File
|
3
|
+
#
|
4
|
+
# You set different values for different
|
5
|
+
# locales and environments if required for some options
|
6
|
+
#
|
7
|
+
# For example to localise title use following syntax
|
8
|
+
# title:
|
9
|
+
# en: Title in English
|
10
|
+
# fi: Otsikko suomeksi
|
11
|
+
#
|
12
|
+
# To have different options for different environments
|
13
|
+
# title:
|
14
|
+
# development: Title (development)
|
15
|
+
# production: Title
|
16
|
+
#
|
17
|
+
# To combine
|
18
|
+
# title:
|
19
|
+
# development:
|
20
|
+
# en: Title (development)
|
21
|
+
# fi: Otsikko (kehitysversio)
|
22
|
+
# production:
|
23
|
+
# en: Title
|
24
|
+
# fi: Otsikko
|
25
|
+
#
|
26
|
+
# Existing environments:
|
27
|
+
# - development => By default, when testing locally
|
28
|
+
# - production => Enabled when generating site with --production option
|
29
|
+
#
|
30
|
+
|
31
|
+
# OPTIONS
|
32
|
+
# Localisation and environments supported
|
33
|
+
title: The title for blog
|
34
|
+
tagline: The cathy tagline for your blog
|
35
|
+
author: You name
|
36
|
+
url:
|
37
|
+
development: http://0.0.0.0:3000
|
38
|
+
production: http://your.host.here
|
39
|
+
|
40
|
+
# Use paginated page as blog index
|
41
|
+
# This could be set to any slug of post or page to change default index page
|
42
|
+
index: page-1
|
@@ -0,0 +1 @@
|
|
1
|
+
This is invalid page without payload.
|
@@ -0,0 +1 @@
|
|
1
|
+
This is invalid post, i.e. not having payload.
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
title:
|
3
|
+
en: Multilingual Post
|
4
|
+
fi: Monikielinen kirjoitelma
|
5
|
+
slug:
|
6
|
+
en: multilingual-post
|
7
|
+
fi: monikielinen-blogi-kirjoitelma
|
8
|
+
---
|
9
|
+
|
10
|
+
{% locale en %}
|
11
|
+
# Header
|
12
|
+
|
13
|
+
This is not a simple post.
|
14
|
+
{% endlocale %}
|
15
|
+
|
16
|
+
{% locale fi %}
|
17
|
+
# Otsikko
|
18
|
+
|
19
|
+
Tämä ei ole yksinkertainen kirjoitelma.
|
20
|
+
{% endlocale %}
|
@@ -0,0 +1 @@
|
|
1
|
+
<html><body><%= yield %></body></html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= content %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<p><%= content %></p>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start do
|
3
|
+
# Skip support (from ActiveSupport)
|
4
|
+
add_filter "lib/alula/support/deep_merge.rb"
|
5
|
+
|
6
|
+
add_group "Gem", "lib/"
|
7
|
+
add_group "Tests", "test/"
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'turn/autorun' unless ENV["DEBUG"]
|
11
|
+
require "minitest/autorun"
|
12
|
+
require "minitest/mock"
|
13
|
+
|
14
|
+
Turn.config.format = :outline unless ENV["DEBUG"]
|
data/test/test_config.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require "minitest_helper"
|
2
|
+
require 'alula/config'
|
3
|
+
|
4
|
+
describe Alula::Config do
|
5
|
+
it "loads default config" do
|
6
|
+
config = Alula::Config.new()
|
7
|
+
|
8
|
+
config.title.must_equal "The Unnamed Blog"
|
9
|
+
config.url.must_equal "http://localhost:3000"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "overrides given configurations" do
|
13
|
+
config = Alula::Config.new(title: "Overriden fun")
|
14
|
+
|
15
|
+
config.title.must_equal "Overriden fun"
|
16
|
+
config.url.must_equal "http://localhost:3000"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "loads project configuration" do
|
20
|
+
config = Alula::Config.new({}, File.join("test/fixtures/config_001_simple.yml"))
|
21
|
+
|
22
|
+
config.title.must_equal "Yet Another Blog"
|
23
|
+
config.url.must_equal "http://localhost:3000"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "loads project configuration with overrides" do
|
27
|
+
config = Alula::Config.new({url: "http://lvh.me:3000"}, File.join("test/fixtures/config_001_simple.yml"))
|
28
|
+
|
29
|
+
config.title.must_equal "Yet Another Blog"
|
30
|
+
config.url.must_equal "http://lvh.me:3000"
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "minitest_helper"
|
2
|
+
require 'alula/content'
|
3
|
+
|
4
|
+
describe "Content" do
|
5
|
+
before do
|
6
|
+
@site = MiniTest::Mock.new
|
7
|
+
|
8
|
+
item = MiniTest::Mock.new
|
9
|
+
item.expect :nil?, false
|
10
|
+
item.expect :exists?, true
|
11
|
+
item.expect :has_payload?, true
|
12
|
+
item.expect :name, "item"
|
13
|
+
item.expect :read, ""
|
14
|
+
|
15
|
+
storage = MiniTest::Mock.new
|
16
|
+
storage.expect :posts, { "item" => item }
|
17
|
+
storage.expect :pages, { "item" => item }
|
18
|
+
storage.expect :attachments, { "item" => item }
|
19
|
+
@site.expect :storage, storage
|
20
|
+
end
|
21
|
+
|
22
|
+
it "loads site content" do
|
23
|
+
@content = Alula::Content.new(site: @site)
|
24
|
+
@content.load
|
25
|
+
|
26
|
+
@content.pages.count.must_equal 1
|
27
|
+
@content.posts.count.must_equal 1
|
28
|
+
@content.attachments.count.must_equal 1
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require "minitest_helper"
|
2
|
+
require 'alula/contents/metadata'
|
3
|
+
|
4
|
+
describe Alula::Content::Metadata do
|
5
|
+
it "loads empty metadata" do
|
6
|
+
meta = Alula::Content::Metadata.new
|
7
|
+
meta.title.must_be_nil
|
8
|
+
end
|
9
|
+
|
10
|
+
it "accepts simple metadata" do
|
11
|
+
meta = Alula::Content::Metadata.new
|
12
|
+
meta.title = "Simple Title"
|
13
|
+
meta.title.must_equal "Simple Title"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "load simple payload" do
|
17
|
+
payload = <<-EOF
|
18
|
+
title: Simple Title
|
19
|
+
layout: default
|
20
|
+
slug: another-slug
|
21
|
+
EOF
|
22
|
+
|
23
|
+
meta = Alula::Content::Metadata.new
|
24
|
+
meta.load(payload)
|
25
|
+
|
26
|
+
meta.title.must_equal "Simple Title"
|
27
|
+
meta.layout.must_equal "default"
|
28
|
+
meta.slug.must_equal "another-slug"
|
29
|
+
|
30
|
+
meta.languages.must_be_nil
|
31
|
+
end
|
32
|
+
|
33
|
+
it "localised payload" do
|
34
|
+
payload = <<-EOF
|
35
|
+
title:
|
36
|
+
en: Simple Title
|
37
|
+
fi: Yksinkertainen otsikko
|
38
|
+
layout:
|
39
|
+
en: default
|
40
|
+
slug:
|
41
|
+
en: another-slug
|
42
|
+
fi: yksinkertainen-otsikko
|
43
|
+
EOF
|
44
|
+
|
45
|
+
meta = Alula::Content::Metadata.new
|
46
|
+
meta.load(payload)
|
47
|
+
|
48
|
+
# Default language, i.e. first localisation
|
49
|
+
meta.title.must_equal "Simple Title"
|
50
|
+
meta.layout.must_equal "default"
|
51
|
+
meta.slug.must_equal "another-slug"
|
52
|
+
|
53
|
+
# Specific language
|
54
|
+
meta.title("fi").must_equal "Yksinkertainen otsikko"
|
55
|
+
meta.layout("fi").must_equal "default"
|
56
|
+
meta.slug("fi").must_equal "yksinkertainen-otsikko"
|
57
|
+
|
58
|
+
# Fetch proper languages list
|
59
|
+
meta.languages.must_equal ["en", "fi"]
|
60
|
+
end
|
61
|
+
|
62
|
+
it "custom date setter" do
|
63
|
+
require 'time'
|
64
|
+
|
65
|
+
meta = Alula::Content::Metadata.new
|
66
|
+
|
67
|
+
meta.date = "2012-07-02"
|
68
|
+
meta.date.must_be_kind_of Time
|
69
|
+
meta.date.year.must_equal 2012
|
70
|
+
meta.date.month.must_equal 7
|
71
|
+
meta.date.day.must_equal 2
|
72
|
+
|
73
|
+
d = Time.parse("2012-07-02")
|
74
|
+
meta.date = d
|
75
|
+
meta.date.must_be_kind_of Time
|
76
|
+
meta.date.year.must_equal d.year
|
77
|
+
meta.date.month.must_equal d.month
|
78
|
+
meta.date.day.must_equal d.day
|
79
|
+
|
80
|
+
meta.date = "2012-13-45"
|
81
|
+
meta.date.must_be_nil
|
82
|
+
end
|
83
|
+
end
|
data/test/test_page.rb
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
require "minitest_helper"
|
2
|
+
require 'alula/contents/page'
|
3
|
+
|
4
|
+
describe Alula::Content::Page do
|
5
|
+
before do
|
6
|
+
@site = MiniTest::Mock.new
|
7
|
+
@site.expect :context, {}
|
8
|
+
@site.expect :config, OpenStruct.new({
|
9
|
+
permalinks: "/:year/:month/:title/",
|
10
|
+
pagelinks: "/:locale/:slug/",
|
11
|
+
locale: "en", hides_base_locale: true,
|
12
|
+
})
|
13
|
+
end
|
14
|
+
|
15
|
+
def mock_item(name)
|
16
|
+
item = MiniTest::Mock.new
|
17
|
+
item.expect :nil?, false
|
18
|
+
item.expect :exists?, File.exists?("test/fixtures/pages/#{name}")
|
19
|
+
item.expect :name, name
|
20
|
+
if File.exists?("test/fixtures/pages/#{name}")
|
21
|
+
item.expect :has_payload?, File.read("test/fixtures/pages/#{name}", 3) == "---"
|
22
|
+
item.expect :read, File.read("test/fixtures/pages/#{name}")
|
23
|
+
end
|
24
|
+
|
25
|
+
item
|
26
|
+
end
|
27
|
+
|
28
|
+
let :simple_page do
|
29
|
+
mock_item("simple-page.markdown")
|
30
|
+
end
|
31
|
+
|
32
|
+
let :invalid_page do
|
33
|
+
mock_item("invalid-page.markdown")
|
34
|
+
end
|
35
|
+
|
36
|
+
let :multilingual_page do
|
37
|
+
mock_item("multilingual-page.markdown")
|
38
|
+
end
|
39
|
+
|
40
|
+
let :subpage do
|
41
|
+
mock_item("section/subpage.markdown")
|
42
|
+
end
|
43
|
+
|
44
|
+
let :missing_page do
|
45
|
+
mock_item("missing.page")
|
46
|
+
end
|
47
|
+
|
48
|
+
it "fails with non-existing file" do
|
49
|
+
page = Alula::Content::Page.load(item: missing_page, site: @site)
|
50
|
+
end
|
51
|
+
|
52
|
+
it "loads simple page" do
|
53
|
+
page = Alula::Content::Page.load(item: simple_page, site: @site)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "skips invalid page" do
|
57
|
+
page = Alula::Content::Page.load(item: invalid_page, site: @site)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "parses simple post" do
|
61
|
+
page = Alula::Content::Page.load(item: simple_page, site: @site)
|
62
|
+
page.metadata.title.must_equal "Simple Page"
|
63
|
+
page.metadata.languages.must_be_nil
|
64
|
+
|
65
|
+
# Parse and render
|
66
|
+
page.send(:parse_liquid).must_equal "# Header\n\nThis is a simple page.\n"
|
67
|
+
|
68
|
+
page.send(:parse_markdown).must_equal "<h1>Header</h1>\n\n<p>This is a simple page.</p>\n"
|
69
|
+
end
|
70
|
+
|
71
|
+
it "parses multilingual page" do
|
72
|
+
page = Alula::Content::Page.load(item: multilingual_page, site: @site)
|
73
|
+
page.url.must_equal "/about/"
|
74
|
+
page.url("fi").must_equal "/fi/mina/"
|
75
|
+
end
|
76
|
+
|
77
|
+
it "parses subpages" do
|
78
|
+
page = Alula::Content::Page.load(item: subpage, site: @site)
|
79
|
+
page.url.must_equal "/section/subpage/"
|
80
|
+
end
|
81
|
+
end
|