Class: Uniword::Validation::Rules::TablePropertiesRule

Inherits:
ModelRule
  • Object
show all
Defined in:
lib/uniword/validation/rules/table_properties_rule.rb

Overview

DOC-205: every table must have table properties (tblPr).

wml.xsd CT_Tbl requires exactly one tblPr child as the table's first property element.

Instance Method Summary collapse

Methods inherited from ModelRule

#context_type

Methods inherited from Base

#applicable?, #context_type, #description, #validity_rule

Instance Method Details

#categoryObject



12
# File 'lib/uniword/validation/rules/table_properties_rule.rb', line 12

def category = :tables

#check(context) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/uniword/validation/rules/table_properties_rule.rb', line 15

def check(context)
  context.document.tables.each_with_index.filter_map do |table, idx|
    next if table.properties

    issue("Table #{idx + 1} is missing the required tblPr element",
          part: "word/document.xml",
          suggestion: "Add a w:tblPr element to the table.")
  end
end

#codeObject



11
# File 'lib/uniword/validation/rules/table_properties_rule.rb', line 11

def code = "DOC-205"

#severityObject



13
# File 'lib/uniword/validation/rules/table_properties_rule.rb', line 13

def severity = "error"