NAME

MsOffice::Word::Surgeon::Utils - utility functions for MsOffice::Word::Surgeon

SYNOPSIS

use MsOffice::Word::Surgeon::Utils qw(maybe_preserve_spaces);
my $attr = maybe_preserve_spaces($some_text);

DESCRIPTION

Functions in this module are used internally by MsOffice::Word::Surgeon.

FUNCTIONS

maybe_preserve_spaces

my $attr = maybe_preserve_spaces($some_text);

Returns the XML attribute to be inserted into <w:t> nodes and <w:delText> nodes when the literal text within the node starts or ends with a space -- in that case the XML should contain the attribute xml:space="preserve"

is_at_run_level

if (is_at_run_level($xml)) {...}

Returns true if the given XML fragment ends with a </w:r>, </w:del> or </w:ins> node.