View Single Post
Old 10-25-2021, 06:23 PM   #2
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by KevinH View Post
Here is a list of possible To-Do items for future Sigil releases.
Excellent!

Quote:
Originally Posted by KevinH View Post
- Add GetInfo dialog to BookBrowser to add/change Semantics and Manifest Properties on a File

- Update to version 2 of the C regular expression library
More details on these?

Quote:
Originally Posted by KevinH View Post
- Add a regex to be used to build TOC when no headings tags exist (considering but this is against accessibility)
Heh. I like the way Sigil currently does it:

You do bad Accessibility? You don't get access to the amazing TOC Generator!

(Same with Word or LibreOffice's Table of Contents. Don't use Headings properly? Now you can't easily jump around your documents or generate page numbers.)

Maybe it nudges people to create better code.

I could see this MAYBE being helpful if you wanted to point to a Copyright Page, Title Page, etc., without necessarily having a heading inside. But that's what I use Tools > Table of Contents > Edit Table of Contents for.

What were the example use-cases being given?

Quote:
Originally Posted by KevinH View Post
Based on ideas from Text2002ans, over the last month or so I have been working offline of a CSSToolbox codebase to act as the backbone for a GUI tool to:
Who's this Text guy? He sure sounds like a smart guy!

And to go into more detail on the CSS tools:

These will help you catch and merge exact/similar CSS:

Exact match:

Code:
.normal {
	font-size: 1em;
}
[...]
.class98 {
	font-size: 1em;
}
Very close:

Code:
.normal {
	font-size: 1em;
}
[...]
.class99 {
	font-size: 1.1em;
}
Or similar:

Code:
.normal {
	font-size: 1em;
}
[...]
.class100 {
	font-size: 1em;
	color: black;
}
All 3 extra classes could then merge into 1, and Sigil would take care of the renaming/cleanup for you:

Before:

Spoiler:

Code:
<p>An <span class="normal">example</span>
where <span class="class98">there</span>
are <span class="class99">similar</span>
and <span class="class100">classes</span>.</p>
CSS:

Code:
.normal {
	font-size: 1em;
}

[...]

.class98 {
	font-size: 1em;
}

.class99 {
	font-size: 1.1em;
}

.class100 {
	font-size: 1em;
	color: black;
}


After:

Spoiler:
Code:
<p>An <span class="normal">example</span>
where <span class="normal">there</span>
are <span class="normal">similar</span>
and <span class="normal">classes</span>.</p>
CSS:

Code:
.normal {
	font-size: 1em;
}


Very very helpful when working from not-so-clean documents.

Quote:
Originally Posted by KevinH View Post
If you have other ideas that you feel would benefit MANY users that would NOT be better as plugins, please let us know.
I re-thought of this one while messaging with someone else:

Saved Searches: Count All

In Saved Searches, when you press "Count All" on a Group, Sigil just gives you the total # of hits.

Would be nice to get a list of # hits per Saved Search:

Code:
Name           |   # Hits
_______________|______________
Group #1       |
  - Search 1   |       5
  - Search 2   |       4
  - Search 3   |       0
_______________|______________
Total          |       9
Right now, you press "Count All", and Sigil just says 9.

Example: I have large groups I run together, like my 12-step "Finereader Cleanup".

Getting a breakdown, I could know things like:
  • "How much smallcaps is in this book?"
  • "Are there tables?"
  • "Any double footnotes?"

Right now, I run all 12 steps, thousands of hits total, but some important replaces may only get 0/1 hits.

Side Note: Maybe show this window after a Group "Replace All" too?

Or this might get too annoying?

* * *

And this one, we privately discussed a month ago, but I recently formatted my PMs a little nicer + detailed some use-cases.

Here's a little more:

Advanced Find/Replace (List-Based)

You'd have a Spellcheck List-type menu with:
  • Find
  • Replace
  • Filter

and 3 sortable columns:
  • Found
  • Replace
  • # Hits

You'd be able to visually see, at a glance, all hits on your searches.

Like this regex could "find all Dialogue Tags within a fiction book" + replace with "said":

Find: ,” \b(Alex|Bob|Joanne|Suzie|s*he|they)\b (\w+)
Replace: ,” \1 said
Filter:

Code:
Found              | Replace        |  Hits
___________________|________________|______
,” Alex opined     | ,” Alex said   |    10
,” Suzie accused   | ,” Suzie said  |     9
,” Joanne agreed   | ,” Joanne said |     4
,” Alex explained  | ,” Alex said   |     2
,” Alex ejaculated | ,” Alex said   |     1
,” she beseeched   | ,” she said    |     1
Then you could filter the list. Like only searching for "Alex":

Filter: Alex

Code:
Found              | Replace        |  Hits
___________________|________________|______
,” Alex opined     | ,” Alex said   |    10
,” Alex explained  | ,” Alex said   |     2
,” Alex ejaculated | ,” Alex said   |     1
And you could selectively apply Find/Replace ONLY on specific rows:

Code:
Found              | Replace        |  Hits
___________________|________________|______
,” Alex opined     |                |    10
,” Alex explained  |                |     2
,” Alex ejaculated | ,” Alex said   |     1
or sort the columns:

Code:
v Found            | Replace        |  Hits
___________________|________________|______
,” Alex ejaculated | ,” Alex said   |     1
,” Alex explained  |                |     2
,” Alex opined     |                |    10
and/or you could double-click on a row, and jump to its exact location in the EPUB (like Spellcheck Lists!).

With the current Find/Replace methods, you have to go through the entire book and:
  • Replace All
  • Find/Replace one-by-one

Although in many real-life cases, you're also dealing with:
  • Replacing nearly all, with a few exceptions
    • Like Hyphens -> EN DASH between number ranges.
    • You want most of these converted, but NOT URLs, ISBNs, Phone Numbers, etc.
  • Finding all, but replacing only a few exceptions
    • The "creative dialogue tags" above.

I also believe list form would also help when dealing with complicated regex, because you could visually see before/after without applying.

Example regex:

UPPERCASE -> <span class="smallcaps">

Search: (*UCP)([[:upper:]])([[:upper:]]{2,})
Replace: <span class="smallcaps">\1\L\2\E</span>
Filter:

Code:
Found   |  Replace                              |  Hits
________|_______________________________________|______
BC      | <span class="smallcaps">Bc</span>     |   100
AD      | <span class="smallcaps">Ad</span>     |    47
FIGURE  | <span class="smallcaps">Figure</span> |    10
ALEX    | <span class="smallcaps">Alex</span>   |     2
CIA     | <span class="smallcaps">Cia</span>    |     1
FBI     | <span class="smallcaps">Fbi</span>    |     1
USA     | <span class="smallcaps">Usa</span>    |     1
You'd probably want to skip replacing acronyms + "AD" and "BC", but apply that regex on all others:

Code:
Found   |  Replace                              |  Hits
________|_______________________________________|______
BC      |                                       |   100
AD      |                                       |    47
FIGURE  | <span class="smallcaps">Figure</span> |    10
ALEX    | <span class="smallcaps">Alex</span>   |     2
CIA     |                                       |     1
FBI     |                                       |     1
USA     |                                       |     1
With the current method, you'd have to:
  • Click through 150 false positives to dig out that 12 you actually want to fix.
  • Replace All, then correct "Ad" and "Bc", "Cia", ...
  • Create a more complicated, complicated regex. (Or set of Saved Searches.)

With the list form, you can see patterns, double-check, then selectively apply Replaces (or Replace All just like now... just with more information at your fingertips).

Last edited by Tex2002ans; 10-25-2021 at 08:44 PM.
Tex2002ans is offline   Reply With Quote