Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Indexer should ignore headers wrapped in <construction>

  • Loading branch information...
commit 293a7a8e91e723af44205c96d554c7e8a6fa1c8b 1 parent 0d9706d
@wagenet wagenet authored
Showing with 8 additions and 2 deletions.
  1. +1 −1  lib/guides/generator.rb
  2. +7 −1 lib/guides/indexer.rb
View
2  lib/guides/generator.rb
@@ -201,7 +201,7 @@ def set_index(body, view, processor)
<ol class="chapters">
INDEX
- i = Indexer.new(body, warnings)
+ i = Indexer.new(body, warnings, @production)
i.index
# Set index for 2 levels
View
8 lib/guides/indexer.rb
@@ -6,10 +6,11 @@ module Guides
class Indexer
attr_reader :body, :result, :warnings, :level_hash
- def initialize(body, warnings)
+ def initialize(body, warnings, production = false)
@body = body
@result = @body.dup
@warnings = warnings
+ @production = production
end
def index
@@ -19,6 +20,11 @@ def index
private
def process(string, current_level=3, counters=[1])
+ if @production
+ # Ignore anything in construction tags
+ string = string.gsub(%r{<construction>.*?</construction>}m, '')
+ end
+
s = StringScanner.new(string)
level_hash = ActiveSupport::OrderedHash.new
Please sign in to comment.
Something went wrong with that request. Please try again.