Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 03-15-2024, 12:16 AM   #1
jugaor
Enthusiast
jugaor began at the beginning.
 
jugaor's Avatar
 
Posts: 30
Karma: 10
Join Date: Jun 2011
Location: Lima, Peru
Device: Kindle 10Gen / Kobo Aura HD / Nook STR
Some ideas

Hello, Sigil developers!
As a new version is coming, I would like to share some humble ideas, in case it is possible to consider/add them.

1. When using RegEx Rename…, could the Rename Table show only the files that will change?

(in this example, don't show the last two in the second column).


2. When using Reformat CSS, Multiple Lines Per Style, could the tags/classes be separated? (i.e. add a space after each comma: this makes it visually clearer).
For example:
Code:
h1+p, h2 + p, .classA>p, .classB > p { text-indent:0; }
.classA, .classB { text-align:right; text-indent:0; }
becomes:
Code:
h1+p,h2 + p,.classA>p,.classB > p {
  text-indent: 0;
}

.classA,.classB {
  text-align: right;
  text-indent: 0;
}
Note: Sigil removes spaces around commas, but not between other operators (like "+" or ">").


3. In Find/Replace, Options, Regex Options, there are now three possibilities. Could a new one be added to recognize Unicode characters? i.e. the equivalent to (*UPC)
Because, in languages with diacritics/"special" characters, word boundaries (\b) don't do what you expect.
For example:
Code:
\bmonta\b
in the word "montaña" captures the first five letters, although "ñ" is also a valid letter for us.


4. Could phrases (groups of words) be added to the personal dictionary?
For example: alter ego, ipso facto, sui generis, etc., are very common in Spanish texts (they are usually italicized) and it would be good to be able to except them only when they appear together in that order, because there are Latin phrases like curriculum vitae, whose first word, alone, in Spanish has an accent ("currículum").
Now they can be added manually (in the "default" file) but they are not recognized at Spellcheck.


5. More a question than a suggestion: Is it possible to configure it to use the "Sigil Norm" by default? (avoiding the use of Restructure... for new epubs).


Thank you very much for your attention!
Attached Thumbnails
Click image for larger version

Name:	RegEx Rename.jpg
Views:	186
Size:	51.9 KB
ID:	206894  
jugaor is offline   Reply With Quote
Old 03-15-2024, 12:27 AM   #2
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,464
Karma: 145525534
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by jugaor View Post
5. More a question than a suggestion: Is it possible to configure it to use the "Sigil Norm" by default? (avoiding the use of Restructure... for new epubs).
For new ePubs, I thought the default was using the 'Sigil Norm' layout when they were created? As for using that to restructure ePubs that are being edited, at one time restructuring the ePub was the default behaviour but enough people preferred not to have their ePubs restructured by default that the operation was made an optional to use tool.
DNSB is offline   Reply With Quote
Old 03-15-2024, 06:47 AM   #3
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,552
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
As DNSB has noted: new epubs already DO use the Sigil Norm structure as the default (unless you change it with your own default structure). Sigil just no longer automatically restructures ALL epubs upon opening.

As for the rest of your requests: we'll look into them, but it's probably too late for any of them to make it into the upcoming release. We need time for testing changes thoroughly before releasing.

RE the Regex Rename: I actually prefer seeing the filenames that aren't going to be affected. It helps to confirm that I've not made a boneheaded mistake before committing.
DiapDealer is offline   Reply With Quote
Old 03-15-2024, 11:26 AM   #4
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,647
Karma: 5433388
Join Date: Nov 2009
Device: many
As for your #1,
- no I want to see the full results before and after when renaming.

As for your no 2,
- I will look into that although, unnecessary whitespace is typically remove by all css linters for compactness.

As for 3,
- That is how regex has always worked with unicode. And there are already recognized regex mode flags that can be set for that. Let's hear what others think about that.

As for 4,
- Have you tried the new updated Spanish dictionary?

As for #5,
- Sigil no longer restructures and your default starting structure can be controlled by you. There is no one correct structure for epub2 or epub3. Sigil norm is just our old norm, not THE norm.

Last edited by KevinH; 03-15-2024 at 12:22 PM.
KevinH is offline   Reply With Quote
Old 03-15-2024, 12:08 PM   #5
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 692
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
Ad 1.
a) The number of items displayed in the table corresponds to the number of files selected before Rename RegEx was selected. Personally, I only select the files whose names I want to change....
b) I think it is possible to reconcile both sides.
Changed elements can be highlighted in the table with a background colour, for example. (Below is an example, but you have to take light/dark mode into account).

Spoiler:
Code:
    foreach(QString bpath, bookpaths) {
        QString apath = newbookpaths.at(r);
        ui.tableWidget->setItem(r, 0, new QTableWidgetItem(bpath));
        ui.tableWidget->setItem(r, 1, new QTableWidgetItem(apath));
        if (apath != bpath) {
            ui.tableWidget->item(r, 1)->setBackground(Qt::darkRed);
        }
        r++;
    }


Ad 2.
This line (add space after comma).

Although I have checked this, it is worth investigating further.
BeckyEbook is offline   Reply With Quote
Old 03-15-2024, 12:20 PM   #6
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,464
Karma: 145525534
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Looking at the items in the request:
  1. I also prefer to see the full results.
  2. Pretty much indifferent though most stylesheets I've seen do not place a space after a comma.
  3. I don't see that as being really useful. The current regex setup works for me.
  4. I don't use Spanish language dictionaries so not relevant to my needs.
  5. I've already expressed my opinion on this one. Restructuring on open should not return.
DNSB is offline   Reply With Quote
Old 03-15-2024, 12:29 PM   #7
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,647
Karma: 5433388
Join Date: Nov 2009
Device: many
Thanks. The space after the comma needs to be controlled by the formatting settings to be fully correct. Typically it is not added for single line formats.

Add adding highlighting for changed or unchanged is doable but since this is Regex Rename dialog, it should probably only highlight unchanged. Or as you said, if you do not want to rename a file do not include it when selecting the set of files for Regex rename.



Quote:
Originally Posted by BeckyEbook View Post
Ad 1.
a) The number of items displayed in the table corresponds to the number of files selected before Rename RegEx was selected. Personally, I only select the files whose names I want to change....
b) I think it is possible to reconcile both sides.
Changed elements can be highlighted in the table with a background colour, for example. (Below is an example, but you have to take light/dark mode into account).

Spoiler:
Code:
    foreach(QString bpath, bookpaths) {
        QString apath = newbookpaths.at(r);
        ui.tableWidget->setItem(r, 0, new QTableWidgetItem(bpath));
        ui.tableWidget->setItem(r, 1, new QTableWidgetItem(apath));
        if (apath != bpath) {
            ui.tableWidget->item(r, 1)->setBackground(Qt::darkRed);
        }
        r++;
    }


Ad 2.
This line (add space after comma).

Although I have checked this, it is worth investigating further.
KevinH is offline   Reply With Quote
Old 03-15-2024, 01:04 PM   #8
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,552
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Saving regexps with (*UCP) prepended doesn't really seem any more onerous to me than saving them with a checkbox checked. But I'm not opposed to a checkbox that does the same thing if it can be easily accomplished. Space in the F&R widget has always come at a premium, though. So there's that to consider, too.

Last edited by DiapDealer; 03-15-2024 at 01:11 PM.
DiapDealer is offline   Reply With Quote
Old 03-16-2024, 11:47 AM   #9
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,647
Karma: 5433388
Join Date: Nov 2009
Device: many
If anyone wants to experiment with the changes needed to add a space after a comma when reformatting the css in multi-line format (and not single-line "compact" format), this is the change we are considering for a future release:

