Skip to content

Commit

Permalink
Extranel dependency needed for new version of catalog.php
Browse files Browse the repository at this point in the history
  • Loading branch information
torinfo committed Oct 9, 2022
1 parent 3bb4a0d commit e8a8b7f
Show file tree
Hide file tree
Showing 10 changed files with 2,976 additions and 0 deletions.
37 changes: 37 additions & 0 deletions website_code/php/Html2Text/CHANGELOG.md
@@ -0,0 +1,37 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [1.1.0] - 2019-02-15
### Added
- Zero-width non-joiners are now stripped to prevent output issues, similar to non-breaking whitespace

### Fixed
- Fix namespace in composer [#67](https://github.com/soundasleep/html2text/pull/67)

## [1.0.0] - 2019-02-14
### Added
- Added `drop_links` option to render links without the target href [#65](https://github.com/soundasleep/html2text/pull/65)

### Changed
- **Important:** Changed namespace from `\Html2Text\Html2Text` to `\Soundasleep\Html2text` [#45](https://github.com/soundasleep/html2text/issues/45)
- Treat non-breaking spaces consistently: never include them in output text [#64](https://github.com/soundasleep/html2text/pull/64)
- Second argument to `convert()` is now an array, rather than boolean [#65](https://github.com/soundasleep/html2text/pull/65)
- Optimise/improve newline & whitespace handling [#47](https://github.com/soundasleep/html2text/pull/47)
- Upgrade PHP support to PHP 7.3+
- Upgrade PHPUnit to 7.x
- Re-release project under MIT license [#58](https://github.com/soundasleep/html2text/issues/58)

## [0.5.0] - 2017-04-20
### Added
- Add ignore_error optional argument [#63](https://github.com/soundasleep/html2text/pull/63)
- Blockquote support [#50](https://github.com/soundasleep/html2text/pull/50)

[Unreleased]: https://github.com/soundasleep/html2text/compare/1.1.0...HEAD
[1.1.0]: https://github.com/soundasleep/html2text/compare/1.0.0...1.1.0
[1.0.0]: https://github.com/soundasleep/html2text/compare/0.5.0...1.0.0
[0.5.0]: https://github.com/soundasleep/html2text/compare/0.5.0...0.3.4
21 changes: 21 additions & 0 deletions website_code/php/Html2Text/LICENSE.md
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Jevon Wright

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
101 changes: 101 additions & 0 deletions website_code/php/Html2Text/README.md
@@ -0,0 +1,101 @@
![example workflow](https://github.com/soundasleep/html2text/actions/workflows/test.yml/badge.svg) [![Total Downloads](https://poser.pugx.org/soundasleep/html2text/downloads.png)](https://packagist.org/packages/soundasleep/html2text)
=========

html2text is a very simple script that uses DOM methods to convert HTML into a format similar to what would be
rendered by a browser - perfect for places where you need a quick text representation. For example:

```html
<html>
<title>Ignored Title</title>
<body>
<h1>Hello, World!</h1>

<p>This is some e-mail content.
Even though it has whitespace and newlines, the e-mail converter
will handle it correctly.

<p>Even mismatched tags.</p>

<div>A div</div>
<div>Another div</div>
<div>A div<div>within a div</div></div>

<a href="http://foo.com">A link</a>

</body>
</html>
```

Will be converted into:

```text
Hello, World!
This is some e-mail content. Even though it has whitespace and newlines, the e-mail converter will handle it correctly.
Even mismatched tags.
A div
Another div
A div
within a div
[A link](http://foo.com)
```

See the [original blog post](http://journals.jevon.org/users/jevon-phd/entry/19818) or the related [StackOverflow answer](http://stackoverflow.com/a/2564472/39531).

## Installing

You can use [Composer](http://getcomposer.org/) to add the [package](https://packagist.org/packages/soundasleep/html2text) to your project:

```json
{
"require": {
"soundasleep/html2text": "~1.1"
}
}
```

And then use it quite simply:

```php
$text = \Soundasleep\Html2Text::convert($html);
```

You can also include the supplied `html2text.php` and use `$text = convert_html_to_text($html);` instead.

### Options

| Option | Default | Description |
|--------|---------|-------------|
| **ignore_errors** | `false` | Set to `true` to ignore any XML parsing errors. |
| **drop_links** | `false` | Set to `true` to not render links as `[http://foo.com](My Link)`, but rather just `My Link`. |

Pass along options as a second argument to `convert`, for example:

```php
$options = array(
'ignore_errors' => true,
// other options go here
);
$text = \Soundasleep\Html2Text::convert($html, $options);
```

## Tests

Some very basic tests are provided in the `tests/` directory. Run them with `composer install && vendor/bin/phpunit`.

## Troubleshooting

### Class 'DOMDocument' not found

You need to [install the PHP XML extension](https://github.com/soundasleep/html2text/issues/55) for your PHP version. e.g. `apt-get install php7.1-xml`

## License

`html2text` is [licensed under MIT](LICENSE.md), making it suitable for both Eclipse and GPL projects.

## Other versions

Also see [html2text_ruby](https://github.com/soundasleep/html2text_ruby), a Ruby implementation.
32 changes: 32 additions & 0 deletions website_code/php/Html2Text/composer.json
@@ -0,0 +1,32 @@
{
"name": "soundasleep/html2text",
"description": "A PHP script to convert HTML into a plain text format",
"type": "library",
"keywords": [ "php", "html", "text", "email" ],
"homepage": "https://github.com/soundasleep/html2text",
"license": "MIT",
"authors": [
{
"name": "Jevon Wright",
"homepage": "https://jevon.org",
"role": "Developer"
}
],
"autoload": {
"psr-4": {
"Soundasleep\\": "src"
}
},
"support": {
"email": "support@jevon.org"
},
"require": {
"php": "^7.0|^8.0",
"ext-dom": "*",
"ext-libxml": "*"
},
"require-dev": {
"phpunit/phpunit": "^7.0|^8.0|^9.0",
"soundasleep/component-tests": "^0.2"
}
}

0 comments on commit e8a8b7f

Please sign in to comment.