Class: Uniword::Validation::Rules::StyleReferencesRule

Inherits:
Base
  • Object
show all
Defined in:
lib/uniword/validation/rules/style_references_rule.rb

Overview

Validates style references exist in styles.xml.

DOC-001: Style IDs referenced in document.xml exist in styles.xml DOC-002: Default paragraph style exists DOC-003: Style references in numbering.xml exist in styles.xml

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

Returns:

  • (Boolean)


20
21
22
23
# File 'lib/uniword/validation/rules/style_references_rule.rb', line 20

def applicable?(context)
  context.part_exists?("word/document.xml") &&
    context.part_exists?("word/styles.xml")
end

#categoryObject



17
# File 'lib/uniword/validation/rules/style_references_rule.rb', line 17

def category = :styles

#check(context) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/uniword/validation/rules/style_references_rule.rb', line 25

def check(context)
  issues = []
  defined_ids = context.style_ids
  check_document_refs(context, defined_ids, issues)
  check_default_style(context, defined_ids, issues)
  check_numbering_refs(context, defined_ids, issues)
  issues
end

#codeObject



16
# File 'lib/uniword/validation/rules/style_references_rule.rb', line 16

def code = "DOC-001"

#severityObject



18
# File 'lib/uniword/validation/rules/style_references_rule.rb', line 18

def severity = "error"