05-11-2015, 09:19 AM | #1 |
Grand Sorcerer
Posts: 28,039
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Shady Characters plugin
*Note: Requires Sigil v0.8.3 and later *
*Note: Do not rename any Sigil plugin zip files before installing * This plugin will work with either Python 3.4+ or Python 2.7+ (defaults to 3.x if both are present). The Shady Characters plugin will expose many invisible unicode characters that can elude the eye and make editing searching (x)html markup confusing. It converts those "invisible" characters to their numeric entity equivalents (I chose numeric because it's less likely to cause errors in conjunction with DTDs--or lack thereof). You can then do to those entities what you want. Currently it looks for: thin space soft hyphen zero-width joiner word-joiner zero-width non-breaking space narrow non-breaking space non-breaking space (only for completeness ... the Sigil environment is pretty toxic to the non-breaking space character anyway) If you wish to customize the characters searched for, and/or what they get replaced with, edit the ShadyCharacters.json file (<Sigil preferences directory>/plugins_prefs/ShadyCharacters/ShadyCharacters.json). You will need to run the plugin at least once before the preference file exists. A single entry will look like: Code:
"zwj": [ "0x200D", "‍" ], The second field ("0x200D") is a string representation of the hex value of the character being sought (please include the quotes and the "0x" prefix) The third field ("‍") is the numeric entity that you wish to replace the character with when it's found (please note that the character will be replaced with whatever you choose to put here.) In short: Code:
"zwj": ["0x200D","‍"], *Please note that if you edit the document in Book View after you convert the characters to entities with this plugin, they will be converted back to invisible characters (unless you have the numeric entities listed in Sigil's Preserve Entities preferences). Simply run the plugin again to turn them back to entities. Last edited by DiapDealer; 02-26-2019 at 11:04 AM. |
05-11-2015, 02:27 PM | #2 |
Sigil Developer
Posts: 8,156
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Added this to the official plugin threads list.
KevinH |
05-11-2015, 03:22 PM | #3 |
Grand Sorcerer
Posts: 28,039
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
|
05-12-2015, 02:54 PM | #4 |
Klak
Posts: 174
Karma: 150374
Join Date: Sep 2011
Location: Belgrade, Serbia
Device: many
|
this plugin is great framework for transliteration (well, serbian anyway). thanx a lot.
|
05-12-2015, 02:57 PM | #5 |
Grand Sorcerer
Posts: 28,039
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
|
05-14-2015, 09:45 AM | #6 |
Klak
Posts: 174
Karma: 150374
Join Date: Sep 2011
Location: Belgrade, Serbia
Device: many
|
sure. if i remember anything.
|
02-26-2019, 07:10 AM | #7 | ||
Guru
Posts: 677
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
https://www.fileformat.info/info/uni...200a/index.htm So I added this to the json: Code:
"hairsp": [ "0x200A", " " ], Code:
<h1>hair 8202 = =</h1> But the plugin doesn't find them. Quote:
Looked at your posts and see I need to use NOPARSE. Last edited by AlanHK; 02-26-2019 at 07:20 AM. |
||
02-26-2019, 07:48 AM | #8 |
Grand Sorcerer
Posts: 28,039
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
This plugin was created before the Preserve Entities preference setting was added to Sigil. You should be able to add the hairsp entity (or any other invisible character entity) to your preserve entities list and Sigil will convert any characters found when saving or manually Mending/Prettifying. If not, then the hairspace entity may be being converted into some other character (for unknown reasons.
I'll take a look at why the plugin may be acting up on the hairspace char, though. Have you verified the plugin still even works with any of the invisible characters? Sigil's gone through many changes since its time. |
02-26-2019, 09:20 AM | #9 | |
Guru
Posts: 677
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
But any changes I make to ShadyCharacters.json are reverted when I run the plugin. Even if I delete everything, when I run the plugin it just restores the default. Meanwhile; the preserve entities preference does work. |
|
02-26-2019, 11:06 AM | #10 |
Grand Sorcerer
Posts: 28,039
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I uploaded a fix for the plugin so that it actually saves and uses any user-added characters to the json prefs file. Mainly for posterity.
|
02-26-2019, 11:10 AM | #11 | |
Guru
Posts: 677
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Thanks.
Quote:
At least it wasn't me screwing up. I kept thinking I had edited the wrong file or messed it up somehow. There is a use for it. If you want to see what characters are there and maybe then some S&R. But when done, you can let them go back to Unicode. If you use "preserve entities" you always see the codes. I found this useful: https://www.w3schools.com/charsets/r...unctuation.asp Lists "punctuation" including a lot of esoteric spaces. Last edited by AlanHK; 02-26-2019 at 11:26 AM. |
|
02-26-2019, 11:33 AM | #12 |
Grand Sorcerer
Posts: 28,039
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Like I mentioned: it was just a stop-gap solution until the Preserve Entities feature was implemented. Not that many people used it--let alone customized it.
Sorry about that. Customizations could always be added directly to the matrix at the top of the plugin.py file. Perhaps that's what the few others who made use of the plugin did to customize it. *shrug* |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
¿Convert unicode decomposed characters to unique/normal characters? | JohnQwerty | Calibre | 3 | 04-05-2012 01:08 PM |
Plugin not customizable: Plugin: HTML Output does not need customization | flyingfoxlee | Conversion | 2 | 02-24-2012 03:24 AM |
[GUI Plugin] Plugin Updater **Deprecated** | kiwidude | Plugins | 159 | 06-19-2011 01:27 PM |
New Plugin Type Idea: Library Plugin | cgranade | Plugins | 3 | 09-15-2010 01:11 PM |
Shady dealings at Night Shade? | weateallthepies | News | 7 | 07-09-2010 11:48 PM |