Skip to content

Commit 8e5406c

Browse files
committed
Include sanitized site title as part of exported filename
1 parent 5efe7fa commit 8e5406c

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

paperback-export.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
$title = site()->title();
3737
$description = site()->description();
3838
$version = site()->version();
39+
$filename = str::slug($title);
3940

4041
if (! $includeInvisibles) {
4142
$pages = $pages->visible();
@@ -63,7 +64,7 @@
6364
}
6465

6566
$template = __DIR__ . DS . 'paperback-export.txt.php';
66-
$paperback = tpl::load($template, compact('languages', 'pages', 'title', 'description', 'version'));
67+
$paperback = tpl::load($template, compact('languages', 'pages', 'title', 'description', 'version', 'filename'));
6768

6869
return new response($paperback, 'txt');
6970
}

paperback-export.txt.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php header('Content-Type:text/plain'); ?>
2-
<?php header('Content-Disposition: attachment; filename="paperback.txt"'); ?>
2+
<?php header('Content-Disposition: attachment; filename="' . $filename .'-paperback.txt"'); ?>
33
<?php echo $title, PHP_EOL, PHP_EOL ?>
44
<?php if ($description != '') { echo $description, PHP_EOL, PHP_EOL ; } ?>
55
<?php if ($version != '') { echo 'Version ', $version, PHP_EOL, PHP_EOL ; } ?>

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Paperback is a simple cross-platform utility created by [David Fedor](http://the
1818

1919
+ Paragraphs in the exported text should be separated by double line breaks
2020
+ The exported content is not timestamped or versioned
21-
+ The filename used for the exported content is generic
2221
+ Page filtering and selection options are not currently functional
22+
+ Output is currently optimized for the [Newton Glossary](http://newtonglossary.com/) instance of [Kirby](https://getkirby.com/)
2323

2424
### Release Notes
2525

0 commit comments

Comments
 (0)