Class: Uniword::Validation::Rules::DocumentBodyRule

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

Overview

DOC-200: the document must have a body.

A w:document without w:body carries no content; every document must contain exactly one body 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/document_body_rule.rb', line 12

def category = :structure

#check(context) ⇒ Object



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

def check(context)
  return [] if context.document.body

  [issue("Document body is missing",
         part: "word/document.xml",
         suggestion: "Add a w:body element to the document.")]
end

#codeObject



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

def code = "DOC-200"

#severityObject



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

def severity = "error"