Skip to content

Commit e867d6f

Browse files
gemmaromquinson
authored andcommitted
Keep the last line of YAML front matter section.
1 parent 9fc561a commit e867d6f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/Locale/Po4a/YamlFrontMatter.pm

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,12 @@ sub parse_yaml_front_matter {
8282
my @saved_ctn;
8383
my ( $nextline, $nextref ) = $self->shiftline();
8484
push @saved_ctn, ( $nextline, $nextref );
85+
my $last_line;
8586
while ( defined($nextline) ) {
86-
last if ( $nextline =~ /^(---|\.\.\.)$/ );
87+
if ( $nextline =~ /^(---|\.\.\.)$/ ) {
88+
$last_line = $nextline;
89+
last;
90+
}
8791
$yfm .= $nextline;
8892
( $nextline, $nextref ) = $self->shiftline();
8993
if ( $nextline =~ /: [\[\{]/ ) {
@@ -147,7 +151,7 @@ sub parse_yaml_front_matter {
147151
$self->{options}{yfm_skip_array},
148152
$self->{options}{yfm_paths}
149153
);
150-
$self->pushline("---\n");
154+
$self->pushline($last_line);
151155
return 1; # Valid YAML
152156
}
153157

0 commit comments

Comments
 (0)