Class: Uniword::Validation::Rules::EmptyParagraphsRule
- Inherits:
-
ModelRule
- Object
- Base
- ModelRule
- Uniword::Validation::Rules::EmptyParagraphsRule
show all
- Defined in:
- lib/uniword/validation/rules/empty_paragraphs_rule.rb
Overview
DOC-203: paragraphs should not be empty.
Empty paragraphs are usually leftover scaffolding; reported as
warnings only.
Instance Method Summary
collapse
Methods inherited from ModelRule
#context_type
Methods inherited from Base
#applicable?, #context_type, #description, #validity_rule
Instance Method Details
#category ⇒ Object
12
|
# File 'lib/uniword/validation/rules/empty_paragraphs_rule.rb', line 12
def category = :structure
|
#check(context) ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'lib/uniword/validation/rules/empty_paragraphs_rule.rb', line 15
def check(context)
paragraphs = context.document.paragraphs
paragraphs.each_with_index.filter_map do |para, idx|
next unless para.runs.nil? || para.runs.empty?
issue("Empty paragraph at index #{idx}",
part: "word/document.xml")
end
end
|
#code ⇒ Object
11
|
# File 'lib/uniword/validation/rules/empty_paragraphs_rule.rb', line 11
def code = "DOC-203"
|
#severity ⇒ Object
13
|
# File 'lib/uniword/validation/rules/empty_paragraphs_rule.rb', line 13
def severity = "warning"
|