Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always last modified #143

Merged
merged 4 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-quick.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

steps:
- name: 'Check out repository'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

steps:
- name: 'Check out repository'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive

Expand Down
3 changes: 3 additions & 0 deletions lib/Qgoda.pm
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,9 @@ sub scan {
$logger->debug(__x("scanning source directory '{srcdir}'",
srcdir => $config->{srcdir}));
File::Find::find({
# FIXME! This must be configurable. It should also be configurable
# whether follow_fast or follow_skip should be used.
follow => 1,
wanted => sub {
if (-f $_) {
my $path = absolute_path($_);
Expand Down
49 changes: 42 additions & 7 deletions lib/Qgoda/Analyzer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,27 @@ sub __fillMeta {
my ($self, $asset) = @_;

my $qgoda = Qgoda->new;
my $logger = $qgoda->logger;
my $config = $qgoda->config;
my $site = $qgoda->getSite;

$self->__fillDate($asset);
$self->__fillLastModified($asset);
$self->__fillPathInformation($asset, $site);

$asset->{title} = $asset->{basename} if !exists $asset->{title};
$asset->{slug} = $self->__slug($asset);

$asset->{view} = $site->getMetaValue(view => $asset);
$asset->{type} = $site->getMetaValue(type => $asset);

return $self;
}

sub __fillDate {
my ($self, $asset) = @_;

my $qgoda = Qgoda->new;
my $logger = $qgoda->logger;

my $date = $asset->{date};
if (defined $date) {
if ($date !~ /^-?[1-9][0-9]*$/) {
Expand All @@ -134,13 +151,31 @@ sub __fillMeta {

$asset->{date} = Qgoda::Util::Date->newFromEpoch($date);

$self->__fillPathInformation($asset, $site);
return $self;
}

$asset->{title} = $asset->{basename} if !exists $asset->{title};
$asset->{slug} = $self->__slug($asset);
sub __fillLastModified {
my ($self, $asset) = @_;

$asset->{view} = $site->getMetaValue(view => $asset);
$asset->{type} = $site->getMetaValue(type => $asset);
my $qgoda = Qgoda->new;
my $logger = $qgoda->logger;

my $date = $asset->{last_modified};
if (defined $date) {
if ($date !~ /^-?[1-9][0-9]*$/) {
$date = str2time $date;
if (!defined $date) {
$logger->error(__x("{filename}: cannot parse last modification date '{date}'",
date => $asset->{date}));
}
}
}

if (!defined $date) {
$date = $asset->{date};
}

$asset->{last_modified} = Qgoda::Util::Date->newFromEpoch($date);

return $self;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Qgoda/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions lib/Qgoda/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ ajv-i18n@^3.3.0:
resolved "https://registry.npmjs.org/ajv-i18n/-/ajv-i18n-3.3.0.tgz"
integrity sha512-6X/yd/Ept9HSJoCr9mFpKQ3WG7w7ou+4p/t8REos1xL0qRDwrlFJa3LxyeOlQxu7FdyLdu0ss4204pUa3SkgQQ==

ajv@^6.12.3:
ajv@^6.0.0, ajv@^6.12.3:
version "6.12.3"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.3.tgz#18c5af38a111ddeb4f2697bd78d68abc1cabd706"
resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.3.tgz"
integrity sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA==
dependencies:
fast-deep-equal "^3.1.1"
Expand All @@ -31,7 +31,7 @@ esprima@^4.0.0:

fast-deep-equal@^3.1.1:
version "3.1.3"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz"
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==

fast-json-stable-stringify@^2.0.0:
Expand All @@ -54,7 +54,7 @@ json-schema-traverse@^0.4.1:

lodash@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==

punycode@^2.1.0:
Expand Down
Loading