Skip to content

Commit

Permalink
New version of Template::Provider::Pandoc handles the frontmatter.
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed Nov 27, 2024
1 parent 7f39b4b commit 2e9c588
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
6 changes: 6 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## [0.2.4] - 2024-11-27

### Fixed

- Use new version of Template::Provider, which handles the frontmatter

## [0.2.3] - 2024-11-25

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ WriteMakefile(
Clone => 0,
Template => 0,
Moose => 0,
'Template::Provider::Pandoc' => 0,
'Template::Provider::Pandoc' => '0.1.0', # For STRIP_FRONT_MATTER
'Text::FrontMatter::YAML' => 0,
'Path::Tiny' => 0,
'YAML::XS' => 0,
Expand Down
9 changes: 5 additions & 4 deletions lib/App/Aphra.pm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use URI;

use App::Aphra::File;

our $VERSION = '0.2.3';
our $VERSION = '0.2.4';

has commands => (
isa => 'HashRef',
Expand Down Expand Up @@ -151,9 +151,10 @@ sub _build_template {
return Template->new(
LOAD_TEMPLATES => [
Template::Provider::Pandoc->new(
INCLUDE_PATH => $self->include_path,
EXTENSIONS => $exts,
OUTPUT_FORMAT => $self->config->{output},
INCLUDE_PATH => $self->include_path,
EXTENSIONS => $exts,
OUTPUT_FORMAT => $self->config->{output},
STRIP_FRONT_MATTER => 1,
),
],
VARIABLES => {
Expand Down
3 changes: 1 addition & 2 deletions lib/App/Aphra/File.pm
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,13 @@ sub process {
);

my $front_matter_hashref = $front_matter->frontmatter_hashref // {};
my $template_data = $front_matter->data_text;
my $orig_layout;
if ($front_matter_hashref->{layout}) {
$orig_layout = $self->app->template->{SERVICE}{WRAPPER};
$self->app->template->{SERVICE}{WRAPPER} = [ $front_matter_hashref->{layout} ];
}

$self->app->template->process(\$template_data, {
$self->app->template->process($template, {
page => $front_matter_hashref,
file => $self,
}, $out)
Expand Down

0 comments on commit 2e9c588

Please sign in to comment.