diff options
author | Russ Allbery <rra@cpan.org> | 2021-09-11 15:49:41 -0700 |
---|---|---|
committer | Russ Allbery <rra@cpan.org> | 2021-09-11 15:49:41 -0700 |
commit | 3374d05df9cb4507229cfde5874769641b83ae61 (patch) | |
tree | 2fe86f0a91a146998f379861b9e3589ae1bbd6b3 | |
parent | 44cd7111a17e299cac29ced20f036240e6a47983 (diff) |
Drop support for \id
I've gotten rid of the last places I used this and the new
Pod::Thread will no longer generate it, so drop all the support
for the command. App::DocKnot::Spin still has some code to look
at $Id$ strings when processing output from other converters,
which I'll look at later.
-rw-r--r-- | Changes | 6 | ||||
-rw-r--r-- | lib/App/DocKnot/Spin.pm | 4 | ||||
-rw-r--r-- | lib/App/DocKnot/Spin/Thread.pm | 35 |
3 files changed, 12 insertions, 33 deletions
@@ -6,8 +6,10 @@ idiosyncratic, static site generator built around a macro language called thread. This adds new commands docknot spin, docknot spin-rss, and docknot spin-thread, as well as modules App::DocKnot::Spin and - several submodules. DocKnot now depends on Date::Parse (from - TimeDate), Git::Repository, Image::Size, and Pod::Thread. + several submodules. docknot spin should be equivalent to the old spin + command except that \id support has been dropped. DocKnot now depends + on Date::Parse (from TimeDate), Git::Repository, Image::Size, and + Pod::Thread 3.00 or later. - Support setting distribution.packaging.debian.package along with distribution.packaging.debian.personal to specify the package name. Do diff --git a/lib/App/DocKnot/Spin.pm b/lib/App/DocKnot/Spin.pm index 4eb377e..7fd1e82 100644 --- a/lib/App/DocKnot/Spin.pm +++ b/lib/App/DocKnot/Spin.pm @@ -324,10 +324,10 @@ sub _pod2html { my $file = $source; $file =~ s{ [.] [^.]+ \z }{.html}xms; my $footer = sub { - my ($blurb, $id) = @_; + my ($blurb) = @_; my $link = '<a href="%URL%">spun</a>'; $self->_footer( - $source, $output, $id, + $source, $output, undef, "Last modified and\n $link %MOD%", "Last $link\n %NOW% from POD modified %MOD%", ); diff --git a/lib/App/DocKnot/Spin/Thread.pm b/lib/App/DocKnot/Spin/Thread.pm index d75ca66..5c044b9 100644 --- a/lib/App/DocKnot/Spin/Thread.pm +++ b/lib/App/DocKnot/Spin/Thread.pm @@ -54,7 +54,6 @@ my %COMMANDS = ( h5 => [1, '_cmd_h5', 1], h6 => [1, '_cmd_h6', 1], heading => [2, '_cmd_heading', 0], - id => [1, '_cmd_id', 0], image => [2, '_cmd_image', 1], include => [1, '_cmd_include', 0], italic => [1, '_cmd_italic', 1], @@ -661,7 +660,6 @@ sub _parse_document { # Initialize object state for a new document. $self->{input} = [[\@input, $in_path, 1]]; - $self->{id} = undef; $self->{macro} = {}; $self->{out_fh} = $out_fh; $self->{out_path} = $out_path // q{-}; @@ -876,7 +874,6 @@ sub _enclose { # # $source - Full path to the source file # $out_path - Full path to the output file -# $id - CVS Id of the source file or undef if not known # @templates - Two templates to use. The first will be used if the # modification and current dates are the same, and the second # if they are different. %MOD% and %NOW% will be replaced with @@ -885,7 +882,7 @@ sub _enclose { # # Returns: HTML output sub _footer { - my ($self, $source, $out_path, $id, @templates) = @_; + my ($self, $source, $out_path, @templates) = @_; my $output = q{}; my $in_tree = 0; if ($self->{source} && $source =~ m{ \A \Q$self->{source}\E }xms) { @@ -899,25 +896,16 @@ sub _footer { $output .= join(q{}, $self->{sitemap}->navbar($page)); } - # Figure out the modification dates. Use the RCS/CVS Id if available, - # otherwise use the Git repository if available. - my $modified; - if (defined($id)) { - my (undef, undef, $date) = split(q{ }, $id); - if ($date && $date =~ m{ \A (\d+) [-/] (\d+) [-/] (\d+) }xms) { - $modified = sprintf('%d-%02d-%02d', $1, $2, $3); - } - } elsif ($self->{repository} && $in_tree) { + # Figure out the modification dates. Use the Git repository if available. + my $now = strftime('%Y-%m-%d', gmtime()); + my $modified = strftime('%Y-%m-%d', gmtime((stat $source)[9])); + if ($self->{repository} && $in_tree) { $modified = $self->{repository}->run('log', '-1', '--format=%ct', $source); if ($modified) { $modified = strftime('%Y-%m-%d', gmtime($modified)); } } - if (!$modified) { - $modified = strftime('%Y-%m-%d', gmtime((stat $source)[9])); - } - my $now = strftime('%Y-%m-%d', gmtime()); # Determine which template to use and substitute in the appropriate times. $output .= "<address>\n" . q{ } x 4; @@ -1140,9 +1128,6 @@ sub _cmd_heading { : ' from ' . fileparse($self->{input}[-1][1]); my $version = $App::DocKnot::VERSION; $output .= "<!-- Spun$from by DocKnot $version on $date -->\n"; - if ($self->{id}) { - $output .= "<!-- $self->{id} -->\n"; - } # Add the <body> tag and the navbar (if we have a sitemap). $output .= "\n<body>\n"; @@ -1156,14 +1141,6 @@ sub _cmd_heading { return (1, $output); } -# Used to save the RCS Id for the document. Doesn't actually output anything -# (the identifier is later used in _cmd_heading). -sub _cmd_id { - my ($self, $id) = @_; - $self->{id} = $id; - return (1, q{}); -} - # Include an image. The size is added to the HTML tag automatically. # # $format - Format string @@ -1333,7 +1310,7 @@ sub _cmd_signature { # Otherwise, _footer does most of the work and we just add the tags. my $link = '<a href="%URL%">spun</a>'; $output .= $self->_footer( - $self->{input}[-1][1], $self->{out_path}, $self->{id}, + $self->{input}[-1][1], $self->{out_path}, "Last modified and\n $link %MOD%", "Last $link\n %NOW% from thread modified %MOD%", ); |