--- markdown-1.0.1.orig/Markdown.pl
+++ markdown-1.0.1/Markdown.pl
@@ -8,7 +8,7 @@
#
-package Markdown;
+package Text::Markdown;
require 5.006_000;
use strict;
use warnings;
@@ -64,6 +64,9 @@
# (see _ProcessListItems() for details):
my $g_list_level = 0;
+# Check to see if Markdown.pm has been loaded; if so we must be loaded
+# as a perl module.
+my $g_perl_module = exists $INC{'Text/Markdown.pm'};
#### Blosxom plug-in interface ##########################################
@@ -87,8 +90,8 @@
#### Movable Type plug-in interface #####################################
-eval {require MT}; # Test to see if we're running in MT.
-unless ($@) {
+eval {require MT} unless $g_perl_module; # Test to see if we're running in MT.
+unless ($g_perl_module || $@) {
require MT;
import MT;
require MT::Template::Context;
@@ -178,7 +181,7 @@
});
}
}
-else {
+elsif (! $g_perl_module) {
#### BBEdit/command-line text filter interface ##########################
# Needs to be hidden from MT (and Blosxom when running in static mode).
@@ -189,7 +192,7 @@
#### Check for command-line switches: #################
my %cli_opts;
- use Getopt::Long;
+ eval {use Getopt::Long}; # don't load in library mode
Getopt::Long::Configure('pass_through');
GetOptions(\%cli_opts,
'version',
@@ -1325,14 +1328,15 @@
=head1 NAME
-B<Markdown>
+B<markdown> - convert text to HTML
=head1 SYNOPSIS
-B<Markdown.pl> [ B<--html4tags> ] [ B<--version> ] [ B<-shortversion> ]
- [ I<file> ... ]
+B<markdown> [ B<--html4tags> ] [ B<--version> ] [ B<-shortversion> ] [ I<file> ... ]
+use Markdown;
+$html=Markdown::Markdown($text);
=head1 DESCRIPTION
@@ -1355,7 +1359,7 @@
Use "--" to end switch parsing. For example, to open a file named "-z", use:
- Markdown.pl -- -z
+ markdown -- -z
=over 4
@@ -1396,15 +1400,6 @@
you expected; (3) the output Markdown actually produced.
-=head1 VERSION HISTORY
-
-See the readme file for detailed release notes for this version.
-
-1.0.1 - 14 Dec 2004
-
-1.0 - 28 Aug 2004
-
-
=head1 AUTHOR
John Gruber