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.

224 lines
7.4 KiB

cache rendered html; extract titles; all as utf-8 This stashes the HTML version of every entry in memory and uses Mojo::DOM to extract headers from the markup for use as titles. Titles are displayed in $self->{page_navigation}, now available inside templates as ${page_navigation}. In order to keep Mojo::DOM from choking on other input, it uses the open pragma to open everything as UTF-8 by default, which also eliminates a whole class of character encoding bugs and removes some fiddling with Encode::decode() from feed_print(). This is all obviously a more memory-intensive, but caching the markup turns out to have the side effect of making it much faster to render even a large site, probably as much as anything because the HTML in question is only getting generated once per entry instead of (potentially) 2-3 times. This commit isn't very atomic. In the process of roughing it out and testing it, I made a small pile of minor but potentially breaking changes: - Removed entry_map from settings and hardcoded handling of various types of entry as some if-statements instead. - Removed embedded_perl flag in settings - was always turned on in practice, and wasn't very coherent since templating would have broken without it. - bin/wrt-display - now handles the "feed" alias correctly - EntryStore: now supports retrieving values for properties with prop_value() - this isn't currently used, but it seems like a reasonable extension of the property idea. - Added `wrt ls --with-titles`. - Added dependency versions to Build.PL. - Refactored Markup's line_parse() a little. - Refactored some tests to give cleaner / more useful output. - Renamed default template file to "default".
4 years ago
cache rendered html; extract titles; all as utf-8 This stashes the HTML version of every entry in memory and uses Mojo::DOM to extract headers from the markup for use as titles. Titles are displayed in $self->{page_navigation}, now available inside templates as ${page_navigation}. In order to keep Mojo::DOM from choking on other input, it uses the open pragma to open everything as UTF-8 by default, which also eliminates a whole class of character encoding bugs and removes some fiddling with Encode::decode() from feed_print(). This is all obviously a more memory-intensive, but caching the markup turns out to have the side effect of making it much faster to render even a large site, probably as much as anything because the HTML in question is only getting generated once per entry instead of (potentially) 2-3 times. This commit isn't very atomic. In the process of roughing it out and testing it, I made a small pile of minor but potentially breaking changes: - Removed entry_map from settings and hardcoded handling of various types of entry as some if-statements instead. - Removed embedded_perl flag in settings - was always turned on in practice, and wasn't very coherent since templating would have broken without it. - bin/wrt-display - now handles the "feed" alias correctly - EntryStore: now supports retrieving values for properties with prop_value() - this isn't currently used, but it seems like a reasonable extension of the property idea. - Added `wrt ls --with-titles`. - Added dependency versions to Build.PL. - Refactored Markup's line_parse() a little. - Refactored some tests to give cleaner / more useful output. - Renamed default template file to "default".
4 years ago
cache rendered html; extract titles; all as utf-8 This stashes the HTML version of every entry in memory and uses Mojo::DOM to extract headers from the markup for use as titles. Titles are displayed in $self->{page_navigation}, now available inside templates as ${page_navigation}. In order to keep Mojo::DOM from choking on other input, it uses the open pragma to open everything as UTF-8 by default, which also eliminates a whole class of character encoding bugs and removes some fiddling with Encode::decode() from feed_print(). This is all obviously a more memory-intensive, but caching the markup turns out to have the side effect of making it much faster to render even a large site, probably as much as anything because the HTML in question is only getting generated once per entry instead of (potentially) 2-3 times. This commit isn't very atomic. In the process of roughing it out and testing it, I made a small pile of minor but potentially breaking changes: - Removed entry_map from settings and hardcoded handling of various types of entry as some if-statements instead. - Removed embedded_perl flag in settings - was always turned on in practice, and wasn't very coherent since templating would have broken without it. - bin/wrt-display - now handles the "feed" alias correctly - EntryStore: now supports retrieving values for properties with prop_value() - this isn't currently used, but it seems like a reasonable extension of the property idea. - Added `wrt ls --with-titles`. - Added dependency versions to Build.PL. - Refactored Markup's line_parse() a little. - Refactored some tests to give cleaner / more useful output. - Renamed default template file to "default".
4 years ago
v6.0.0: expand EntryStore, test more, cache harder This commit is something of a hairball, the result of evenings-and-weekends hacking building up a set of changes that got out of hand in parallel. If I had the energy to spare, I would break it apart into semantically-related changes, but I don't - and I suppose all this crap being rolled together is at least reflective of how the code was written. These changes are really half-finished, at best. Eventual goals: - App::WRT shouldn't directly touch the filesystem - App::WRT::EntryStore should model the entry archive completely - App::WRT::Renderer should say what to write to the publication directory - This one's a maybe: Filesystem interaction should pass through App::WRT::FileIO or something like it so that EntryStore and Renderer can be more usefully tested, with mocked writes (maybe) I do think this represents an inflection point in the long, silly life of this program: It includes a handful of new tests, and a number of the code changes were in turn easy to make because the test suite begins to model the code in a useful way. It's less and less necessary to run wrt against the p1k3.com archives to be sure that I haven't trashed something. Breaking changes to note: - Will no longer render HTML for nonexistent entries - Months and years which are flatfiles or contain an index are handled differently, albeit less brokenly - EntryStore includes index files in its overall list of entries (this seems to break less than I thought), which trickles out to bin/wrt-ls Overall changes herein: - App::WRT::Date - Move month_name() in here from App::WRT, add tests. - App::WRT::EntryStore - Hash file types for entries (directory or flatfile) - Use keys of file type hash for complete list of entries. - has_prop($entry, $property) - is_dir($entry), is_file($entry), is_extant($entry) - parent_of($entry) - has_index($entry) - Make EntryStore cache whether a file is a flatfile or a directory, as well as its existence, in a single hash. - Include index flatfiles in @source_files for use by has_index() - Various tests. - App::WRT::FileIO - Still duplicates a bunch of shit from Util, so that needs sorted. - App::WRT::Renderer - Convert to a proper class. - Add experimental FileIO class to use in Renderer (imperfect, tricky, still thinking about this). The idea is to separate out the concerns of reading and writing the filesystem. - App::WRT - Refactor display() and improve tests - Use "@entries" instead of "@options" for clarity - Handle entry names that might evaluate as false - Test running display() without any params - Rename expand_option() -> expand_alias(), refactor - Use EntryStore::has_prop() to detect wrt-noexpand.prop - year(), month(), entry() partially rewritten to use EntryStore - year() should handle months which are a flatfile - Refactor icon_markup() to use is_file() / is_dir() / is_extant(), add tests. - Add subtitle to feeds - bin/wrt-ls is now a "modulino" with tests - bin/display errors on non-existent entries - Build.PL - Remove bogus XML::Feed dependency
5 years ago
  1. Revision history for App::WRT
  2. v7.1.0 2020-04-18
  3. - Add some handling for sites with an index file in the root
  4. - wrt-render-all now uses the configured default for root of site instead
  5. of "new"
  6. v7.0.0 2020-04-04
  7. - Add a full tagging system
  8. - Cache HTML for every entry in the archive for a speedup in rendering large sites
  9. - Extract headers from rendered HTML with Mojo::DOM and cache
  10. - Use extracted headers to title pages, navigation links, and feed entries
  11. - Handle feed_alias in wrt-display
  12. - Remove entry_map from configuration and hardcode the default's assumptions
  13. about blog entry layout
  14. - Remove embedded_perl from configuration - now always look for embedded
  15. Perl, since this is required for templates. This feature may be
  16. deprecated in a future release.
  17. - Warn on HTML parsing errors (usually character encoding issues)
  18. - Rename default template from "basic" to "default"
  19. - Add JSON Feed support, improve Atom feed performance
  20. - Add wrt-repl for debugging
  21. - Add feed links to default template produced by wrt-init
  22. - Add wrt-feed for printing feeds
  23. v6.3.1 2019-06-23
  24. - Generalize iso_date() test for epoch to include all timezones
  25. v6.3.0 2019-06-22
  26. - Move get_date() from App::WRT::Util to App::WRT::Date
  27. - Make App::WRT::FileIO and ::Util less redundant
  28. - Add App::WRT::Mock::FileIO for faking writes in tests
  29. - Make bin/wrt-render-all testable, add t/bin-wrt-render-all.t
  30. v6.2.4 2019-05-28
  31. - Replace README.pod with a concise README.md
  32. v6.2.3 2019-05-16
  33. - bin/wrt-display: correctly expand new, fulltext, all
  34. v6.2.2 2019-05-16
  35. - EntryStore: stash sorted list of all entries as found
  36. v6.2.1 2019-05-16
  37. - bin/wrt-help
  38. - list more subcommands
  39. - fix display of utility name
  40. v6.2.0 2019-05-16
  41. - EntryStore: Add methods for further slicing entry list:
  42. - Days by month or year
  43. - Months by year
  44. - Immediate children and parents of entries
  45. - basename($entry)
  46. v6.1.0 2019-05-16
  47. - Add bin/wrt-help and bin/wrt-version
  48. - Includes -h, --help, -v, --version, -v aliases.
  49. v6.0.0 2019-05-06
  50. - App::WRT::Date
  51. - Move month_name() in here from App::WRT, add tests.
  52. - App::WRT::EntryStore:
  53. - Hash file types for entries (directory or flatfile)
  54. - Use keys of file type hash for complete list of entries.
  55. - has_prop($entry, $property)
  56. - is_dir($entry), is_file($entry), is_extant($entry)
  57. - parent_of($entry)
  58. - has_index($entry)
  59. - Make EntryStore cache whether a file is a flatfile or a directory, as
  60. well as its existence, in a single hash.
  61. - Include index flatfiles in @source_files for use by has_index()
  62. - Various tests.
  63. - App::WRT::FileIO
  64. - Still duplicates a bunch of shit from Util, so that needs sorted.
  65. - App::WRT::Renderer
  66. - Convert to a proper class.
  67. - Add experimental FileIO class to use in Renderer (imperfect,
  68. tricky, still thinking about this). The idea is to separate out the
  69. concerns of reading and writing the filesystem.
  70. - App::WRT
  71. - Refactor display() and improve tests
  72. - Use "@entries" instead of "@options" for clarity
  73. - Handle entry names that might evaluate as false
  74. - Test running display() without any params
  75. - Rename expand_option() -> expand_alias(), refactor
  76. - Use EntryStore::has_prop() to detect wrt-noexpand.prop
  77. - year(), month(), entry() partially rewritten to use EntryStore
  78. - year() should handle months which are a flatfile
  79. - Refactor icon_markup() to use is_file() / is_dir() / is_extant(),
  80. add tests.
  81. - Add subtitle to feeds
  82. - bin/wrt-ls is now a "modulino" with tests
  83. - bin/display errors on non-existent entries
  84. v5.0.0 2019-04-14
  85. - Add bin/wrt-ls for listing entries in current archive
  86. - Add bin/wrt-config for displaying configuration info
  87. - Allow header tags with attributes
  88. - Minor documentation cleanup
  89. - Bump XML::Atom::SimpleFeed to 0.900; remove wrt-fcgi
  90. - Concatenation instead of variable interpolation in HTML::tag()
  91. - Remove hardcoded "public" from renderer directory path copying
  92. - Remove unused feed_url param from wrt-init and example dir
  93. - Remove an extraneous JSON->convert_blessed(1) call
  94. - WRT::entry(): fix glitch with contents list for binfile_expr matches
  95. - Correctly encode feed output - see https://p1k3.com/2018/5/28/
  96. - Add App::WRT::Util::file_get_contents();
  97. - Optionally cache included files in-memory
  98. - Add EntryStore, a class for wrapping various methods for finding entry lists
  99. - Refactor display()
  100. - Use Carp for errors
  101. - Remove old LaTeX markup stuff
  102. - Add this Changes file
  103. v5.0.0-alpha 2018-04-19
  104. - Use 5 most recent entries for home page instead of latest month
  105. - Remove accessor methods for instance variables / configuration
  106. - Give absolute paths to imgsize() so it chills out on Cwd::getcwd() calls
  107. - Remove local_path(), recent_month(), month_before, and feed_print_latest()
  108. - Stop using a() in entry_markup()
  109. - Cache get_date_entries_by_depth() results
  110. - Swap out state vars for stashing things on $self in get_all_source_files()
  111. - Add get_date_entries_by_depth()
  112. - Tweak link_bar() behavior to retain link for current page
  113. v4.3.0 2018-04-06
  114. - Render feed for last feed_length day entries instead of for latest month
  115. - Switch example config from p1k3.com to example.com urls
  116. - feed_print() now takes a list of entries instead of a month
  117. v4.2.2 2018-02-10
  118. - Fix --config option to wrt-display & wrt-render-all
  119. - Remove year list from linkbar
  120. v4.2.1 2017-11-18
  121. - Change url_root default to /
  122. - Add url_root to topic link generator
  123. v4.2.0 2017-11-18
  124. - Improved documentation in shell utilities
  125. - Make a copy of %default before blessing
  126. - Document MethodSpit
  127. - Document the overlay option, add an accessor method for it
  128. - Use a logging callback to WRT::Renderer::render()
  129. - Miscellaneous test cleanup
  130. - Add publish_dir to example wrt.json
  131. - Improve documentation
  132. - Add $wrt->feed_alias and a .xml copy of same
  133. v4.1.0 2017-11-15
  134. - Add wrt-init for creating a skeleton project directory
  135. - Die on missing template file
  136. v4.0.1 2017-11-14
  137. - Fix App::WRT::Markup require of WRT::Image
  138. - Remove an unused dependency on Imager
  139. v4.0.0 2017-11-14
  140. - Rename WRT to App::WRT
  141. - Add a license info
  142. - Strip unused image size code from WRT::Image
  143. - Add publish_dir config value, ensure that dir exists when rendering
  144. - Add rendering tests
  145. v3.5.0 2017-11-13
  146. - wrt-render-all now handles /, /all, and /feed
  147. - Migrate wrt wrapper utilities to posix shell
  148. v3.4.2 2017-06-21
  149. - Add [0-9] to acceptable sub-entry characters
  150. v3.3.1 2017-06-19
  151. - Die on attempting to include a directory
  152. - Include datestamps in feed
  153. v3.3.0 2017-04-03
  154. - Add topic list to entries
  155. - List topics in datestamp
  156. - Clean up addprop output
  157. - Allow `-` in entry names, use .prop for properties
  158. - Simplify datestamps
  159. - Add wrt-noexpand property
  160. - Remove a sorta-extraneous trailing slash on contents
  161. v3.0.0 2016-10-12
  162. - Split wrt utility into git-style subcommands
  163. - Support for includes, change root_dir semantics, add entry_dir
  164. - addprop and findprop subcommands for dealing with entry properties
  165. v2.0.0 2016-08-09
  166. - Now called "wrt" instead of "display"
  167. - Extract http_header stuff from WRT module
  168. - Switch to wrt.json for configuration
  169. - Add XML::Feed and CGI::Fast to dependencies
  170. - Make wrt.fcgi work, more or less
  171. - Escape braces in variable interpolation regexp
  172. - Add --stdin flag