https://github.com/docelic/html2slang
Converts HTML pages to slang (templating language)
https://github.com/docelic/html2slang
Last synced: 11 months ago
JSON representation
Converts HTML pages to slang (templating language)
- Host: GitHub
- URL: https://github.com/docelic/html2slang
- Owner: docelic
- License: mit
- Created: 2018-01-21T09:19:22.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-21T12:59:38.000Z (over 8 years ago)
- Last Synced: 2025-06-21T23:34:18.724Z (about 1 year ago)
- Language: Perl
- Homepage:
- Size: 5.86 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# html2slang
Converts HTML pages to [slang](https://github.com/jeromegn/slang) (templating language).
Does it work? Yes.
Primary use case is converting HTML templates into much nicer and more efficient slang syntax, so that the development can be done in slang from there.
It might not cover absolutely all edge cases, but does pretty well and should get you in a good position.
(Currently the only outstanding issue is that it does not preserve whitespace in preformatted blocks of text, and simply treats everything as HTML.)
Various methods of running it:
```shell
perl html2slang.pl file1.html file2.html
cat file1.html | perl html2slang.pl
perl html2slang.pl < file1.html
```
Output is always printed to STDOUT. Redirect to where desired from there.
For example, to convert all *.html files in a directory and save the
under the same name with extension ".slang":
```bash
for p in *.html; do perl html2slang.pl "$p" > "${p/.html/.slang}"; done
```