glutanimate / syntax-highlighting

A fork of Tiago Barroso's Syntax Highlighting add-on with support for Anki 2.1
https://ankiweb.net/shared/info/1463041493
Other
108 stars 27 forks source link

remove unnecessary HTML tags if linenumbering is not requred #20

Open gottschali opened 4 years ago

gottschali commented 4 years ago

Description

Remove unnecessarily HTML table tags when line numbers are disabled

Strips

from the beginning and the corresponding closing tags at the end from the highlighted code. The table is used for line numbering but when this is disabled it has no use. Futhermore it changes the wrapping
to a

because the centering of the code broke otherwise. To make that possible process_html is now passed a new parameter linenos and executed before the addition of the centering tags to facilitate the stripping. Resolves: #15 #### Checklist: *Please replace the space inside the brackets with an **x** and fill out the ellipses if the following items apply:* - [x] I've read and understood the [contribution guidelines](./CONTRIBUTING.md) - [x] I've tested my changes against at least one of the following [Anki builds](https://apps.ankiweb.net/#download): - [x] Latest standard Anki 2.1 binary build [required for Anki-compatible 2.1 add-ons] - [x] Latest alternative Anki 2.1 binary build - [ ] Latest Anki 2.0 binary build [required for Anki 2.0-compatible add-ons] - [ ] I've tested my changes on at least one of the following platforms: - [x] Linux, version: Arch 5.5.13 - [ ] Windows, version: - [ ] macOS, version: - [ ] My changes potentially affect non-desktop platforms, of which I've tested: - [ ] AnkiMobile, version: - [ ] AnkiDroid, version: - [ ] AnkiWeb
gottschali commented 4 years ago

Could someone check this on windows please? Also I'm not sure if I did the squashing and merging right, it's the first time I do that.