summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-08-13 14:30:30 (EDT)
committer P. J. McDermott <pjm@nac.net>2012-08-13 14:30:30 (EDT)
commit93a3719a5deff6297ce7be97939dba1d0155dde0 (patch)
tree84822be5a4aa7356ba1050c81d0269d1919f357a
parente6106e4bfd22aa448fd972150e6bcc39e9fbcb45 (diff)
Move MarkdownBook modules into Text namespace.
-rwxr-xr-xbin/markdownbook.pl4
-rw-r--r--lib/Text/MarkdownBook/Book.pm (renamed from lib/MarkdownBook/Book.pm)12
-rw-r--r--lib/Text/MarkdownBook/Document.pm (renamed from lib/MarkdownBook/Document.pm)6
-rw-r--r--lib/Text/MarkdownBook/Document/html.pm (renamed from lib/MarkdownBook/Document/html.pm)15
-rw-r--r--lib/Text/MarkdownBook/Document/txt.pm (renamed from lib/MarkdownBook/Document/txt.pm)6
-rw-r--r--lib/Text/MarkdownBook/HTMLTree.pm (renamed from lib/MarkdownBook/HTMLTree.pm)2
-rw-r--r--lib/Text/MarkdownBook/Section.pm (renamed from lib/MarkdownBook/Section.pm)2
7 files changed, 24 insertions, 23 deletions
diff --git a/bin/markdownbook.pl b/bin/markdownbook.pl
index cceecdb..48c0cd6 100755
--- a/bin/markdownbook.pl
+++ b/bin/markdownbook.pl
@@ -18,7 +18,7 @@
use strict;
use warnings;
-use MarkdownBook::Book;
+use Text::MarkdownBook::Book;
my $format;
my $doc_dir;
@@ -26,7 +26,7 @@ my $book;
($format, $doc_dir) = @ARGV;
-$book = MarkdownBook::Book->new($format, $doc_dir);
+$book = Text::MarkdownBook::Book->new($format, $doc_dir);
$book->parse();
$book->output();
diff --git a/lib/MarkdownBook/Book.pm b/lib/Text/MarkdownBook/Book.pm
index 4f30afb..4c49d1d 100644
--- a/lib/MarkdownBook/Book.pm
+++ b/lib/Text/MarkdownBook/Book.pm
@@ -18,7 +18,7 @@ use warnings;
use Carp;
-package MarkdownBook::Book;
+package Text::MarkdownBook::Book;
sub new
{
@@ -34,7 +34,7 @@ sub new
Carp::croak('Invalid format "' . $format . '"');
}
eval {
- require 'MarkdownBook/Document/' . $format . '.pm';
+ require 'Text/MarkdownBook/Document/' . $format . '.pm';
1;
} or Carp::croak('Unsupported format "' . $format . '"');
$self->{'format'} = $format;
@@ -93,7 +93,7 @@ sub _get_document_module
{
my ($self) = @_;
- return 'MarkdownBook::Document::' . $self->{'format'};
+ return 'Text::MarkdownBook::Document::' . $self->{'format'};
}
sub create_documents
@@ -156,7 +156,7 @@ sub add_section
push(@{$self->{'sections'}}, $section);
# Index sections (not documents) by ID.
- if (ref($section) eq 'MarkdownBook::Section') {
+ if (ref($section) eq 'Text::MarkdownBook::Section') {
$self->{'sections_by_id'}->{$section->id()} = $section;
}
}
@@ -216,7 +216,7 @@ sub _do_gen_toc
foreach $section (@{$self->{'sections'}}) {
$toc .= "\n" if $toc ne '';
- if (ref($section) =~ m/^MarkdownBook::Document/) {
+ if (ref($section) =~ m/^Text::MarkdownBook::Document/) {
next if $section->type() eq 'index';
$toc .= ' * [';
$toc .= $section->id();
@@ -225,7 +225,7 @@ sub _do_gen_toc
$toc .= '][';
$toc .= $section->file();
$toc .= ']';
- } elsif (ref($section) eq 'MarkdownBook::Section') {
+ } elsif (ref($section) eq 'Text::MarkdownBook::Section') {
$toc .= ' ' x $section->level();
$toc .= ($section->level() == 1 ? ' - [' : ' * [');
$toc .= $section->number();
diff --git a/lib/MarkdownBook/Document.pm b/lib/Text/MarkdownBook/Document.pm
index 2a30396..af16be4 100644
--- a/lib/MarkdownBook/Document.pm
+++ b/lib/Text/MarkdownBook/Document.pm
@@ -16,10 +16,10 @@
use strict;
use warnings;
-use MarkdownBook::Section;
+use Text::MarkdownBook::Section;
use Carp;
-package MarkdownBook::Document;
+package Text::MarkdownBook::Document;
sub new
{
@@ -230,7 +230,7 @@ sub _do_heading
/$1/x;
# Create and store section object.
- $section = MarkdownBook::Section->new($self,
+ $section = Text::MarkdownBook::Section->new($self,
$level, $section_number, $section_id, $section_title);
push(@{$self->{'sections'}}, $section);
$self->{'book'}->add_section($section);
diff --git a/lib/MarkdownBook/Document/html.pm b/lib/Text/MarkdownBook/Document/html.pm
index 60f22c7..e074de0 100644
--- a/lib/MarkdownBook/Document/html.pm
+++ b/lib/Text/MarkdownBook/Document/html.pm
@@ -16,16 +16,16 @@
use strict;
use warnings;
-use MarkdownBook::Document;
-use MarkdownBook::HTMLTree;
+use Text::MarkdownBook::Document;
+use Text::MarkdownBook::HTMLTree;
use Carp;
use Text::Markdown;
use HTML::TreeBuilder;
use HTML::Template;
-package MarkdownBook::Document::html;
+package Text::MarkdownBook::Document::html;
-our @ISA = qw(MarkdownBook::Document);
+our @ISA = qw(Text::MarkdownBook::Document);
sub output
{
@@ -84,14 +84,15 @@ sub _do_set_heading_id_attrs
$self->{'tree'}->eof($text);
# Find the "body" element.
- @{$self->{'tree_body'}} = MarkdownBook::HTMLTree::find_elements_by_tag_names(
- $self->{'tree'}, ('body'));
+ @{$self->{'tree_body'}} =
+ Text::MarkdownBook::HTMLTree::find_elements_by_tag_names(
+ $self->{'tree'}, ('body'));
# Don't modify headings of index documents.
return if $self->{'type'} eq 'index';
# Find all headings.
- @headings = MarkdownBook::HTMLTree::find_elements_by_tag_names(
+ @headings = Text::MarkdownBook::HTMLTree::find_elements_by_tag_names(
@{$self->{'tree_body'}}[0], ('h1', 'h2'));
# Set "id" attributes.
diff --git a/lib/MarkdownBook/Document/txt.pm b/lib/Text/MarkdownBook/Document/txt.pm
index f150477..f2a8a77 100644
--- a/lib/MarkdownBook/Document/txt.pm
+++ b/lib/Text/MarkdownBook/Document/txt.pm
@@ -16,12 +16,12 @@
use strict;
use warnings;
-use MarkdownBook::Document;
+use Text::MarkdownBook::Document;
use Carp;
-package MarkdownBook::Document::txt;
+package Text::MarkdownBook::Document::txt;
-our @ISA = qw(MarkdownBook::Document);
+our @ISA = qw(Text::MarkdownBook::Document);
sub output
{
diff --git a/lib/MarkdownBook/HTMLTree.pm b/lib/Text/MarkdownBook/HTMLTree.pm
index e01bab0..6080475 100644
--- a/lib/MarkdownBook/HTMLTree.pm
+++ b/lib/Text/MarkdownBook/HTMLTree.pm
@@ -18,7 +18,7 @@ use warnings;
use HTML::Element;
-package MarkdownBook::HTMLTree;
+package Text::MarkdownBook::HTMLTree;
sub find_elements_by_tag_names
{
diff --git a/lib/MarkdownBook/Section.pm b/lib/Text/MarkdownBook/Section.pm
index 82ff897..75e13b8 100644
--- a/lib/MarkdownBook/Section.pm
+++ b/lib/Text/MarkdownBook/Section.pm
@@ -16,7 +16,7 @@
use strict;
use warnings;
-package MarkdownBook::Section;
+package Text::MarkdownBook::Section;
sub new
{