How to Personalize the Created Web Page
The web page is created from a perl module in the namespace
Netcomics::HTML::Themes. Copy the following template:
package Netcomics::HTML::Themes::ThemeName;
use vars '@ISA'; @ISA = ("Netcomics::HTML::Themes::Default");
use strict;
my (%html,%imgs);
sub new {
my $class = shift;
return $class->SUPER::new("Theme Name",\%imgs,\%html);
}
1;
Then for each part of the default theme you want to change, copy it
from the Default.pm theme file into yours and modify it. If you don't
want to use any of the Default theme, then make your's ISA line be
"Netcomics::HTML::Theme".
To make a theme with images, use the mktheme script in the contrib
directory (or doc directory if installed from an rpm) to produce the
perl code from a set of images. To get the actual images out of their
mime-encoded form, use the theme to create a set of html pages, and it
will place them in a subdirectory ".theme". See the CleanRound theme
for an example. Note that you can name the image files whatever you
want--and they don't even have to be images either.
The html hash has 10 keys, each of which is refered to in here as a
"section":
- head:
- The string <DATE> is replaced with
the date of the form "mon day, Year". This can be changed
using the -wf option ($webpage_datefmt in the rc file).
This can be used in any section, though.
- If <DATE> is provided with the optional attribute,
FORMAT="", the text between the quotes is used
as the format specifier for the POSIX::strftime() function.
The whole <DATE FORMAT=""> is replaced with the
string produced by strftime(). Escaped double quotes are
not allowed between the quotes. See the man page for
strftime() on your system.
- <PAGETITLE>: title of the page. This can be
used in any section, though.
- <CTIME>: time at which the page is created.
Can be used in any section.
- <THEME_DIR>: location where the theme images
are placed. This can be used in any section.
- <NUM=FIRST>: Number of the first comic in the
page of the whole set.
- <NUM=LAST>: Number of the last comics in the page.
- <NUM=TOTAL>: Total number of comics in the
whole set.
- <LINK_COLOR>: User's selection of the color
applied to unvisited links.
- <VLINK_COLOR>: User's selection of the color
applied to visited links.
- <BACKGROUND>: User's selection for the
background attribute for the page.
- links: provides the links for going forward &
backward through a set of pages. Used when the page has no
corresponding index page (in index pages themselves & in the
comic pages when the user has selected to not have an index
created).
- <FILE=PREV> is replaced with the filename
of the previous webpage file.
- <FILE=NEXT> is replaced with the filename
of the next webpage file.
- <NUM> is replaced with the number of comics
per page.
- links_index: Both of the file types in links
are also replaced in this one, plus <FILE=INDEX>
which is replaced with the filename of the page's corresponding
index page. This template is used instead of links if an
index is created (by default).
- pre_body: include anything you want between the head and
the body. This is usually the start of a TABLE.
- body: A body is used to contain a single comic, so this
is typically a table row.
-
- <COMIC_ID> is replaced with the id of the
comic so that it can be uniquely hyperlinked to (the date
is also attached to the id).
- <COMIC_NAME> is replaced with the name of
the comic.
- <ELEMENT> is replaced with 1 to n body_el
sections. A body_el section is used for each image that
makes up the comic.
- <CAPTION> is replaced with the caption
section or a blank string if the comic doesn't have a
caption.
- <WIDTH> is replaced with the HTML
<IMG> attribute WIDTH=#. This is needed for theming
with images used to frame the comic. Although not a
perfect way of determining the width for multi-file
comics, width is that of the widest image in the
set that makes up the comic.
- <HEIGHT> is replaced with the HTML
<IMG> attribute HEIGHT=#. This is needed for theming
with images used to frame the comic. Although not a
perfect way of determining the height for multi-file
comics, height is the sum of the heights of all the images
that make up the comic.
body_el:
- <COMIC_FILE#> is replaced with the filename of
the comic.
- <SIZE> is replaced with the HTML
<IMG> attributes HEIGHT=# and WIDTH=#. This
make rendering the web page happen more quickly in
most browsers.
caption:
- <CAPTION_DATA>: replaced with the comic's
caption data.
tail: The string <CTIME> is replaced with
the date as returned by POSIX::ctime().
index_element: When created, an index webpage is
constructed using head, an instance of this template for
each comic, and tail.
- <FILE=CURRENT> is replaced with the
name of the webpage in which the comic is included.
- <COMIC_ID> is replaced with the id of the
comic so that it can be uniquely hyperlinked to (the date
is also attached to the id).
- <COMIC_DATE> is replaced with the date of
the comic.
- <COMIC_NAME> is replaced with the name of
the comic.
- <COMIC_AUTHOR> is replaced with author of
the comic.
- <COMIC_STATUS> is replaced with the status
of the comic. If it a local file, "local"; if it is a URL,
"remote".
- <PAGE=CURRENT> is replaced with number of
the webpage in which the comic is included.
How to Personalize the Created Web Page (Old Style, pre-0.14 release)
The web page is created from three template files: a head (contains
more than just the html head section): head.html, a body
element: body_el#.html, and a tail: tail.html. The head &
tail are used once, and the body element is repeated for each comic
strip. The files are installed by default under
/usr/share/netcomics/html_tmpl/.
There are multiple body_el#.html files. The number indicates
the number of image files in a comic that template handles. For
example, some comic strips provide each panel on Sunday in a seperate
file. If there are 5 frames total, then body_el5.html will be used.
Inside it are 5 places for the file names to be inserted. (Yes, I
don't like this design, but it was quick. At some point, I'll change
it so that there's 2 templates for the body elements--a template
wrapper around a set of file element templates, and a file element
template.)
Since you are allowed to specify a different directory to contain
these files with the -m option, if you do use that option, you
must create a set of template html files, or the web page will not be
created when using the -w or -W options. I suggest
copying the template files and modifying them instead of starting from
scratch.
What's replaced in the template files when writing out index.html
- head.html:
- The string "<DATE>" is replaced with
the date of the form "Month day Year".
- If <DATE> is provided with the optional attribute,
FORMAT="", the text between the quotes is used
as the format specifier for the POSIX::strftime() function.
The whole <DATE FORMAT=""> is replaced with the
string produced by strftime(). Escaped double quotes are
not allowed between the quotes. See the man page for
strftime() on your system.
- body_el#.html:
- "<COMIC_FILE#>" is replaced with the filename of
the comic.
- "<COMIC_NAME>" is replaced with the name of
the comic.
- "<SIZE>" is replaced with the <IMG> attributes
HEIGHT=# and WEIGHT=#. This will help make rendering the web page
happen more quickly in most browsers.
- tail.html: The string "<CTIME>" is replaced with
the date as returned by POSIX::ctime().
- links.html:
- "<FILE=PREV>" is replaced with the filename
of the previous webpage file.
- "<FILE=NEXT>" is replaced with the filename
of the next webpage file.
links_index.html: Both of the file types in links.html
are also replaced in this one, plus "<FILE=NEXT>"
which is replaced with the filename of the next webpage
index. This template is used instead of links.html if an index
is created (by default).
- index_body_el.html: When created, an index webpage is
constructed using head.html, an instance of this template for
each comic, and tail.html.
- "<FILE=CURRENT>" is replaced with the
name of the webpage in which the comic is included.
- "<COMIC_ID>" is replaced with the id of the
comic so that it can be uniquely hyperlinked to (the date
is also attached to the id).
- "<COMIC_DATE>" is replaced with the date of
the comic.
- "<COMIC_NAME>" is replaced with the name of
the comic.
- "<COMIC_AUTHOR>" is replaced with author of
the comic.
- "<COMIC_STATUS>" is replaced with the status
of the comic. If it a local file, "local"; if it is a URL,
"remote".
- "<PAGE=CURRENT>" is replaced with number of
the webpage in which the comic is included.
Netcomics Maintainers <netcomics-maintainers@lists.sf.net>
Last modified: Thu May 30 08:33:10 CDT 2002