Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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)

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:0

Original Position:
input.html, Line 1:0

Code Section:
1>|
2 |
3 |
4 |


5 |
6 |
```

```
$ sourcemap-lookup out.html:4:6

Original Position:
input.html, Line 4:4

Code Section:
1 |
2 |
3 |
4>|


^
5 |
6 |
7 |
```