Skip to content

Commit

Permalink
Item14471: fixed rendering of date tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed Sep 1, 2017
1 parent 5512050 commit 42a6f62
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
15 changes: 8 additions & 7 deletions HistoryPlugin/data/System/HistoryPlugin.txt
@@ -1,8 +1,8 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1441729129" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1504267827" format="1.1" version="1"}%
%META:TOPICPARENT{name="Plugins"}%
---+ History Plugin

%$SHORTDESCRIPTION%.
%FORMFIELD{"Description"}%.

The output can arbitrarily be formatted. An example for a Wikipedia-like history is included.

Expand Down Expand Up @@ -63,10 +63,11 @@ __Note:__ You do not need to install anything on the browser to use this plugin.

---++ Plugin Info
<!--
* Set SHORTDESCRIPTION = Shows a complete history of a document
* Set SHORTDESCRIPTION = %$SHORTDESCRIPTION%
-->

| Change History: | <!-- versions below in reverse order -->&nbsp; |
| 01 Sep 2017: | 1.14 fixed formatting of date tokens |
| 08 Sep 2015: | 1.13 Remove RevCommentPlugin hooks from the templates. |
| 15 Mar 2015: | 1.12 Version released with Foswiki 2.0 Foswikitask:Item12881: Add HISTORYPLUGIN_NREV setting. |
| 28 Nov 2012: | 1.11 Version released with Foswiki 1.1.6. Change to perl version strings |
Expand Down Expand Up @@ -94,12 +95,12 @@ __Note:__ You do not need to install anything on the browser to use this plugin.
__Related Topics:__ %SYSTEMWEB%.%WIKIPREFSTOPIC%, %LOCALSITEPREFS%, [[%SYSTEMWEB%.Plugins][Plugins]]

%META:FORM{name="PackageForm"}%
%META:FIELD{name="Copyright" title="Copyright" value=" 2006, !JChristophFuchs; 2008-2015 Kenneth Lavrsen and Foswiki Contributors"}%
%META:FIELD{name="Home" title="Home" value="http://foswiki.org/Extensions/HistoryPlugin"}%
%META:FIELD{name="Copyright" title="Copyright" value=" 2006, !JChristophFuchs; 2008-2017 Kenneth Lavrsen and Foswiki Contributors"}%
%META:FIELD{name="Home" title="Home" value="https://foswiki.org/Extensions/HistoryPlugin"}%
%META:FIELD{name="Release" title="Release" value="%25$RELEASE%25"}%
%META:FIELD{name="License" title="License" value="GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]])"}%
%META:FIELD{name="Version" title="Version" value="%25$VERSION%25"}%
%META:FIELD{name="Author" title="Author" value="Foswiki:Main.KennethLavrsen"}%
%META:FIELD{name="Support" title="Support" value="http://foswiki.org/Support/HistoryPlugin"}%
%META:FIELD{name="Support" title="Support" value="https://foswiki.org/Support/HistoryPlugin"}%
%META:FIELD{name="Repository" title="Repository" value="https://github.com/foswiki/distro"}%
%META:FILEATTACHMENT{name="screenshot.png" attr="h" comment="" date="1441729129" size="72043" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="screenshot.png" attr="h" comment="" date="1504267827" size="72043" user="ProjectContributor" version="1"}%
13 changes: 7 additions & 6 deletions HistoryPlugin/lib/Foswiki/Plugins/HistoryPlugin.pm
Expand Up @@ -10,8 +10,8 @@ use Foswiki::AccessControlException ();

# =========================
# Simple decimal version, no leading "v"
our $VERSION = "1.13";
our $RELEASE = '1.13';
our $VERSION = "1.14";
our $RELEASE = '01 Sep 2017';
our $NO_PREFS_IN_TOPIC = 1;
our $SHORTDESCRIPTION = 'Shows a complete history of a topic';

Expand Down Expand Up @@ -156,7 +156,7 @@ sub _handleHistory {
$revinfo =~ s/\$rev/$rev/g;
$revinfo =~ s/\$date/Foswiki::Func::formatTime($date)/ge;
$revinfo =~
s/\$(year|ye|week|web|wday|tz|topic|time|seconds|rev|rcs|month|mo|minutes|longdate|isotz|iso|http|hours|epoch|email|dow|day)/_formatTime("\$$1", $topic, $web)/ge;
s/\$(year|ye|week|web|wday|tz|topic|time|seconds|rev|rcs|month|mo|minutes|longdate|isotz|iso|http|hours|epoch|email|dow|day)/_formatTime("\$$1", $web, $topic, $rev)/ge;
$revinfo =~ s/\$username/$user/g;
$revinfo =~ s/\$wikiname/$wikiName/g;
$revinfo =~ s/\$wikiusername/$wikiUserName/g;
Expand All @@ -177,9 +177,10 @@ s/\$(year|ye|week|web|wday|tz|topic|time|seconds|rev|rcs|month|mo|minutes|longda
}

sub _formatTime {
my ( $format, $topic, $web ) = @_;
my ( $format, $web, $topic, $rev ) = @_;

return Foswiki::Func::expandCommonVariables( '%REVINFO{"' . $format . '"}%',
return Foswiki::Func::expandCommonVariables(
'%REVINFO{"' . $format . '" rev="' . $rev . '"}%',
$topic, $web );
}

Expand Down Expand Up @@ -248,7 +249,7 @@ sub _handleHeadFoot {
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2008-2015 Foswiki Contributors. Foswiki Contributors
Copyright (C) 2008-2017 Foswiki Contributors. Foswiki Contributors
are listed in the AUTHORS file in the root of this distribution.
NOTE: Please extend that file, not this notice.
Expand Down

0 comments on commit 42a6f62

Please sign in to comment.