Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 03-12-2015, 04:09 PM   #16
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
That is cli 101.

Just link to http://tldp.org/LDP/abs/html

Last edited by eschwartz; 03-12-2015 at 04:13 PM.
eschwartz is offline   Reply With Quote
Old 03-12-2015, 04:33 PM   #17
EbokJunkie
Addict
EbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blue
 
Posts: 230
Karma: 13495
Join Date: Feb 2009
Location: SoCal
Device: Kindle 3, Kindle PW, Pocketbook 301+, Pocketbook Touch, Sony 950, 350
Thanks, but that was not obvious. In the same command line other quotes, external to javascript code, do not need escaping.
EbokJunkie is offline   Reply With Quote
Advert
Old 03-12-2015, 04:40 PM   #18
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Again, that is because of standard bash escaping rules -- calibre has no need to include a bash scripting guide in the cli docs. People using the cli should know these rules beforehand.

The question here was not "how do I use ebook-convert" it was "how do I pass a parameter in bash when it contains quotes". Thus -- it is not an appropriate topic for the calibre manual (though links to bash tutorials may be).
eschwartz is offline   Reply With Quote
Old 03-12-2015, 04:46 PM   #19
EbokJunkie
Addict
EbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blue
 
Posts: 230
Karma: 13495
Join Date: Feb 2009
Location: SoCal
Device: Kindle 3, Kindle PW, Pocketbook 301+, Pocketbook Touch, Sony 950, 350
Hmm, this is cli in windows, not linux. I never used javascript in my rather long life :-)
How could I even figure out that bash is in paly here?
How could I figure out that parameter contains quotes, not limited by quotes?
Hint in documentation would do no harm.
BTW, same "unescaped" quotes work perfectly well in Calibre GUI.

Last edited by EbokJunkie; 03-12-2015 at 04:51 PM.
EbokJunkie is offline   Reply With Quote
Old 03-12-2015, 04:56 PM   #20
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Sorry, I saw you use "ebook-convert" not "ebook-convert.exe" and jumped to a conclusion.

I am sure windows batch has similar rules for escaping though.

calibre GUI does not pass strings through any sort of command shell, everything is handled safely through the backend... so naturally it need not be escaped.


When people use the cli to create solutions it is usually assumed they already know the ins and outs of scripting. Either way, regardless of the specific shell used, no program should include scripting guides, there are already far better resources out there.

Questions are of course welcome. (Here or on any one of a number of general programming/scripting help sites e.g. http://superuser.com and sister sites.)
eschwartz is offline   Reply With Quote
Advert
Old 03-12-2015, 05:15 PM   #21
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,637
Karma: 29710510
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Maybe we need a sticky thread - Calibre scripting tips and tricks.

IMO the calibre manual is deficient when it comes to examples. Most people who read books are not syprogs, sysadms or softineers - any more than most listeners to music are composers, songwriters or trombone players

BR
BetterRed is offline   Reply With Quote
Old 03-12-2015, 05:21 PM   #22
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
True, but most of them also don't use the cli.

However, far be it from me to stop you from creating a thread.
So, what are you going to put in it?
eschwartz is offline   Reply With Quote
Old 03-12-2015, 06:52 PM   #23
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,637
Karma: 29710510
Join Date: Mar 2012
Location: Sydney Australia
Device: none
I can't recall ever creating a script for calibre that I've regretted throwing away. I usually create scripts on the desktop and I sweep the desktop clean at least once a day.

If EbokJunkie wants to make a thread with his script attached I'll use it to kickoff a sticky thread - a'la the one for templates etc.

BR
BetterRed is offline   Reply With Quote
Old 03-12-2015, 08:12 PM   #24
EbokJunkie
Addict
EbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blue
 
Posts: 230
Karma: 13495
Join Date: Feb 2009
Location: SoCal
Device: Kindle 3, Kindle PW, Pocketbook 301+, Pocketbook Touch, Sony 950, 350
Will experiment with the CLI script that removes headers at the first chapter page (based on Kovid's suggestions). If it succeeds will add it to my standard Windows batch converting ePub to pdf. Than we'll see

Last edited by EbokJunkie; 03-12-2015 at 08:17 PM.
EbokJunkie is offline   Reply With Quote
Old 03-19-2015, 03:22 AM   #25
EbokJunkie
Addict
EbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blueEbokJunkie can differentiate black from dark navy blue
 
Posts: 230
Karma: 13495
Join Date: Feb 2009
Location: SoCal
Device: Kindle 3, Kindle PW, Pocketbook 301+, Pocketbook Touch, Sony 950, 350
The following script (based on Kovid's suggestion of testing chapter title presence on screen) works as expected in command line:
Code:
<script>
function IsChapter(){
	chapter = document.getElementsByClassName(\"h2a\");
	var nc = chapter.length; 
	while(nc--){
	    var br = chapter[nc].getBoundingClientRect();
	    var on_current_page = br.left + 20 > window.pageXOffset && br.right - 20 < window.pageXOffset + window.innerWidth; 
	    if (on_current_page==true) {
		document.getElementById(\"header\").style.display = \"none\";
	    }
        }
}
IsChapter()
</script>
In my example html class name for all chapter titles was "h2a".
User must dig out and substitute book specific class name for "h2a".
Header template id name must be "header".

Example of simple header template combined with javascript code (valid for CLI):

Code:
   --pdf-header-template "<div id="header" style="font-size:x-small"><p style="text-align:right"><span class="even_page">_AUTHOR_</span><span class="odd_page"><i>_TITLE_</i></span></p></div><script>function IsChapter(){chapter = document.getElementsByClassName(\"h2a\");var nc = chapter.length; while(nc--){    var br = chapter[nc].getBoundingClientRect();var on_current_page = br.left + 20 > window.pageXOffset && br.right - 20 < window.pageXOffset + window.innerWidth; if (on_current_page==true) {document.getElementById(\"header\").style.display = \"none\";}}}IsChapter();</script>"

Last edited by EbokJunkie; 03-19-2015 at 02:08 PM.
EbokJunkie is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multi-Core Conversion support? evandy Calibre 5 09-18-2015 10:49 AM
KF8 conversion and support in Calibre? Rhialto Conversion 19 01-16-2012 05:45 PM
PDF to PDF conversion creates much larger file? rocketcat Conversion 11 09-30-2011 07:37 PM
when will calibre support vector graphics in pdf to epub conversion smith9 Calibre 5 11-13-2010 05:03 AM
Any chance for chm to epub/mobi/pdf conversion support joblack Calibre 4 11-02-2010 01:06 AM


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


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