Skip to content

sub _build_posts does not sort a file list with both .md and .markdown correctly #50

@taskboy3000

Description

@taskboy3000

This may be irrelevant, considering the list is later sorted by desired publication date, but in the posts builder, this line appears:

            sort { $a->basename cmp $b->basename }

In context, $a and $b are Path::Class::File objects and one might expect basename to return the filename without an extension here. However, it does not. The extension is still present.

Using the venerable File::Basename::basename routine allows the caller to provide a list extensions to be stripped out of the returned file name. However, Path::Class::File::basename does not appear to take extensions as arguments to strip off, which is surprising.

Ultimately, the list of posts is sorted by the desired publication date, which Plerd::Post calculates.

Frankly, I would suggest removing the file sort as it appears do work that is ultimately thrown away.

Marking this as an enhancement because it does not really cause problems in the project. This is sort of "it would be nice to fix for pendantry" issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions