ls2html is a perl module containing a function which generates HTML for a series
of links to files.
Copyright (c) 2018 Tim Chadburn.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the file "fdl.txt" which is part of this
package.
ls2html is a perl module containing a function which generates HTML for a series
of links to files.
ls2html(NAME_FORMAT, SPACE, FILE ...)
This function creates HTML which consists of a link for each FILE given. What
is in between these links is determined by SPACE, which should be a simple
string. The HTML created is printed on standard output.
NAME_FORMAT must be a function reference. The function must take one argument
which is the name of a file. The function's purpose is to convert the name
of the file being linked to to the text shown on the link, which must be
returned.
Example usage:
ls2html(\&fname2title, @ARGV);
ls2html is implemented by the programs ls2html-filename, ls2html-title and
ls2html-subdir.
---------------
ls2html-filename SPACE FILE ...
ls2html-filename generates HTML for a series of links to files with the text of
the link being the filename. SPACE is the HTML to put between the links. The
HTML created is printed on standard output.
Example usage:
ls2html-filename "
" *@(txt|html) > docs.html
---------------------
ls2html-title SPACE FILE ...
ls2html-title generates HTML for a series of links to files with the text of
the link being the part of the filename before the dot with the first letters
of the words capitalized and the hyphens turned to spaces. SPACE is the HTML
to put between the links. The HTML created is printed on standard output.
Example usage:
ls2html-title "
" *.txt > poems.html
---------------------------
ls2html-subdir LEVEL SPACE FILE ...
ls2html-subdir generates HTML for a series of links to files with the text of
the link being the pathname of the file with the first LEVEL directories
removed as described under the function `subdir' in the filename module.
ls2html-subdir 1 "
" subdirectory/*
would create links to everything in subdirectory but the links' names would
contain just the filenames without the name of subdirectory attached to the
front.