summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-08-11 16:42:34 (EDT)
committer P. J. McDermott <pjm@nac.net>2012-08-11 16:52:53 (EDT)
commit2d9c61d9e4854e2038e2c6afb65b1cfee236bbf5 (patch)
tree84effcca4542a7acc406a39a8ad2662bf711d6b4
parentba9ef7040bec8bee6c419802c493f3e876bd35f6 (diff)
Remove format-specific book module.
-rw-r--r--scripts/MarkdownBook/Book.pm15
-rw-r--r--scripts/MarkdownBook/Book/HTML.pm42
-rw-r--r--scripts/MarkdownBook/Document/HTML.pm1
-rwxr-xr-xscripts/postproc.pl7
4 files changed, 18 insertions, 47 deletions
diff --git a/scripts/MarkdownBook/Book.pm b/scripts/MarkdownBook/Book.pm
index ffabb18..5581fb3 100644
--- a/scripts/MarkdownBook/Book.pm
+++ b/scripts/MarkdownBook/Book.pm
@@ -16,6 +16,11 @@
use strict;
use warnings;
+# These are temporary.
+use MarkdownBook::Document::HTML::Index;
+use MarkdownBook::Document::HTML::Chapter;
+use MarkdownBook::Document::HTML::Appendix;
+
package MarkdownBook::Book;
sub new
@@ -28,7 +33,13 @@ sub new
$self = {};
bless($self, $class);
- $self->{'format'} = $format;
+ if ($format eq 'html') {
+ $self->{'format'} = 'html';
+ $self->{'format_mod'} = 'HTML';
+ } elsif ($format eq 'txt') {
+ $self->{'format'} = 'txt';
+ $self->{'format_mod'} = 'Txt';
+ }
$self->{'dir'} = $dir;
$self->{'docs'} = [];
@@ -81,7 +92,7 @@ sub get_document_module
{
my ($self, $mod) = @_;
- return 'MarkdownBook::Document::' . $self->{'format'} . '::' . $mod;
+ return 'MarkdownBook::Document::' . $self->{'format_mod'} . '::' . $mod;
}
sub create_documents
diff --git a/scripts/MarkdownBook/Book/HTML.pm b/scripts/MarkdownBook/Book/HTML.pm
deleted file mode 100644
index 1edc215..0000000
--- a/scripts/MarkdownBook/Book/HTML.pm
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright (C) 2012 Patrick "P. J." McDermott
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-use strict;
-use warnings;
-
-use MarkdownBook::Document::HTML::Index;
-use MarkdownBook::Document::HTML::Chapter;
-use MarkdownBook::Document::HTML::Appendix;
-use HTML::Template;
-
-package MarkdownBook::Book::HTML;
-
-use base qw(MarkdownBook::Book);
-
-sub new
-{
- my ($class, @args) = @_;
- my $self;
-
- $class = ref($class) || $class;
- $self = {};
- bless($self, $class);
-
- $self = $self->SUPER::new('HTML', @args);
-
- return $self;
-}
-
-1;
diff --git a/scripts/MarkdownBook/Document/HTML.pm b/scripts/MarkdownBook/Document/HTML.pm
index bb30e56..f2c8d1c 100644
--- a/scripts/MarkdownBook/Document/HTML.pm
+++ b/scripts/MarkdownBook/Document/HTML.pm
@@ -18,6 +18,7 @@ use warnings;
use MarkdownBook::Document;
use MarkdownBook::Section::HTML;
+use HTML::Template;
package MarkdownBook::Document::HTML;
diff --git a/scripts/postproc.pl b/scripts/postproc.pl
index 5c33c72..cceecdb 100755
--- a/scripts/postproc.pl
+++ b/scripts/postproc.pl
@@ -18,14 +18,15 @@
use strict;
use warnings;
-use MarkdownBook::Book::HTML;
+use MarkdownBook::Book;
+my $format;
my $doc_dir;
my $book;
-($doc_dir) = @ARGV;
+($format, $doc_dir) = @ARGV;
-$book = MarkdownBook::Book::HTML->new($doc_dir);
+$book = MarkdownBook::Book->new($format, $doc_dir);
$book->parse();
$book->output();