All checks were successful
CI Pipeline / build (push) Successful in 49s
Strip invalid XML 1.0 control characters (0x00-0x08, 0x0B-0x0C, 0x0E-0x1F) from text to prevent corrupted docx files that fail to open in LibreOffice. Fixes SAXParseException 'PCData Invalid Char value' errors.
23 lines
587 B
Ruby
23 lines
587 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Notare
|
|
module Nodes
|
|
class Run < Base
|
|
attr_reader :text, :bold, :italic, :underline, :strike, :highlight, :color, :style
|
|
|
|
def initialize(text, bold: false, italic: false, underline: false,
|
|
strike: false, highlight: nil, color: nil, style: nil)
|
|
super()
|
|
@text = XmlSanitizer.sanitize(text)
|
|
@bold = bold
|
|
@italic = italic
|
|
@underline = underline
|
|
@strike = strike
|
|
@highlight = highlight
|
|
@color = color
|
|
@style = style
|
|
end
|
|
end
|
|
end
|
|
end
|