MsOffi...:Utils(3pm)
π MsOffi...:Utils(3pm) π
okay so bestie, welcome to MsOffice::Word::Surgeon::Utils β it's part of the User Contributed Perl Documentation crew, and it's basically the little backstage helper squad for MsOffice::Word::Surgeon. no cap. β¨
πΈ NAME πΈ
MsOffice::Word::Surgeon::Utils β the utility functions that do the behind-the-scenes lifting for MsOffice::Word::Surgeon. it's giving backstage crew with main character energy fr fr π
β¨ SYNOPSIS β¨
use MsOffice::Word::Surgeon::Utils qw(maybe_preserve_spaces);
my $attr = maybe_preserve_spaces($some_text);
like, that's it. that's the whole vibe check. π
π¦ DESCRIPTION π¦
so these functions? they're used internally by MsOffice::Word::Surgeon. meaning: they're the helpers doing the work behind the curtain, not the ones you're meant to be chatting up at the party. iykyk. π
π FUNCTIONS π
π maybe_preserve_spaces
my $attr = maybe_preserve_spaces($some_text);
returns the XML attribute you need to drop into <w:t> nodes and <w:delText> nodes whenever the literal text inside the node starts or ends with a space β because in that case the XML needs to contain the attribute xml:space="preserve". literally just doing its job so your spaces don't get ghosted. β¨
π§ is_at_run_level
if (is_at_run_level($xml)) {...}
returns true if the XML fragment you handed it ends with a </w:r>, </w:del> or </w:ins> node. it's basically the "are we at run level, bestie?" check. π
π parse_attrs
my %attrs = parse_attrs($lst_attrs)
returns a hash of name-value pairs parsed out of the input string. the values may be wrapped in single quotes or double quotes (both are valid, we don't play favourites π ), and the values get entity-decoded for you. slay.
π decode_entities
decode_entities($string)
decodes XML entities inside the string you pass in β and heads up, it's doing that in-place. so it's not returning you a shiny new string, it's editing the one you gave it. glow-up in place, iconic behaviour tbh. π₯
β encode_entities
encode_entities($string)
the mirror-image queen: encodes XML entities inside the string β also in-place. same deal, it transforms the string you handed over rather than making a copy. π
π COPYRIGHT AND LICENSE π
Copyright 2019-2024 by Laurent Dami.
This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0. fr fr, go forth and remix. π«Ά
and that's a wrap, bestie!! this page was served up by perl v5.40.1 on 2025-10-05, and the whole doc lives under the MsOffi...:Utils(3pm) header. mwah. ππ
π¦ where this page comes from
- ubuntu resolute: libmsoffice-word-surgeon-perl 2.11-1 Β· Artistic-2.0
- ubuntu stonking: libmsoffice-word-surgeon-perl 2.11-1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms