![]() |
#16 |
actually it is /var/log
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 341
Karma: 2994236
Join Date: Sep 2012
Location: usually Europa
Device: prs t1
|
Also check if your python installation have necessary modules: smartypants, uuid, htmlentitydefs etc.
|
![]() |
![]() |
![]() |
#17 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,158
Karma: 201666666
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
![]() |
|
![]() |
![]() |
Advert | |
|
![]() |
#18 |
actually it is /var/log
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 341
Karma: 2994236
Join Date: Sep 2012
Location: usually Europa
Device: prs t1
|
hm... strange. I seem to remember that I had to install smartypants to make it work.
|
![]() |
![]() |
![]() |
#19 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
EDIT: see post #25 - new version
Here's a new 'smarten' (quotes/mdash/ndash/hellip) plugin, should be an improvement on the smartyPants version. Also has an apos_exceptions.txt file which you should edit and add/remove words you want that begin with an apostrophe, it's case SENSITIVE, so if a word could also be at beginning of a sentence include another line with that capitalised word, such as tis and Tis, one word on each line, WITHOUT the apostrophe. There's a few usual ones in there already, but edit as you see fit. One I deliberately left off was Cause as it could also be non apostophe'd. as in the examples "'Cause I said so!" 'Cause of death?' whereas it's lower-cased version would usually be apostrophe'd The mdash and ndash entities are converted from dashes, -- is ndash, and --- is mdash, if you want them the other way round you need to change the lines 56/57 in the smarten.py file, remove one of the three dashes from line 56 and add one to the two in line 57. Usual disclaimers apply. Any problems or quote-cases to add, please let me know. Edit: If you don't want it to do any of the (m/n)dash or ellipsis entities, you can comment out the lines (add a # to beginning of the line) in the smarten.py file 30, 31, 32 (calculate extras for the entities) 42, (add pre tags to comments) 56, 57, 58 (convert the entities) 119 (remove the pre tags from comments) Edit 2: If you do the commenting out you will need to add Code:
text = re.sub(r"""(?<=-\s)"(?=\s)""", r"""”""", text) # rd text = re.sub(r"""(?<=-\s)'(?=\s)""", r"""’""", text) # rs Last edited by Perkin; 08-24-2013 at 11:03 AM. |
![]() |
![]() |
![]() |
#20 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,158
Karma: 201666666
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Thanks! Can't wait to take it for a spin.
![]() |
![]() |
![]() |
Advert | |
|
![]() |
#21 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,158
Karma: 201666666
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Had a chance to check out your script and have had good luck with it. I've found certain scenarios, though, where the quotes in the DOCTYPE are changed to entities. It's a Pretty-Print thing, I think.
If the DOCTYPE is all on one line, your script leaves it alone. Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> ![]() |
![]() |
![]() |
![]() |
#22 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
@DiapDealer, can you change the line ~45 in smarten.py to the one below (it adds flags) and try it again on the multiline DOCTYPE
the line follows the comment: # Split the html into tags and text Code:
entities = re.split(r'(<.+?>)', text, flags=re.M|re.S) Thanks. |
![]() |
![]() |
![]() |
#23 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,158
Karma: 201666666
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Cool, thanks! I hadn't waded in all that deep yet.
|
![]() |
![]() |
![]() |
#24 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
EDIT: see post #25 - new version
Here's a new version of the smarten plugin, contains a couple of fixes and the apos_exceptions.txt file is now dealt with differently, you can have more than one entry on each line and you can include the apostrophe or leave out it. Any other problems or case-fixes please let me know. Edit: If you don't want it to do any of the (m/n)dash or ellipsis entities, you can comment out the following lines (add a # to beginning of the line) in the smarten.py file 31, 32, 33 and 53, 54, 55 Edit 2: One fix already, change line 63 (of smarten.py) to following - it adds \b to the regex. If a single quote preceded a word which was also in apos_exceptions word, then it got changed to an apostrophe, when it shouldn't have done - should be an open quote. e.g. ('im is in apos_exception.txt) 'important' Code:
text = re.sub(r"'("+entry.strip("'")+"\b)", r"’\1", text) Last edited by Perkin; 08-24-2013 at 11:03 AM. |
![]() |
![]() |
![]() |
#25 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
Just found another flub, when an n/mdash entity was at beginning or end of line, the entity was being changed, but the count wasn't getting added to (as the extras/offset check wasn't getting a match), so the tags went out of alignment with the text.
Hopefully this should be it. (famous last words...) Edit: If you don't want it to do any of the (m/n)dash or ellipsis entities, you can comment out the following lines (add a # to beginning of the line) in the smarten.py file 32, 33, 34, 35, 36 and 56, 57, 58 Edit 2: Yep, spoke too soon. Just updated it, missed removing a couple of characters in the ndash replace line. If you've already downloaded this new version, can you change line 57 in smarten.py to: Code:
text = re.sub(r'(?<=[^-])--(?=[^-])', r'–', text, flags=re.M) # ndash Last edited by Perkin; 08-24-2013 at 11:58 AM. |
![]() |
![]() |
![]() |
#26 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
@Smarten plugin...
Just found another problem, to do with the apos_exceptions part. Although it did seem to be working, I found that now it doesn't - even though I can't see why it did originally work. Could you change line ~66 of smarten.py from this Code:
text = re.sub(r"'(" + entry.strip("'") + "\b)", r"&# 8217;\1", text) Code:
text = re.sub(r"'(%s\b)" % entry.strip("'"), r"&# 8217;\1", text) |
![]() |
![]() |
![]() |
#27 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Mar 2016
Device: iPad
|
![]() |
![]() |
![]() |
![]() |
#29 | |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,292
Karma: 29219530
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
Not even months are easy - 'The March Hare first appears in Carroll's Mad Hatter's Tea Party scene.' v 'The 44th Foot had to march through the snow.'; 'The endless wet days of May.' v 'The truth may hurt for a while...'; 'August winds are invariably cold.' v 'An august body of work.' Writing a plugin to do the necessary contextual analysis wouldn't be easy. Lots of controversy too - e.g 'the Internet' v 'an internet'. BR Last edited by BetterRed; 03-18-2016 at 09:00 PM. |
|
![]() |
![]() |
![]() |
#30 |
temp. out of service
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,807
Karma: 24285242
Join Date: May 2010
Location: Duisburg (DE)
Device: PB 623
|
^that.
No automation can really replace copy editing; developmental editing or translation done by human experts. Mainly because of contextual subtleties. Forget a plugin - the red penis your friend ![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sigil 0.3.4 / Sigil 0.4.0 RC1 / Cover in Nook Color | Bertrand | Sigil | 13 | 08-06-2011 05:06 AM |
Sigil 0.3.4 / Problème CSS entre Sigil et iPad | Grivels | Software | 10 | 07-03-2011 10:06 AM |
Plugins | junkml | Plugins | 32 | 06-19-2009 07:43 AM |
Plugins? | Mitchll | Plugins | 0 | 12-27-2008 03:36 PM |