![]() |
#16 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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)
|
Last edited by eschwartz; 03-12-2015 at 04:13 PM. |
![]() |
![]() |
![]() |
#17 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.
|
![]() |
![]() |
Advert | |
|
![]() |
#18 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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). |
![]() |
![]() |
![]() |
#19 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
#20 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.) |
![]() |
![]() |
Advert | |
|
![]() |
#21 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
![]() |
#22 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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? |
![]() |
![]() |
![]() |
#23 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
![]() |
#24 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
#25 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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> 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. |
![]() |
![]() |
![]() |
|
![]() |
||||
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 |