Class: Uniword::Validation::Rules::TablesRule
- Inherits:
-
Base
- Object
- Base
- Uniword::Validation::Rules::TablesRule
show all
- Defined in:
- lib/uniword/validation/rules/tables_rule.rb
Overview
Validates table structure.
DOC-060: Table grid columns match cell tc count DOC-061: Merge cells have valid gridSpan/vMerge
Constant Summary
collapse
- W_NS =
"http://schemas.openxmlformats.org/wordprocessingml/2006/main"
Instance Method Summary
collapse
Methods inherited from Base
#description, #validity_rule
Instance Method Details
#applicable?(context) ⇒ Boolean
19
20
21
|
# File 'lib/uniword/validation/rules/tables_rule.rb', line 19
def applicable?(context)
context.part_exists?("word/document.xml")
end
|
#category ⇒ Object
16
|
# File 'lib/uniword/validation/rules/tables_rule.rb', line 16
def category = :tables
|
#check(context) ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/uniword/validation/rules/tables_rule.rb', line 23
def check(context)
issues = []
doc = context.document_xml
return issues unless doc
doc.root.xpath(".//w:tbl",
"w" => W_NS).each_with_index do |table, idx|
check_table(table, idx, issues)
end
issues
end
|
#code ⇒ Object
15
|
# File 'lib/uniword/validation/rules/tables_rule.rb', line 15
def code = "DOC-060"
|
#severity ⇒ Object
17
|
# File 'lib/uniword/validation/rules/tables_rule.rb', line 17
def severity = "warning"
|