MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Sigil (https://www.mobileread.com/forums/forumdisplay.php?f=203)
-   -   Starting Sigil with Args - feature request (https://www.mobileread.com/forums/showthread.php?t=219364)

Perkin 08-04-2013 01:53 AM

Starting Sigil with Args - feature request
 
As it stands at moment, if I run Sigil with an arg of an epub or html file, it opens or imports it.

What I'd like to suggest to add is that if there's any extra args that are html, font, css or image files then they get added as well.

I know we can add them from in Sigil, but would be handy to have them already 'in' there.

What do you guys/gals think?

theducks 08-04-2013 10:43 AM

@Perkin
:thumbsdow

I am in the group that hates doing things like that (changes via CLI) wearing blinders.

I like having to stare at what I am about to make changes to before they get done. I have been known to (more frequent than I like) select the wrong file(s) :o

There are other tricks for a quick load.
:bulb2: Place all fonts to be used into a folder along with the a (matching @fonts)stylesheet., When you use 'Add Existing', just select All in that folder.
Wham Bang they are done.
select (X)HTML files in the book: right-click; Link stylesheets select all stylesheets that will be used in those file (note that any existing stylesheet links will be deleted in those files).

Perkin 08-04-2013 04:53 PM

Quote:

Originally Posted by theducks (Post 2585846)
There are other tricks for a quick load.
:bulb2: Place all fonts to be used into a folder along with the a (matching @fonts)stylesheet., When you use 'Add Existing', just select All in that folder.
Wham Bang they are done.
select (X)HTML files in the book: right-click; Link stylesheets select all stylesheets that will be used in those file (note that any existing stylesheet links will be deleted in those files).

That's pretty much what I do at the moment.

Just thought it might be nice to automate some of it.

DiapDealer 08-04-2013 06:17 PM

Correct me if I'm wrong, but with the exception of fonts... Sigil will automatically include the rest of that stuff (styles, images) if it's correctly linked in the html (and the style and image files are in the correct path relative to the location of the html) file being passed to Sigil as an argument.

I just tested:
"C:\Program Files\Sigil\sigil.exe" test.xhtml

... and when Sigil opened, it had pulled in any and all css files and images that were referenced in test.xhtml.

Or were you referring to something else?

EDIT: Now that you mention it, though... it would be sorta cool if you could feed Sigil an OPF file and then it would be able to pull all the rest of the files together from that. Mind you; I'm not trying to create work for anyone. Just wish-listing a bit. ;)

Turtle91 08-04-2013 09:48 PM

Hmmm...

A quick script to open sigil while auto adding each individual html file in my 1000+ book library and auto save it as an .epub. Then I can open up the epub's to edit. That would save a BUNCH of work!

"C:\Program Files\Sigil\sigil.exe" /add-"filename.xhtml" /save-"filename.epub"


[edit] or even better:

"C:\Program Files\Sigil\sigil.exe" /add-"filename.xhtml","filename2.xhtml","font1.ttf","font2.ttf" /save-"filename.epub"

Jellby 08-05-2013 04:19 AM

I think what Perkin wants is launching Sigil like this:

Code:

sigil Chapter-1.html Chapter-2.html Chapter-3.html
and having all three files open (plus all linked CSS, images and font files, this is already done according to DiapDealer). That would indeed be useful in some cases.

Perkin 08-05-2013 08:58 AM

I know Sigil imports any linked css, images, html files that are linked/referenced from a html import file. It currently doesn't add the fonts.

The main addition would be to add any font files that are args, any extras (html, images, css) could be done by adding a dummy.html file, which includes those other files. Then run Sigil with

sigil mainfile.html dummy.html font1 font2 font3 font4 font5

Sigil would then open the 'mainfile', and import as usual (adding css, html, images), then add 'dummy.html' (and any referenced css, html and images), then add the font# files.

You would then just need to delete the 'dummy.html' file in the 'Book Browser' pane, and you'd then have all the extra css, html, images AND fonts included, so you can then finalise editing.

Perkin 08-05-2013 10:58 AM

Just found a workaround for having fonts included in the import.

if I have in the imported html file
Code:

<div class="hidden"><img alt="" src="Fonts/CharisSILI.ttf"/></div>
with the 'hidden' class as
Code:

.hidden {display:none;}
Then the font is included in the import and put in the Fonts folder.
You can then delete those lines from the imported file, or as they are hidden (in Sigil preview pane & calibre viewer), you could leave them.

Edit:
You need to delete those lines, as the epub will not validate with them in. - thanks @Jellby

You could also use inline style as:
Code:

<div style="display:none;"><img alt="" src="Fonts/CharisSILI.ttf"/></div>
Edit:
Found you could also just have
Code:

<img style="display:none;" alt="" src="Fonts/CharisSILI.ttf"/>

Jellby 08-05-2013 11:42 AM

Does that validate? If it doesn't, you can leave out the alt="" anyway :D

Perkin 08-05-2013 11:57 AM

@Jellby, you're correct, it doesn't validate, IF you leave the lines in the html file, but if you remove them then it does.

Perkin 08-05-2013 12:17 PM

Quote:

Originally Posted by Turtle91 (Post 2586248)
[edit] or even better:

"C:\Program Files\Sigil\sigil.exe" /add-"filename.xhtml","filename2.xhtml","font1.ttf","font2.ttf" /save-"filename.epub"

That's pretty much what I'm suggesting.


All times are GMT -4. The time now is 08:10 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.