The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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.

parse_attrs

  my %attrs = parse_attrs($lst_attrs)

Returns a hash of name-value pairs parsed from the input string. Values may be enclosed in single or in double quotes. Values are entity-decoded.

decode_entities

  decode_entities($string)

Decodes XML entities within the supplied string (in-place decoding).

encode_entities

  encode_entities($string)

Encodes XML entities within the supplied string (in-place encoding).