disable true LSI by default, enable with --lsi
This commit is contained in:
parent
2a8345df82
commit
b1bf818c6d
|
@ -1,6 +1,7 @@
|
|||
==
|
||||
* Major Features
|
||||
* Code highlighting with Pygments if --pygments is specified
|
||||
* Disable true LSI by default, enable with --lsi
|
||||
* Minor Enhancements
|
||||
* Output informative message if RDiscount is not available [github.com/JackDanger]
|
||||
* Bug Fixes
|
||||
|
|
|
@ -25,6 +25,10 @@ opts = OptionParser.new do |opts|
|
|||
options[:auto] = true
|
||||
end
|
||||
|
||||
opts.on("--lsi", "Use LSI for better related posts") do
|
||||
Jekyll.lsi = true
|
||||
end
|
||||
|
||||
opts.on("--pygments", "Use pygments to highlight code") do
|
||||
Jekyll.pygments = true
|
||||
end
|
||||
|
|
|
@ -34,9 +34,10 @@ module Jekyll
|
|||
VERSION = '0.1.4'
|
||||
|
||||
class << self
|
||||
attr_accessor :pygments
|
||||
attr_accessor :lsi, :pygments
|
||||
end
|
||||
|
||||
Jekyll.lsi = false
|
||||
Jekyll.pygments = false
|
||||
|
||||
def self.process(source, dest)
|
||||
|
|
|
@ -97,16 +97,21 @@ module Jekyll
|
|||
# Returns [<Post>]
|
||||
def related_posts(posts)
|
||||
return [] unless posts.size > 1
|
||||
self.class.lsi ||= begin
|
||||
puts "Running the classifier... this could take a while."
|
||||
lsi = Classifier::LSI.new
|
||||
posts.each { |x| $stdout.print(".");$stdout.flush;lsi.add_item(x) }
|
||||
puts ""
|
||||
lsi
|
||||
end
|
||||
|
||||
if Jekyll.lsi
|
||||
self.class.lsi ||= begin
|
||||
puts "Running the classifier... this could take a while."
|
||||
lsi = Classifier::LSI.new
|
||||
posts.each { |x| $stdout.print(".");$stdout.flush;lsi.add_item(x) }
|
||||
puts ""
|
||||
lsi
|
||||
end
|
||||
|
||||
related = self.class.lsi.find_related(self.content, 11)
|
||||
related - [self]
|
||||
related = self.class.lsi.find_related(self.content, 11)
|
||||
related - [self]
|
||||
else
|
||||
(posts - [self])[0..9]
|
||||
end
|
||||
end
|
||||
|
||||
# Add any necessary layouts to this post
|
||||
|
|
Loading…
Reference in New Issue