https://bugs.documentfoundation.org/show_bug.cgi?id=94989

--- Comment #18 from Tex2002ans <tex2002ans+libreoff...@gmail.com> ---
(In reply to Heiko Tietze from comment #17)
> Have you had the chance to see if the Styles Inspector is an alternative?

Yes, and while I slept on it... the Spotlight feature already HAS a lot of this
"detect same Styles/Formatting" logic in there... at least I think, because it
already generates those unique numbers + colored boxes!

So, one potential workflow may also just be something like:

- Letting the colored "Spotlight" number boxes be clickable too.

So you could:

- - -

SELECT / CHANGE / MAP TO A NEW PARAGRAPH STYLE

1) View > Styles (F11)
2) In the sidebar, all the way in the bottom-right corner:
- Check the "Spotlight" box ON.
3) The colored "Spotlight"/Style boxes appear next to each paragraph.
- Right-Click on colored box > "Select All Same Style".

Step 3 would then act as if you did a:

- 1) Ctrl+H
- 2) Check the "Paragraph Styles" box.
- 3) Choose the given Style.
- 4) Pressed "Find All".

4) In the Styles sidebar:
- Select what Style you wanted.

- - -

> What exactly is "bold text"? Could be Default Paragraph Style + Bold font 
> weight as direct formatting, or + Strong Emphasis character style, or + any 
> character attribute that include font weight >400 (many fonts offer more than 
> one value), or any paragraph style + any character style + one particular 
> weight attribute.

Heh, yes, exactly.

What would be considered "unique" formatting? And what could effectively be
considered "the same" or "duplicate"? ... it's a tricky problem.

But, you can look into things like:

- Calibre's DOCX->EPUB (or ODT->EPUB) conversions.

Calibre ingests documents—no matter how disgusting and full of direct
formatting—and spits out HTML+CSS that has:

- Unique CSS classes per "same format".
- <p>s + <span>s with unique classes.
  - <p> ≈ to LO's Paragraph Styles.
  - <span> ≈ to LO's Character Styles.

Usually it boils documents down to a few dozen (or few hundred) classes, even
on the very ugliest of documents.

* * * * * * * *

Side Note: Another thing to look into is what I've called:

- "Surgical Editing"

(I've written about this since 2021—and tools have since come out to
drastically speed this up.)

I split "same Styles" into 3 types:

- 100% Exact Match
- Very Close
- Similar

When I do EPUB->EPUB conversions, I progressively strip more and more "useless"
CSS formatting + selectively "ignore" certain attributes when making
comparisons:

- Fonts
- Font Size
- Colors
- [...]

then merge "same" CSS classes together.

For example, this CSS:

- - -

.normal {
    font-size: 1em;
}

[...]

.class98 {
    font-size: 1em;
}

.class99 {
    font-size: 1.1em;
}

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

- - -

where:

- 100% Exact = 1st and 2nd.
- Very Close = 3rd compared to 1st/2nd.
   - 1em ≈ 1.1em
- Similar = 4th compared to 1st/2nd, and potentially 3rd.
   - font-size = exact match, but color is different.

Using these "CSS comparison" tools, this lets you quickly merge/strip/join CSS
classes together, really cleaning things up.

For more info, see my writeups in:

- 2023: "Quick way to remove all class invokations for missing classes?"
  - https://www.mobileread.com/forums/showthread.php?p=4359877#post4359877
- 2021: "Adding a limited Automate Feature To Sigil"
  - https://www.mobileread.com/forums/showthread.php?p=4156269#post4156269

and when I first began brainstorming the idea/workflow in public:

- 2021: "Possible To-Do List for Future Sigil Releases Post Sigil 1.8"
  - https://www.mobileread.com/forums/showthread.php?p=4165819#post4165819

I KNOW this works in HTML + CSS, so I know it's possible. :)

* * * * * * * *

> My point here is that "all text with the same formatting" is probably not 
> always the same.

If you play around with Word's "Select All Similar Formatting" though, they do
a damn good job at all sorts of cases. :)

Easiest to tackle would be 100% matches. The others get progressively harder.

But, I mostly use this feature in Word to quickly:

- Map Direct Formatting -> Styles

Like:

1) Click on a BOLD + CENTERED + 18pt text.
- Select All Similar Formatting
- Change to "Heading 2" Paragraph Style.
2) Click on a paragraph with NO INDENT + 12pt text.
- Select All Similar Formatting
- Change to my custom "first" Paragraph Style.
3) Click on a paragraph with SMALLER FONT + SLIGHT INDENTS ON LEFT/RIGHT.
- Select All Similar Formatting
- Change to my custom "blockquote" Paragraph Style.
4) Click on an ITALIC piece of text.
- Select All Similar Formatting.
- Change to "Emphasis" Character Style.

So making it work on selecting "exact same" cases alone would be a HUGE step in
the right direction.

> Apart from that I understand the wish but cannot wrap my mind around the 
> exact requirement (and consequently solution).

Hmmm, well, it should still be available in the main UI itself (similar to
Word's)...

But perhaps Spotlight can be enhanced to do similar too.

And the nice thing about Spotlight is that you can HIGHLIGHT/SEE the
formatting.

I've used similar "highlight the formatting" workflows over the years while
editing HTML/CSS too. See the images I attached in:

- 2023: "Semantic markup question!"
  - https://www.mobileread.com/forums/showthread.php?p=4314437#post4314437
    - yellow = <i> Italics
    - orange = <em> Emphasis
- 2020: "Is there a way to edit EPUB or Mobi files such that the Quotes are in
BOLD?"
  - https://www.mobileread.com/forums/showthread.php?p=4065080#post4065080
  - https://i.ibb.co/GJxV2Kh/Blockquotes-PDF.png
  - https://i.ibb.co/hHBQ4J8/Blockquotes-EPUB.png
    - Blue = blockquotes
    - Brown = NO INDENT
    - Red = take a closer look, because it happened on a pagebreak.

This allows me to scan through a book, focusing on pieces of formatting at a
time, and progressively clean and mark things up in waves. :)

I can also map custom colors to how aggressively I need to check:

- Blue = Means my brain can ignore it. I already know it's correct.
- Red = I need to pay CLOSE attention + verify correct formatting.
- White / No Highlight = If needed, I can pay a little attention to these
areas.
  - (Or ignore in this pass.)

Spotlight already has the rough groundwork of "color the underlying
formatting"... but it's missing some customizations and things to make it a
SUPER DUPER (and intuitive) killer tool. :)

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to