https://github.com/advestis/htmlmerger
A package allowing to merge all html files in a directory in a single file.
https://github.com/advestis/htmlmerger
html python
Last synced: about 2 months ago
JSON representation
A package allowing to merge all html files in a directory in a single file.
- Host: GitHub
- URL: https://github.com/advestis/htmlmerger
- Owner: Advestis
- License: gpl-3.0
- Created: 2021-01-18T08:11:36.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-05-13T17:33:35.000Z (about 2 years ago)
- Last Synced: 2025-04-30T23:07:07.539Z (2 months ago)
- Topics: html, python
- Language: Python
- Homepage: https://advestis.github.io/htmlmerger
- Size: 69.3 KB
- Stars: 5
- Watchers: 1
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[](https://advestis.github.io/htmlmerger)
[](https://www.gnu.org/licenses/gpl-3.0)#### Status
[](https://github.com/Advestis/htmlmerger/actions/workflows/pull-request.yml)
[](https://github.com/Advestis/htmlmerger/actions/workflows/push-pypi.yml)
[](https://github.com/Advestis/htmlmerger/actions/workflows/push-doc.yml)

#### Compatibilities


##### Contact
[](https://www.linkedin.com/company/advestis/)
[](https://www.advestis.com/)
[](mailto:[email protected])# HtmlMerger
A package allowing to merge all html files in a directory in a single file.
## Installation
```
git clone https://github.com/pcotteadvestis/htmlmerger
cd htmlmerger
python setup.py install
```or
```
pip install htmlmerger
```## Usage
Merges html files into a fingle file
For each file, will extract the content between the ... <\\head><\\body><\\html> or
... <\\body><\\html> and put all those contents between those same tags in a new file. Simple as
that.You can either give a list of files or a directory as input, and if not specified the output will be
input_directory/merged.html, or ./merged.html. You can also pass the argument "clean=True" when calling merge() to
delete the
individual files
used for merging.Supports transparentpath objects.
```python
from htmlmerger import HtmlMerger
merger = HtmlMerger(input_directory="my_htmls/") # result will be in my_htmls/merged.html
merger.merge(clean=True) # or clean=False to keep the individual files (default behavior)from pathlib import Path
merger = HtmlMerger(files=Path("my_htmls/").glob("*")) # result will be in ./merged.html
merger.merge()
```