Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/philschatz/python-html-sourcemaps
Python Example that parses HTML (with sourcemaps) and outputs converted HTML (with sourcemaps)
https://github.com/philschatz/python-html-sourcemaps
Last synced: 6 days ago
JSON representation
Python Example that parses HTML (with sourcemaps) and outputs converted HTML (with sourcemaps)
- Host: GitHub
- URL: https://github.com/philschatz/python-html-sourcemaps
- Owner: philschatz
- Created: 2016-12-21T23:49:38.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-12-22T10:39:28.000Z (about 8 years ago)
- Last Synced: 2024-11-19T15:56:25.882Z (2 months ago)
- Language: Python
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Install
1. run `npm install` to get the source-map pretty-printer
1. run `./test` which generates `out.html` and `out.html.map`
1. run `$(npm bin)/sourcemap-lookup out.html:${LINE}:${COLUMN}` to specify the line/column in the output file and see the line/column in the input file# TODO
- [ ] load an input sourcemap file and rewire to use it when generating the output
- This would allow showing the CNXML source file (since sourcemaps support multiple source files)
- [ ] pythonify the ported code# Screenshots
The "console-GUI" tool that showcases that the sourcemaps are working takes an output file and output line/column information and shows the line/column in the source file. Since this code does not really manipulate the DOM much it is not terribly interesting but here goes:
```
$ sourcemap-lookup out.html:1:0Original Position:
input.html, Line 1:0Code Section:
1>|
2 |
3 |
4 |
5 |
6 |
``````
$ sourcemap-lookup out.html:4:6Original Position:
input.html, Line 4:4Code Section:
1 |
2 |
3 |
4>|
^
5 |
6 |
7 |
```