summaryrefslogtreecommitdiff
path: root/vendor/soundasleep/html2text/convert.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2023-10-21 10:51:24 +0300
committerAndrew Dolgov <[email protected]>2023-10-21 10:51:24 +0300
commit03e956132d4a4b880d4e4533aeab725b0b2b5b52 (patch)
treece23379887ece400212767f527afcba8366f018a /vendor/soundasleep/html2text/convert.php
parent2b61052e8709283d89997e351173bcb43a3c2c61 (diff)
switch to html2text() instead of strip_tags() when preparing FTS index
Diffstat (limited to 'vendor/soundasleep/html2text/convert.php')
-rw-r--r--vendor/soundasleep/html2text/convert.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/vendor/soundasleep/html2text/convert.php b/vendor/soundasleep/html2text/convert.php
new file mode 100644
index 000000000..48094eb21
--- /dev/null
+++ b/vendor/soundasleep/html2text/convert.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * This file allows you to convert through the command line.
+ * Usage:
+ * php -f convert.php [input file]
+ */
+
+if (count($argv) < 2) {
+ throw new \InvalidArgumentException("Expected: php -f convert.php [input file]");
+}
+
+if (!file_exists($argv[1])) {
+ throw new \InvalidArgumentException("'" . $argv[1] . "' does not exist");
+}
+
+$input = file_get_contents($argv[1]);
+
+require_once(__DIR__ . "/src/Html2Text.php");
+require_once(__DIR__ . "/src/Html2TextException.php");
+
+echo \Soundasleep\Html2Text::convert($input);