alula 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/alula/cli.rb +6 -0
- data/lib/alula/content.rb +7 -11
- data/lib/alula/core_ext/tag.rb +1 -1
- data/lib/alula/core_ext/tags/link_to.rb +15 -0
- data/lib/alula/theme.rb +3 -0
- metadata +4 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/lib/alula/cli.rb
CHANGED
data/lib/alula/content.rb
CHANGED
@@ -27,18 +27,14 @@ module Alula
|
|
27
27
|
generate_content
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
31
|
-
|
32
|
-
return
|
33
|
-
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
def by_slug(slug)
|
38
|
-
(self.pages + self.posts + self.attachments).each do |item|
|
39
|
-
return item if item.slug == slug
|
30
|
+
def method_missing(meth, *args, &blk)
|
31
|
+
if m = /^by_(\S+)$/.match(meth)
|
32
|
+
return (self.pages + self.posts + self.attachments).find do |item|
|
33
|
+
item.send(m[1]) == args.first
|
34
|
+
end
|
40
35
|
end
|
41
|
-
|
36
|
+
|
37
|
+
super
|
42
38
|
end
|
43
39
|
|
44
40
|
private
|
data/lib/alula/core_ext/tag.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
module Alula
|
2
|
+
class LinkToTag < Tag
|
3
|
+
def content
|
4
|
+
target = if @options["href"]
|
5
|
+
@options["href"]
|
6
|
+
elsif @options["slug"]
|
7
|
+
item = @context.site.content.by_slug(@options["slug"])
|
8
|
+
item.nil? ? "" : item.url
|
9
|
+
end
|
10
|
+
@context.link_to(@options["source"], target)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
Alula::Tag.register :link_to, Alula::LinkToTag
|
data/lib/alula/theme.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alula
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -483,6 +483,7 @@ files:
|
|
483
483
|
- lib/alula/core_ext/tags/attachment.rb
|
484
484
|
- lib/alula/core_ext/tags/blockquote.rb
|
485
485
|
- lib/alula/core_ext/tags/image.rb
|
486
|
+
- lib/alula/core_ext/tags/link_to.rb
|
486
487
|
- lib/alula/core_ext/tags/locale.rb
|
487
488
|
- lib/alula/core_ext/tags/video.rb
|
488
489
|
- lib/alula/generator.rb
|
@@ -643,7 +644,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
643
644
|
version: '0'
|
644
645
|
segments:
|
645
646
|
- 0
|
646
|
-
hash:
|
647
|
+
hash: -3940758227593037558
|
647
648
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
648
649
|
none: false
|
649
650
|
requirements:
|
@@ -652,7 +653,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
652
653
|
version: '0'
|
653
654
|
segments:
|
654
655
|
- 0
|
655
|
-
hash:
|
656
|
+
hash: -3940758227593037558
|
656
657
|
requirements: []
|
657
658
|
rubyforge_project:
|
658
659
|
rubygems_version: 1.8.23
|