Almost-minimal filesystem based blog.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
3.6 KiB

  1. =pod
  2. =head1 NAME
  3. Display - module to display fragments of text on the web and elsewhere
  4. =head1 SYNOPSIS
  5. #!/usr/bin/perl
  6. use Display;
  7. my $d = Display->new(
  8. root_dir => 'archives',
  9. url_root => '/display.pl?',
  10. # etc.
  11. );
  12. print $d->handle(@ARGV);
  13. =head1 DESCRIPTION
  14. Display started life as a simple script to concatenate fragments of handwritten
  15. HTML by date. It has since haphazardly accumulated several of the usual weblog
  16. features (comments, lightweight markup, feed generation, embedded Perl, poetry
  17. tools, image galleries, and ill-advised dependencies), but the basic idea
  18. hasn't changed much.
  19. The module will work with FastCGI, if called from the appropriate wrapper
  20. script. If you use CGI::Fast, you can pass query objects directly to
  21. C<handle()>.
  22. By default, entries are stored in a simple directory tree under C<root_dir>.
  23. Like:
  24. archives/2001/1/1
  25. archives/2001/1/1/sub_entry
  26. It is possible (although not yet as flexible as it ought to be) to redefine
  27. the directory layout. More about this after a bit.
  28. An entry may be either a plain text file, or a directory containing several
  29. files. If it's a directory, a file named "index" will be treated as the text
  30. of the entry, and all other lower-case filenames without extensions will be
  31. treated as sub-entries or documents within that entry, and displayed
  32. accordingly. Links to certain other filetypes will be displayed as well.
  33. Directories may be nested to an arbitrary depth, although it's probably not a
  34. good idea to go very deep with the current display logic.
  35. A PNG or JPEG file with a name like
  36. 2001/1/1.icon.png
  37. 2001/1/1/index.icon.png
  38. 2001/1/1/whatever.icon.png
  39. 2001/1/1/whatever/index.icon.png
  40. will be treated as an icon for the appropriate entry file.
  41. =head2 MARKUP
  42. Entries may consist of hand-written HTML (to be passed along without further
  43. interpretation), a supported form of lightweight markup, or some combination
  44. thereof. Actually, an entry may consist of any darn thing you please, as long
  45. as Perl will agree that it is text, but presumably you're going to be feeding
  46. this to a browser.
  47. Special markup is indicated by a variety of HTML-like container tags.
  48. B<Embedded Perl> - evaluated and replaced by whatever value you return
  49. (evaluated in a scalar context):
  50. <perl>my $dog = "Ralph."; return $dog;</perl>
  51. This code is evaluated before any other processing is done, so you can return
  52. any other markup understood by the script and have it handled appropriately.
  53. B<Interpolated variables> - actually keys to the hash underlying the Display
  54. object, for the moment:
  55. <perl>$self->title("About Ralph, My Dog"); return '';</perl>
  56. <p>The title is <em>${title}</em>.</p>
  57. This will change.
  58. Embedded code and variables are intended for use in F<header> and F<footer>
  59. files, where it's handy to drop in titles or conditionalize aspects of a
  60. layout. You want to be careful with this sort of thing - it's useful in small
  61. doses, but it's also a maintainability nightmare waiting to happen.
  62. (WordPress, I am looking at you.)
  63. B<Several forms of lightweight markup>:
  64. <wala>Wala::Markup, via Wala.pm - very basic wiki syntax</wala>
  65. <textile>Dean Allen's Textile, via Brad Choate's
  66. Text::Textile.</textile>
  67. <freeverse>An easy way to
  68. get properly broken lines
  69. plus -- en and em dashes ---
  70. for poetry and such.</freeverse>
  71. B<And a couple of shortcuts>:
  72. <image>filename.ext
  73. alt text, if any</image>
  74. <list>
  75. one list item
  76. another list item
  77. </list>
  78. As it stands, freeverse, image, and list are not particularly robust.
  79. =cut