ddnet/docs/doctool/Modules/NaturalDocs/NDMarkup.pm
Magnus Auvinen 9ba8e6cf38 moved docs
2007-05-22 15:06:55 +00:00

77 lines
1.4 KiB
Perl

###############################################################################
#
# Package: NaturalDocs::NDMarkup
#
###############################################################################
#
# A package of support functions for dealing with <NDMarkup>.
#
# 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-2005 Greg Valure
# Natural Docs is licensed under the GPL
use strict;
use integer;
package NaturalDocs::NDMarkup;
#
# Function: ConvertAmpChars
#
# Substitutes certain characters with their <NDMarkup> amp chars.
#
# Parameters:
#
# text - The block of text to convert.
#
# Returns:
#
# The converted text block.
#
sub ConvertAmpChars #(text)
{
my ($self, $text) = @_;
$text =~ s/&/&amp;/g;
$text =~ s/</&lt;/g;
$text =~ s/>/&gt;/g;
$text =~ s/\"/&quot;/g;
return $text;
};
#
# Function: RestoreAmpChars
#
# Replaces <NDMarkup> amp chars with their original symbols.
#
# Parameters:
#
# text - The text to restore.
#
# Returns:
#
# The restored text.
#
sub RestoreAmpChars #(text)
{
my ($self, $text) = @_;
$text =~ s/&quot;/\"/g;
$text =~ s/&gt;/>/g;
$text =~ s/&lt;/</g;
$text =~ s/&amp;/&/g;
return $text;
};
1;