Code:
diff --git a/src/Parsers/qCSSParser.cpp b/src/Parsers/qCSSParser.cpp
index af04b1e56..e54c1b1e2 100644
--- a/src/Parsers/qCSSParser.cpp
+++ b/src/Parsers/qCSSParser.cpp
@@ -1,6 +1,6 @@
 /************************************************************************
  **
- **  Copyright (C) 2021-2023 Kevin B. Hendricks, Stratford, Ontario, Canada
+ **  Copyright (C) 2021-2024 Kevin B. Hendricks, Stratford, Ontario, Canada
  **
  **  This file is part of Sigil.
  **
@@ -60,7 +60,7 @@ CSSParser::CSSParser()
     // Used for serializing parsed css (multiline format)
     csstemplateM.push_back("  ");      //  0 - standard indentation
     csstemplateM.push_back(" {\n");    //  1 - bracket after @-rule
-    csstemplateM.push_back("");        //  2 - unused
+    csstemplateM.push_back(" ");       //  2 - space after "," in selector
     csstemplateM.push_back(" {\n");    //  3 - bracket after selector was "\n{\n"
     csstemplateM.push_back("");        //  4 - unused
     csstemplateM.push_back(" ");       //  5 - string after property before value
@@ -76,7 +76,7 @@ CSSParser::CSSParser()
     // Used for serializing parsed css (single line format)
     csstemplate1.push_back("");        //  0 - standard indentation
     csstemplate1.push_back("{");       //  1 - bracket after @-rule
-    csstemplate1.push_back("");        //  2 - unused
+    csstemplate1.push_back("");        //  2 - space after "," in selector
     csstemplate1.push_back("{");       //  3 - bracket after selector was "\n{\n"
     csstemplate1.push_back("");        //  4 - unused
     csstemplate1.push_back("");        //  5 - string after property before value
@@ -342,7 +342,9 @@ QString CSSParser::serialize_css(bool tostdout, bool multiline)
 
             case SEL_START:
                 indent = CSSUtils::indent(lvl, csstemplate[0]);
-                output << indent << csstokens[i].data << csstemplate[3];
+                output << indent
+                       << CSSUtils::implode("," + csstemplate[2], CSSUtils::explode(",", csstokens[i].data, false))
+                       << csstemplate[3];
                 lvl++;
                 break;
KevinH is offline   Reply With Quote
Old 03-16-2024, 11:59 AM   #10
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,647
Karma: 5433388
Join Date: Nov 2009
Device: many
Looking at your point 4 more closely, unfortunately hunspell (the spellchecker used by Sigil) is a word based spell checker not a phrase based grammar checker.

So there is no easy way to make it check spelling variations for specific word phrase combinations.

So you have a few options:

A. Use search and replace to properly mark these words at belonging to the Latin language by adding a span and a lang attribute, and spell check those with the appropriate Latin dictionary. This is technically the most correct way to handle foreign phrases in any epub.

or

B. Set up a list of saved searches that can in fact detect commonly broken word phrases and use find and replace on that list to make sure those use the correct the spelling variation.

or

C. Try to find an existing Spanish grammar checker and interface it via a Sigil plugin to detect and report any phrase spelling inconsistencies.
KevinH is offline   Reply With Quote
Old 03-16-2024, 12:09 PM   #11
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,647
Karma: 5433388
Join Date: Nov 2009
Device: many
@DiapDealer,

Quote:
Originally Posted by DiapDealer View Post
Saving regexps with (*UCP) prepended doesn't really seem any more onerous to me than saving them with a checkbox checked. But I'm not opposed to a checkbox that does the same thing if it can be easily accomplished. Space in the F&R widget has always come at a premium, though. So there's that to consider, too.
Agreed but there is room I think to add to the Regex Options pulldown menu. We could add a "Use Unicode" option that could be selected by the user if they so desired and did not know about the (*UCP) flag. Of course it would only operate in Regex Mode.

Do you want me to take a shot at adding support to use "Use Unicode" to Find and Replace?

That would, of course, require wholesale recreation and updates to many images in our Sigil User Guide

Just let me know if this is something you want us to add for the release after this forthcoming one.

Last edited by KevinH; 03-16-2024 at 12:12 PM.
KevinH is offline   Reply With Quote
Old 03-16-2024, 01:53 PM   #12
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,552
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
It's not really something I want to add... I'm just not opposed.

I don't think we need to upset the applecart right now. Let's see what others think.
DiapDealer is offline   Reply With Quote
Old 03-16-2024, 03:58 PM   #13
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 692
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
Quote:
Originally Posted by KevinH View Post
If anyone wants to experiment with the changes needed to add a space after a comma when reformatting the css in multi-line format (and not single-line "compact" format), this is the change we are considering for a future release […]
Checked. It works OK. I'll leave the fix to myself and test during normal Sigil use.
BeckyEbook is offline   Reply With Quote
Old 03-16-2024, 04:22 PM   #14
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,647
Karma: 5433388
Join Date: Nov 2009
Device: many
Quote:
Originally Posted by BeckyEbook View Post
Checked. It works OK. I'll leave the fix to myself and test during normal Sigil use.
Thank you!
KevinH is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[FREE]Innovative Ideas to Ignite Your Mind: Business Ideas to Start Entrepreneurship amazon author Self-Promotions by Authors and Publishers 0 04-01-2015 04:09 AM
Where do Ideas Come From? kennyc Writers' Corner 36 12-03-2012 11:45 AM
PRS-505 Any ideas what this might be? Neupy Sony Reader 4 07-03-2012 07:19 AM
Ideas Drumm Calibre 3 08-31-2011 06:37 AM
Ideas? mike_bike_kite Which one should I buy? 10 06-13-2010 03:37 PM


All times are GMT -4. The time now is 04:22 PM.


MobileRead.com is a privately owned, operated and funded community.