diff options
author | Jonas Smedegaard <dr@jones.dk> | 2015-01-15 14:34:26 +0100 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2015-01-15 14:34:26 +0100 |
commit | c647b5a00ced7d8f791705f2ad756335c4d7f739 (patch) | |
tree | 13061e29d81a66f7c234c32991abeff884391da2 /mediawiki-matter | |
parent | edee74b3ffd4b2ce21a87b47c17bbf92ee2e28d5 (diff) |
Fix revert to also filter frontmatter.
Diffstat (limited to 'mediawiki-matter')
-rwxr-xr-x | mediawiki-matter | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/mediawiki-matter b/mediawiki-matter index 04f5393..402e430 100755 --- a/mediawiki-matter +++ b/mediawiki-matter @@ -1,6 +1,6 @@ #!/usr/bin/perl -# separate frontmatter pieces from mainmatter +# reorganize frontmatter use warnings; use strict; @@ -13,16 +13,12 @@ my $outfile = shift || $infile; $_ = path($infile)->slurp_utf8; -s|^((?:.*?\n)?)(= Preface(?:(?!\n=).)*\n)(=.*)$|$1$3|s; -path('preface.mw')->spew_utf8($2); - -s|^((?:.*?\n)?)(= Foreword(?:(?!\n=).)*\n)(=.*)$|$1$3|s; -path('foreword.mw')->spew_utf8($2); +# swap sections → Copyright, TOC, Foreword, Preface +s|^((?:.*?\n)?)(= Preface(?:(?!\n=).)*\n)(= Copyright(?:(?!\n=).)*\n)(= Table(?:(?!\n=).)*\n)(= Foreword(?:(?!\n=).)*\n)(=.*)$|$1$3$4$5$2$6|s; +# drop section Copyright s|^((?:.*?\n)?)(= Copyright(?:(?!\n=).)*\n)(=.*)$|$1$3|s; -s|^((?:.*?\n)?)(= Table of Contents(?:(?!\n=).)*\n)(=.*)$|$1$3|s; - path($outfile)->spew_utf8($_); 1; |