Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 09-10-2013, 04:23 AM   #31
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
Quote:
Originally Posted by Hitch View Post
Oh, GOD. I feel a major beta-testing episode coming on....

Hitch
Nah, it will not be that bad... I hope. I have quite a lot of demo documents which I want to process correctly. I am not even close to beta testing at the moment, it is pre-alpha.

Quote:
Originally Posted by DiapDealer View Post
It's been a long time since I inspired anybody to do anything.

To be honest, I don't have the slightest problem using regex inside another scripting (or full-blown programming) language where some logic can be applied to correctly handle the opening and closing of tags (including any potential nesting issues) it's too handy NOT to make use of. And for the quick stuff that I do within Sigil, Regex is my bestest buddy. But there are times when I ask too much of him: unforeseen scenarios with nested spans and divs are usually involved when that happens.
I doubt that you do not inspire anybody, your post are doing that.

This was just prickling my mind. I personally am not part of the flamewar. I do understand the points of both and RegEx is too handy in some occasions not to use it. In this case it prickled me to investigate another route and it looks promising so far, although the documentation is really scarce.
Toxaris is offline   Reply With Quote
Old 09-13-2013, 02:17 PM   #32
ibu
Addict
ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.
 
Posts: 264
Karma: 9246
Join Date: Feb 2010
Location: Berlin, Germany
Device: Kobo H20, iPhone 6+, Macbook Pro
Quote:
Originally Posted by DiapDealer View Post
I believe Dreamweaver's search & replace tool is (at least partly) based on a parsing engine that knows which closing tag goes with what opening tag... and would handle it correctly.
I believe it too.
In all the years of using the S&R interface of Dreamweaver it never fails in the mode "search specific elements".
I would love such a feature in Sigil.

And I would love to see an regex interface in Sigil, which allows to perform multiple regex rules in a kind of "batch" process - in combination of a system to save complete rules, where the user could pick the rules he needs.

My mostly missed feature in Sigil in that context is a html analysis tool.
It should list all "occurences" of html elements with its relevant attributes. Than a user has a perfect overview about all the cleaning work which has to be done.

p class="h1"
p class="blank"
p
h2 id="..."
img width="100%"
span class="italics"
...
ibu is offline   Reply With Quote
Advert
Old 09-13-2013, 03:29 PM   #33
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by ibu View Post
And I would love to see an regex interface in Sigil, which allows to perform multiple regex rules in a kind of "batch" process - in combination of a system to save complete rules, where the user could pick the rules he needs.
That feature already exists. You can automatically run multiple search & replace actions with Saved Searches.
Doitsu is offline   Reply With Quote
Old 09-13-2013, 03:57 PM   #34
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
To be clear: I still think Regex offers the most flexible solution for S&R for end-users. While a parsing S&R engine might be able to handle difficult, nested html better/easier, it's going to be limited to canned (even if slightly customizeable) scenarios by it's very nature. Want a new, highly specialized type of (x)html/xml-smart S&R?... wait for it to be added by the developers in the next version. Want some help with a multi-step regex solution to a particular problem?... ask for help on the forums and try the suggestions out immediately (and maybe pick up a thing or two along the way).

But I think it all just boils down to time and availability. If there was an open-source, highly intelligent, easily customizeable, (x)html-aware, drop-in S&R engine out there... I'm pretty sure it would already be a part of Sigil. And since I'm pretty sure there's not such a plug-n-play beast, it would seem to me that creating such a thing might actually be a bigger undertaking than Sigil itself. So I'm going to continue to use the "Open with" feature if I need to use any kind of complex parsing/editing that I can't get Sigil to do itself.
DiapDealer is offline   Reply With Quote
Old 09-13-2013, 04:05 PM   #35
ibu
Addict
ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.
 
Posts: 264
Karma: 9246
Join Date: Feb 2010
Location: Berlin, Germany
Device: Kobo H20, iPhone 6+, Macbook Pro
Quote:
Originally Posted by Doitsu View Post
That feature already exists. You can automatically run multiple search & replace actions with Saved Searches.
OK, I will have to reveal how to start more than one action at once. In the user guide such a function is not mentioned.
ibu is offline   Reply With Quote
Advert
Old 09-13-2013, 04:16 PM   #36
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by ibu View Post
OK, I will have to reveal how to start more than one action at once. In the user guide such a function is not mentioned.
Actually, it's mentioned under Group Searches in the online help topic that I linked to (which is a part of the 0.7.2 User Guide):

Quote:
Group Searches

You can actually run a group of searches. Each search will be run sequentially.

Simply select a group name and then, for example, run Count All. Or select several non-group entries and run, for example, Replace All.
Doitsu is offline   Reply With Quote
Old 09-13-2013, 04:23 PM   #37
ibu
Addict
ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.
 
Posts: 264
Karma: 9246
Join Date: Feb 2010
Location: Berlin, Germany
Device: Kobo H20, iPhone 6+, Macbook Pro
@Doitsu
Thanks for the hint.
My mistake: I only tried "Find" in version 0.7.3. Than a group search doesn't work. With "Count all" it does.

Edit:
I submitted a bug report:
https://code.google.com/p/sigil/issu...&ts=1379228105

Last edited by ibu; 09-15-2013 at 02:56 AM.
ibu is offline   Reply With Quote
Old 09-16-2013, 08:48 AM   #38
ibu
Addict
ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.
 
