View Single Post
Old 05-10-2014, 07:35 AM   #10
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 1v4n0 View Post
I tried, but I gave up (cit.). Here's the file. Can you do sthng w/ it?
I ran this Regex to pull the text outside of the links to take the text out of the link + compress it into a single line:

Search: <div class="sgc-toc-level-1">\s+<a href="../Text/([^"]+)">([^<]+)</a>\s+</div>
Replace: <div class="sgc-toc-level-1">\2<a href="../Text/\1"></a></div>

Example:

Code:
<div class="sgc-toc-level-1">
  <a href="../Text/Section0004.xhtml">In principio era il gioco di parole</a>
</div>
to:

Code:
<div class="sgc-toc-level-1">In principio era il gioco di parole<a href="../Text/Section0004.xhtml"></a></div>
Then I copied/pasted all the HTML code into this and had it sort it (could have probably used any sorting site/tool):

http://alphabetizer.flap.tv/index.php

I pushed the Alphebatize button, it shoved them all in alphabetical order (according to name).

I then copied/pasted back into Sigil and ran this Regex to shove the text back into the link:

Search: <div class="sgc-toc-level-1">([^<]+)<a href="../Text/([^"]+)"></a></div>
Replace: <div class="sgc-toc-level-1"><a href="../Text/\2">\1</a></div>

Example:

Code:
<div class="sgc-toc-level-1">In principio era il gioco di parole<a href="../Text/Section0004.xhtml"></a></div>
to:

Code:
<div class="sgc-toc-level-1"><a href="../Text/Section0004.xhtml">In principio era il gioco di parole</a></div>
Attached = all alphabetized TOC.

Anyway, may I ask what the purpose of having it sorted in alphabetical order? It seems as if you have a bunch of duplicates, and it might make it very confusing to try to navigate a TOC that does not match the order of the book.
Attached Files
File Type: epub TOCSorted.epub (13.4 KB, 241 views)

Last edited by Tex2002ans; 05-10-2014 at 07:38 AM.
Tex2002ans is offline   Reply With Quote