From 1c131dcd79d287911dfa3b7f6fb5fc8e7d0fa4ba Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sat, 11 Aug 2012 17:29:09 -0400 Subject: Remove type-specific document modules. --- (limited to 'scripts/MarkdownBook/Book.pm') diff --git a/scripts/MarkdownBook/Book.pm b/scripts/MarkdownBook/Book.pm index 5581fb3..b7216f3 100644 --- a/scripts/MarkdownBook/Book.pm +++ b/scripts/MarkdownBook/Book.pm @@ -16,10 +16,7 @@ use strict; use warnings; -# These are temporary. -use MarkdownBook::Document::HTML::Index; -use MarkdownBook::Document::HTML::Chapter; -use MarkdownBook::Document::HTML::Appendix; +use MarkdownBook::Document::HTML; package MarkdownBook::Book; @@ -90,9 +87,9 @@ sub documents sub get_document_module { - my ($self, $mod) = @_; + my ($self) = @_; - return 'MarkdownBook::Document::' . $self->{'format_mod'} . '::' . $mod; + return 'MarkdownBook::Document::' . $self->{'format_mod'}; } sub create_documents @@ -107,7 +104,8 @@ sub create_documents my @letters; $i = 0; - $doc = $self->get_document_module('Index')->new($self); + $doc = $self->get_document_module()->new($self, 'index', 'index', + undef, $self->{'title'}); $doc_prev = $doc; push(@{$self->{'docs'}}, $doc); @@ -115,7 +113,7 @@ sub create_documents while (<$series_fh>) { chomp($_); ($file, $title) = split(/[ \t]+/, $_, 2); - $doc = $self->get_document_module('Chapter')->new($self, $file, + $doc = $self->get_document_module()->new($self, 'chapter', $file, ++$i, $title); $doc->prev($doc_prev); $doc_prev->next($doc) if defined $doc_prev; @@ -132,7 +130,7 @@ sub create_documents while (<$series_fh>) { chomp($_); ($file, $title) = split(/[ \t]+/, $_, 2); - $doc = $self->get_document_module('Appendix')->new($self, $file, + $doc = $self->get_document_module()->new($self, 'appendix', $file, $letters[++$i], $title); $doc->prev($doc_prev); $doc_prev->next($doc) if defined $doc_prev; -- cgit v0.9.1