Posts: 264
Karma: 9246
Join Date: Feb 2010
Location: Berlin, Germany
Device: Kobo H20, iPhone 6+, Macbook Pro
Quote:
Originally Posted by ibu View Post

My mostly missed feature in Sigil in that context is a html analysis tool.
It should list all "occurences" of html elements with its relevant attributes. Than a user has a perfect overview about all the cleaning work which has to be done.

p class="h1"
p class="blank"
p
h2 id="..."
img width="100%"
span class="italics"
...
Today I found a python script, written by an author of the renowned computer magazine c't, which seems to do exactly what I meant.

"Seems", because I've not the knowledge (I'm not a programmer) how to apply such a script to test it.

The script could be find here:
ftp://ftp.heise.de/pub/ct/listings/1319-136.zip

May be someone likes my idea for such a functionality inside Sigil.

I'm sure, that the author of the script would give his permission to integrate his script into Sigils code, if he's asked.
His mail address could be find on the top of the listing.





Script:
ibu is offline   Reply With Quote
Old 09-16-2013, 09:31 AM   #39
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by ibu View Post
May be someone likes my idea for such a functionality inside Sigil.
AFAIK, this functionality already exists:

Tools > Reports... > Style Classes in HTML files/Style Classes in CSS files
Doitsu is offline   Reply With Quote
Old 09-16-2013, 09:45 AM   #40
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
Also... check out the Sigil Plugins! thread for ideas about "incorporating" external script functionality via the "Open with" feature of Sigil.

The process may be a tad unweildy for those having little experience with terminals, batch/bash scripts, and scripting languages (like python) in general. But it's still beats waiting for "official" functionality that may never come (that's not meant disparagingly towards Sigil in any way).

https://www.mobileread.com/forums/sho...d.php?t=219835
DiapDealer is offline   Reply With Quote
Old 09-16-2013, 10:11 AM   #41
ibu
Addict
ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.
 
Posts: 264
Karma: 9246
Join Date: Feb 2010
Location: Berlin, Germany
Device: Kobo H20, iPhone 6+, Macbook Pro
@Doitsu

This report lists only elements with classes.

For a complete analysis a list of all used elements is neccessary.

Elements without any attributes like e.g. <i>.

Elements with id attributes like e.g. <div id="foo32">

Elements with attributes which are missused for styling like e.g. <div width="100%">

...

The purpose:
The editor should not forget any element "appearance", which can be "normalized", "cleaned", ...
ibu is offline   Reply With Quote
Old 10-21-2013, 08:03 PM   #42
automa
Zealot
automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.
 
automa's Avatar
 
Posts: 110
Karma: 972092
Join Date: Jan 2012
Device: iPhone
Quote:
Originally Posted by theducks View Post
Just use a consistent entry (template) format

eg Heading 3 followed by a Heading 4

<h3> Chapter n
<h4> The chapter title

Then a Search and replace

to turn the 2 into a single with styling


Code:
 replace:
<h3 class="chapter">Chapter  \1 <br class="ctspace" /> <span class="cst">\2<\span><\h3>
the:
.chapter CSS sets the basics of the chapter number
.ctspace sets the spacing between the 2 lines (if inherited is not acceptable)
.cst controls the chapter title

Because you used a BR, the toc (NCX) will use both


In some cases, you might want a different treatment

<h3 title="create your replace template here" > And Leave the original heading text intact
In this case, what code do you use for find field?
automa is offline   Reply With Quote
Old 10-21-2013, 08:20 PM   #43
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
Quote:
Originally Posted by automa View Post
In this case, what code do you use for find field?
Based on examples given in this thread alone, what would you guess it might be? I mean, if you had to just ... for kicks and giggles. Can you at least give it a shot?

Last edited by DiapDealer; 10-21-2013 at 08:23 PM.
DiapDealer is offline   Reply With Quote
Old 10-21-2013, 08:57 PM   #44
automa
Zealot
automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.automa ought to be getting tired of karma fortunes by now.
 
automa's Avatar
 
Posts: 110
Karma: 972092
Join Date: Jan 2012
Device: iPhone
Maybe this one?
Quote:
Code:
<p([^>]+)>(.*?)Chapter(.*?)</p>
automa is offline   Reply With Quote
Old 10-21-2013, 09:20 PM   #45
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
Quote:
Originally Posted by automa View Post
Maybe this one?
Looks familiar.

Seriously, though ... try. Show us what you've tried that isn't working the way you think it should. People will be more than happy to help. But this popping in every couple of weeks (to your own personal thread) to get handed the specific answers to problems you clearly have no intentions of ever learning how to fix yourself (not even the basics) and then disappearing again until the next problem arises is getting a little old.

How is it that someone who can't be troubled to learn any regex at all, so often finds themselves in situations where they need a complex regex solution?

Take part ... don't just take.
DiapDealer is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sigil 0.5.3: Remarks on search function DrChiper Sigil 8 10-12-2012 01:43 PM
Is it possible to turn off all automation in Sigil? Iznogood Sigil 7 06-13-2012 04:05 AM
Sigil Save As... Fabe Sigil 5 01-20-2012 08:55 PM
0.7.1 Save to Disc function fixed? grizedale Calibre 9 06-07-2010 04:49 PM
Save to Disk Function Lady Fitzgerald Calibre 8 06-07-2010 10:06 AM


All times are GMT -4. The time now is 01:18 PM.


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