![]() |
@CalibUser: I've just tested the updated plugin with my Linux machine and appears to be working fine. (I only tested the line break fix.)
|
The Fix for false line breaks doesn't work in greek language.
I use the following regex to fix the lines breaks. Code:
Find: ([\p{Greek},'–’“”][</ib>]*)</p>\s+<p>([<ib>]*[\p{Greek},'–’“”])Code:
if allBreaks == 'Yes':Code:
if allBreaks == 'Yes':I don't know any python. Is my code ok? Thanks :) |
@Doitsu: Thanks for testing the plugin
@gipsy: In your code: Code:
r'([\p{Greek}\,\'–’“”][</ib>]*)</p>\s+<p>([<ib>]*[\p{Greek},\'–’“”])' |
You are right. But again they don't compine :(
Yes is for greek characters. Code:
<p>ο Πυθέας ήπιε το υπόλοιπο</p>Code:
<p>ο Πυθέας ήπιε το υπόλοιπο γάλα από το κύπελλο, σκούπισε δυο σταγόνες στα χείλη του με την ανάστροφη του χεριού του και σηκώθηκε.</p> |
Quote:
AFAIK, Python doesn't support the \p{Greek} syntax. I.e., Greek letters need to be explicitly expressed as Unicode ranges (0370–03FF). |
Quote:
Code:
userProfile = (os.environ['USERPROFILE']) #Get path to user profileFor that matter, it is highly environment-specific -- it would also break hard on a PortableApps.com install, for example. Is there any way in Sigil/the plugin container to access the value of the Sigil configuration folder? This would be a far, far better way of handling it. (If there isn't a way, then it would be a generally useful thing to have...) Asking the user to manually select the dictionary just to get around the issue of finding the configuration directory is overkill (and slightly onerous) -- although it could be useful if one has multiple dictionaries and wants to use a specific one, that is probably an edge case. EDIT: And of course the instructions already make it clear that that won't work. |
FWIW,
The next release of Sigil will include an interface to the hunspell spellchecker and will provide a list of paths to the hunspell dictionaries. If I can figure out how best to bundle sigil's version of gumbo for use by plugins, and if DiapDealer and I can fix some bugs, we should have a release out in 2 or 3 weeks. Kevin |
1 Attachment(s)
Quote:
@CalibUser: Python has a boatload of built-in functions for cross-platform file handling that make it really easy to implement cross-platform file support. Since the Sigil plugin root directory and the user_dictionary directory are sibling directories it's relatively easy to get the user_dictionary directory location. For example, you could use the following code to get the dictionary folder: Code:
import os, inspectWindows: Code:
C:\Users\Doitsu\AppData\Local\sigil-ebook\sigil\plugins\testCode:
/home/doitsu/.local/share/sigil-ebook/sigil/plugins/test |
Quote:
I change it to Code:
if allBreaks == 'Yes':Quote:
|
@CalibUser: Those are some fixes in greek language if you want to place them in your plygin. I try to find a solution and for some other things and i keep you posted :D
Code:
#Greek line break fixCode:
#Fixes Έ when PDFd as 'Ε or "Ε |
Quote:
I would, however suggest something other than the relatively fragile method of converting a path to a list of strings and then using the [:7] slice to strip off the last two directories. If the depth of that path ever increases, it won't point to the sigil preferences directory anymore. To be clear: it's the [:7] slice I find fragile, not the list of strings conversion and eventual re-joining. I would suggest using [:-2] if you're going to split the path into a list of strings that later get rejoined. Or just use os.path.dirname twice without converting to a list of strings and rejoining. It's all a bit fragile I guess (even mine), considering that the plugin directory could conceivably change in relation to the Sigil preferences directory. Code:
import os, inspectYou could also determine the path of the current plugin script in the run method of a plugin by using: Code:
def run(bk): |
Code:
#Greek line break fix |
Quote:
Quote:
(I guess it really depends on the app. I know they prefer if at all possible to not do that, it reduces the "portability" angle by potentially leaving unwanted cruft on the host computer.) :chinscratch: It doesn't look like there is any way to override the settings folder location in Sigil. (And it uses the deprecated-since-5.4 DataLocation, rather than AppDataLocation on Windows and AppConfigLocation on unix -- did Qt have to split it? :blink: -- which explains why the config folder is in ~/.local/share/sigil-ebook -- I have always wondered at that non-standard location.) |
Quote:
And there's just no "real" pressing need to convert and potentially lose user-settings/plugins in an upgrade (or create a one-time script to copy stuff to the new location). Maybe someday it will change, but it's just not high on the list of priorities at the moment. |
Quote:
Whether either is *necessary*, I won't venture to say. I agree once it's been used you shouldn't break everyone's settings just to conform to more "proper" standards. |
| All times are GMT -4. The time now is 08:29 PM. |
Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.