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.

170 lines
3.9 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
17 years ago
17 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
17 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
17 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
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
8 years ago
8 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
6 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
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
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
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
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
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
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
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
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
6 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
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
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
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
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
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
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
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
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
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
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
  1. #!/usr/bin/env perl
  2. use strict;
  3. use warnings;
  4. use utf8;
  5. use open qw(:std :utf8);
  6. use lib 'lib';
  7. use Encode;
  8. use JSON;
  9. use Test::More tests => 19;
  10. # Does the module load?
  11. require_ok('App::WRT');
  12. chdir 'example/blog';
  13. # configuration
  14. ok(
  15. my $w = App::WRT::new_from_file('wrt.json'),
  16. "got WRT object."
  17. );
  18. # individual subroutine tests
  19. my $datestamp = $w->datestamp('2014/1/1/test_entry');
  20. like(
  21. $datestamp,
  22. qr{test_entry},
  23. 'datestamp for a fragment references that fragment'
  24. ) or diag($datestamp);
  25. # icon rendering
  26. my $with_icon = $w->display('icon_test');
  27. like(
  28. $with_icon,
  29. qr/img src/,
  30. 'icon_test has an image in it'
  31. ) or diag($with_icon);
  32. my $icon_textfile = $w->icon_markup('icon_test/textfile', 'alt');
  33. is(
  34. $icon_textfile,
  35. q{<img src="https://example.com/icon_test/textfile.icon.png"
  36. width="48" height="58"
  37. alt="alt" />},
  38. 'got expected icon for icon_test/textfile'
  39. ) or diag($icon_textfile);
  40. my $icon_dir = $w->icon_markup('icon_test/dir', 'alt');
  41. is(
  42. $icon_dir,
  43. q{<img src="https://example.com/icon_test/dir/index.icon.png"
  44. width="48" height="58"
  45. alt="alt" />},
  46. 'got expected icon for icon_test/dir'
  47. ) or diag($icon_dir);
  48. my $icon_subentry = $w->icon_markup('icon_test/dir/subentry', 'alt');
  49. is(
  50. $icon_subentry,
  51. q{<img src="https://example.com/icon_test/dir/subentry.icon.png"
  52. width="48" height="58"
  53. alt="alt" />},
  54. 'got expected icon for icon_test/dir/subentry'
  55. ) or diag($icon_subentry);
  56. # feed rendering
  57. my $with_stars = $w->display('2014/1/2');
  58. like(
  59. $with_stars,
  60. qr/✨/s,
  61. '2014/1/2 contains some stars which we also expect to show up in the feed'
  62. );
  63. my $feed = $w->feed_print_recent();
  64. like(
  65. $feed,
  66. qr/✨/s,
  67. 'feed contains some stars'
  68. ) or diag($feed);
  69. my $json_feed = $w->feed_print_json();
  70. my $JSON = JSON->new->utf8->pretty;
  71. my $feed_hashref = $JSON->decode(encode('UTF-8', $json_feed));
  72. ok(
  73. length $json_feed,
  74. 'got some sort of a JSON Feed'
  75. ) or diag($json_feed);
  76. ok(
  77. defined $feed_hashref->{title},
  78. 'got a JSON Feed with a title'
  79. ) or diag($feed_hashref);
  80. # not expanding entries with wrt-noexpand
  81. my $with_noexpand = $w->display('noexpand_test');
  82. # diag($with_noexpand);
  83. unlike(
  84. $with_noexpand,
  85. qr/SHOULD NOT DISPLAY/,
  86. 'noexpand_test does not contain text of sub-entry do_not_expand_me'
  87. ) or diag($with_noexpand);
  88. # displaying default entry when no entries are given
  89. my $with_no_entries = $w->display();
  90. like(
  91. $with_no_entries,
  92. qr{\Q<title>wrt::new</title>\E},
  93. 'display the default entry (new) when no entries are given'
  94. ) or diag($with_no_entries);
  95. # contents of year index files
  96. my $plaintext_year = $w->display('2012');
  97. like(
  98. $plaintext_year,
  99. qr/\QI'm a year which is just a flatfile.\E/,
  100. "2012 as plaintext year comes through."
  101. ) or diag($plaintext_year);
  102. my $plaintext_year_index = $w->display('2013');
  103. like(
  104. $plaintext_year_index,
  105. qr/\QI'm an index file for an entire year.\E/,
  106. "2013's plaintext year index comes through."
  107. ) or diag($plaintext_year_index);
  108. # titles
  109. my $title = $w->get_title('2014/1/2');
  110. is(
  111. $title,
  112. 'Thursday, January 2, 2014',
  113. 'got expected title for 2014/1/2'
  114. ) or diag($title);
  115. # next / prev page navigation
  116. my ($page_navigation) = $w->page_navigation('2014/1/2');
  117. like(
  118. $page_navigation,
  119. qr{2014/1/1},
  120. "got previous title in page navigation for 2014/1/2"
  121. ) or diag($page_navigation);
  122. $page_navigation = $w->page_navigation('2014/1/1');
  123. like(
  124. $page_navigation,
  125. qr{2014/1/2},
  126. "got next title in page navigation for 2014/1/2"
  127. ) or diag($page_navigation);
  128. my ($tag_list) = $w->entry_tag_list('tags_test');
  129. like(
  130. $tag_list,
  131. qr{<a href="https://example.com/animals/platypus">animals/platypus</a>},
  132. 'got link to an expected tag index for tags_test'
  133. );