From c833c0a666d47147238eb013c4eaef4d389940ef Mon Sep 17 00:00:00 2001 From: Marin Ivanov Date: Fri, 5 Apr 2013 18:32:36 +0300 Subject: Added matching by post/page title --- wikilinks.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wikilinks.rb b/wikilinks.rb index e8f9cad..ac5c894 100644 --- a/wikilinks.rb +++ b/wikilinks.rb @@ -18,7 +18,7 @@ module Jekyll def title if @title.nil? if not @match.nil? - match_title + match_title @match else @name end @@ -27,9 +27,9 @@ module Jekyll end end - def match_title - if not @match.data.nil? and @match.data.include? 'title' - @match.data['title'] + def match_title(m) + if not m.data.nil? and m.data.include? 'title' + m.data['title'] end end @@ -42,11 +42,11 @@ module Jekyll end def match_post(posts) - @match = posts.find { |p| p.slug.downcase == @name.downcase } + @match = posts.find { |p| p.slug.downcase == @name.downcase or match_title(p) == name } end def match_page(pages) - @match = pages.find { |p| p.basename.downcase == @name.downcase } + @match = pages.find { |p| p.basename.downcase == @name.downcase or match_title(p) == name } end def markdown -- cgit v1.2.3