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.

218 lines
7.2 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.0.0 2020-04-04
  3. - Add a full tagging system
  4. - Cache HTML for every entry in the archive for a speedup in rendering large sites
  5. - Extract headers from rendered HTML with Mojo::DOM and cache
  6. - Use extracted headers to title pages, navigation links, and feed entries
  7. - Handle feed_alias in wrt-display
  8. - Remove entry_map from configuration and hardcode the default's assumptions
  9. about blog entry layout
  10. - Remove embedded_perl from configuration - now always look for embedded
  11. Perl, since this is required for templates. This feature may be
  12. deprecated in a future release.
  13. - Warn on HTML parsing errors (usually character encoding issues)
  14. - Rename default template from "basic" to "default"
  15. - Add JSON Feed support, improve Atom feed performance
  16. - Add wrt-repl for debugging
  17. - Add feed links to default template produced by wrt-init
  18. - Add wrt-feed for printing feeds
  19. v6.3.1 2019-06-23
  20. - Generalize iso_date() test for epoch to include all timezones
  21. v6.3.0 2019-06-22
  22. - Move get_date() from App::WRT::Util to App::WRT::Date
  23. - Make App::WRT::FileIO and ::Util less redundant
  24. - Add App::WRT::Mock::FileIO for faking writes in tests
  25. - Make bin/wrt-render-all testable, add t/bin-wrt-render-all.t
  26. v6.2.4 2019-05-28
  27. - Replace README.pod with a concise README.md
  28. v6.2.3 2019-05-16
  29. - bin/wrt-display: correctly expand new, fulltext, all
  30. v6.2.2 2019-05-16
  31. - EntryStore: stash sorted list of all entries as found
  32. v6.2.1 2019-05-16
  33. - bin/wrt-help
  34. - list more subcommands
  35. - fix display of utility name
  36. v6.2.0 2019-05-16
  37. - EntryStore: Add methods for further slicing entry list:
  38. - Days by month or year
  39. - Months by year
  40. - Immediate children and parents of entries
  41. - basename($entry)
  42. v6.1.0 2019-05-16
  43. - Add bin/wrt-help and bin/wrt-version
  44. - Includes -h, --help, -v, --version, -v aliases.
  45. v6.0.0 2019-05-06
  46. - App::WRT::Date
  47. - Move month_name() in here from App::WRT, add tests.
  48. - App::WRT::EntryStore:
  49. - Hash file types for entries (directory or flatfile)
  50. - Use keys of file type hash for complete list of entries.
  51. - has_prop($entry, $property)
  52. - is_dir($entry), is_file($entry), is_extant($entry)
  53. - parent_of($entry)
  54. - has_index($entry)
  55. - Make EntryStore cache whether a file is a flatfile or a directory, as
  56. well as its existence, in a single hash.
  57. - Include index flatfiles in @source_files for use by has_index()
  58. - Various tests.
  59. - App::WRT::FileIO
  60. - Still duplicates a bunch of shit from Util, so that needs sorted.
  61. - App::WRT::Renderer
  62. - Convert to a proper class.
  63. - Add experimental FileIO class to use in Renderer (imperfect,
  64. tricky, still thinking about this). The idea is to separate out the
  65. concerns of reading and writing the filesystem.
  66. - App::WRT
  67. - Refactor display() and improve tests
  68. - Use "@entries" instead of "@options" for clarity
  69. - Handle entry names that might evaluate as false
  70. - Test running display() without any params
  71. - Rename expand_option() -> expand_alias(), refactor
  72. - Use EntryStore::has_prop() to detect wrt-noexpand.prop
  73. - year(), month(), entry() partially rewritten to use EntryStore
  74. - year() should handle months which are a flatfile
  75. - Refactor icon_markup() to use is_file() / is_dir() / is_extant(),
  76. add tests.
  77. - Add subtitle to feeds
  78. - bin/wrt-ls is now a "modulino" with tests
  79. - bin/display errors on non-existent entries
  80. v5.0.0 2019-04-14
  81. - Add bin/wrt-ls for listing entries in current archive
  82. - Add bin/wrt-config for displaying configuration info
  83. - Allow header tags with attributes
  84. - Minor documentation cleanup
  85. - Bump XML::Atom::SimpleFeed to 0.900; remove wrt-fcgi
  86. - Concatenation instead of variable interpolation in HTML::tag()
  87. - Remove hardcoded "public" from renderer directory path copying
  88. - Remove unused feed_url param from wrt-init and example dir
  89. - Remove an extraneous JSON->convert_blessed(1) call
  90. - WRT::entry(): fix glitch with contents list for binfile_expr matches
  91. - Correctly encode feed output - see https://p1k3.com/2018/5/28/
  92. - Add App::WRT::Util::file_get_contents();
  93. - Optionally cache included files in-memory
  94. - Add EntryStore, a class for wrapping various methods for finding entry lists
  95. - Refactor display()
  96. - Use Carp for errors
  97. - Remove old LaTeX markup stuff
  98. - Add this Changes file
  99. v5.0.0-alpha 2018-04-19
  100. - Use 5 most recent entries for home page instead of latest month
  101. - Remove accessor methods for instance variables / configuration
  102. - Give absolute paths to imgsize() so it chills out on Cwd::getcwd() calls
  103. - Remove local_path(), recent_month(), month_before, and feed_print_latest()
  104. - Stop using a() in entry_markup()
  105. - Cache get_date_entries_by_depth() results
  106. - Swap out state vars for stashing things on $self in get_all_source_files()
  107. - Add get_date_entries_by_depth()
  108. - Tweak link_bar() behavior to retain link for current page
  109. v4.3.0 2018-04-06
  110. - Render feed for last feed_length day entries instead of for latest month
  111. - Switch example config from p1k3.com to example.com urls
  112. - feed_print() now takes a list of entries instead of a month
  113. v4.2.2 2018-02-10
  114. - Fix --config option to wrt-display & wrt-render-all
  115. - Remove year list from linkbar
  116. v4.2.1 2017-11-18
  117. - Change url_root default to /
  118. - Add url_root to topic link generator
  119. v4.2.0 2017-11-18
  120. - Improved documentation in shell utilities
  121. - Make a copy of %default before blessing
  122. - Document MethodSpit
  123. - Document the overlay option, add an accessor method for it
  124. - Use a logging callback to WRT::Renderer::render()
  125. - Miscellaneous test cleanup
  126. - Add publish_dir to example wrt.json
  127. - Improve documentation
  128. - Add $wrt->feed_alias and a .xml copy of same
  129. v4.1.0 2017-11-15
  130. - Add wrt-init for creating a skeleton project directory
  131. - Die on missing template file
  132. v4.0.1 2017-11-14
  133. - Fix App::WRT::Markup require of WRT::Image
  134. - Remove an unused dependency on Imager
  135. v4.0.0 2017-11-14
  136. - Rename WRT to App::WRT
  137. - Add a license info
  138. - Strip unused image size code from WRT::Image
  139. - Add publish_dir config value, ensure that dir exists when rendering
  140. - Add rendering tests
  141. v3.5.0 2017-11-13
  142. - wrt-render-all now handles /, /all, and /feed
  143. - Migrate wrt wrapper utilities to posix shell
  144. v3.4.2 2017-06-21
  145. - Add [0-9] to acceptable sub-entry characters
  146. v3.3.1 2017-06-19
  147. - Die on attempting to include a directory
  148. - Include datestamps in feed
  149. v3.3.0 2017-04-03
  150. - Add topic list to entries
  151. - List topics in datestamp
  152. - Clean up addprop output
  153. - Allow `-` in entry names, use .prop for properties
  154. - Simplify datestamps
  155. - Add wrt-noexpand property
  156. - Remove a sorta-extraneous trailing slash on contents
  157. v3.0.0 2016-10-12
  158. - Split wrt utility into git-style subcommands
  159. - Support for includes, change root_dir semantics, add entry_dir
  160. - addprop and findprop subcommands for dealing with entry properties
  161. v2.0.0 2016-08-09
  162. - Now called "wrt" instead of "display"
  163. - Extract http_header stuff from WRT module
  164. - Switch to wrt.json for configuration
  165. - Add XML::Feed and CGI::Fast to dependencies
  166. - Make wrt.fcgi work, more or less
  167. - Escape braces in variable interpolation regexp
  168. - Add --stdin flag