<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">###############################################################################
#
#   Package: NaturalDocs::NDMarkup
#
###############################################################################
#
#   A package of support functions for dealing with &lt;NDMarkup&gt;.
#
#   Usage and Dependencies:
#
#       The package doesn't depend on any Natural Docs packages and is ready to use right away.
#
###############################################################################

# This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure
# Natural Docs is licensed under the GPL


use strict;
use integer;

package NaturalDocs::NDMarkup;

#
#   Function: ConvertAmpChars
#
#   Substitutes certain characters with their &lt;NDMarkup&gt; amp chars.
#
#   Parameters:
#
#       text - The block of text to convert.
#
#   Returns:
#
#       The converted text block.
#
sub ConvertAmpChars #(text)
    {
    my ($self, $text) = @_;

    $text =~ s/&amp;/&amp;amp;/g;
    $text =~ s/&lt;/&amp;lt;/g;
    $text =~ s/&gt;/&amp;gt;/g;
    $text =~ s/\"/&amp;quot;/g;

    return $text;
    };


#
#   Function: RestoreAmpChars
#
#   Replaces &lt;NDMarkup&gt; amp chars with their original symbols.
#
#   Parameters:
#
#       text - The text to restore.
#
#   Returns:
#
#       The restored text.
#
sub RestoreAmpChars #(text)
    {
    my ($self, $text) = @_;

    $text =~ s/&amp;quot;/\"/g;
    $text =~ s/&amp;gt;/&gt;/g;
    $text =~ s/&amp;lt;/&lt;/g;
    $text =~ s/&amp;amp;/&amp;/g;

    return $text;
    };


1;
</pre></body></html>