MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Sigil (https://www.mobileread.com/forums/forumdisplay.php?f=203)
-   -   templates (https://www.mobileread.com/forums/showthread.php?t=341400)

hobnail 08-24-2021 04:13 PM

templates
 
In my epub folder I have a folder named templates and in that I have my one and only template, template.epub which is what I start with when I'm starting a new conversion cleanup of a PD book. It's a minor inconvenience to have to either navigate to that folder to open it or navigate to it from the open menu.

Sometimes it's in the recently opened files list. I was wondering if there could be a sticky list of files below the recently opened files list where I could put this template.epub file. Files in this list would need to be manually added or removed from the list.

KevinH 08-24-2021 04:30 PM

Probably easier to create an input plugin that is hardcoded to load that epub. It would only be a few lines of code.

Then just click a button to run the plugin and off you go.

Another alternative is to keep an alias or symbolic link of that epub on your Desktop and drag and drop it on Sigil to start Sigil with that epub more easily.

Turtle91 08-25-2021 10:45 AM

There are a couple options that I've used:

1) You can add template files, such as a cover page, into the sigil folder. When you click to add a cover, it will automatically use that template cover.

2) You can create a blank epub with all the files you wish already setup (like your template file), then create a shortcut to that file. Use the shortcut to open Sigil, then "Save As" to give it a new name without changing the template.

Doitsu 08-27-2021 01:36 PM

Quote:

Originally Posted by hobnail (Post 4148926)
I was wondering if there could be a sticky list of files below the recently opened files list where I could put this template.epub file. Files in this list would need to be manually added or removed from the list.

You might find my simple EpubTemplate plugin helpful.

Tex2002ans 08-27-2021 05:18 PM

Quote:

Originally Posted by Doitsu (Post 4149624)
You might find my simple EpubTemplate plugin helpful.

:thumbsup:

Or what I do is have a "template folder" that I always import.

It has all my usual files in there:

- template.css
- tempcover.jpg
- titlepage.xhtml
- copyright.xhtml
- [...]
- backmatter.xhtml

Then I just do a Right-Click + Add Existing Files.

This (+ other people's methods) was discussed back in:

2018: "UUID basics & template"

I personally don't like the "same base EPUB every time" idea, since the UUID will be the same, but there are ways around this. (See the thread for more details!)

hobnail 08-28-2021 02:16 PM

Quote:

Originally Posted by Tex2002ans (Post 4149678)
This (+ other people's methods) was discussed back in:

2018: "UUID basics & template"

I personally don't like the "same base EPUB every time" idea, since the UUID will be the same, but there are ways around this. (See the thread for more details!)

Interesting thread; thanks. I think what I'm going to do is use the same template.epub file but I'll delete its
Code:

dc:identifier id="BookId"
line from the content.opf file since I always (usually) run the EpubCheck plugin when I'm done and it will complain if there's no line for that so then I'll fire up a new sigil and copy the one from that and paste it into the one I've just finished.

What happens if I forget to run the EpubCheck plugin? What blows up when that line is missing? I.e., if I upload it here or read it on my kobo.

Turtle91 08-28-2021 06:49 PM

Some programs use the ID in their identification process. If you have two numbers that are the same they could cause a conflict. At one point I had a problem with Calibre thinking different books were actually the same and not filing them correctly. I haven't had this problem in quite some time, but I don't know if it's because Calibre fixed the issue, or I just don't use the same ID anymore.

I think Sigil will automatically correct that line if it is missing???

BetterRed 08-28-2021 07:33 PM

FWIW - I have Sigil pinned to the taskbar, and to that I have pinned two template epubs.

When I remember that's how I load a template.

That's on Windows 10.

BR

Tex2002ans 08-28-2021 09:01 PM

Quote:

Originally Posted by hobnail (Post 4149839)
What happens if I forget to run the EpubCheck plugin? What blows up when that line is missing? I.e., if I upload it here or read it on my kobo.

The unique-identifier is mandatory in EPUB.

Not too sure what happens on readers when it's missing. But its main uses are:
  • Font Obfuscation
  • Telling a file is unique.
    • On some devices.
    • Let's say you stick a 2nd EPUB with the same UUID onto your reader, the device may scan and say: "Nope, no new book here."
  • Store Notes/Highlights
    • On some devices.
    • On my old Nook, in an EPUB with matching UUID, the Notes/Highlights would carry over, being completely mangled since text/locations wouldn't match.

For more detail, also see:

2019: "@DiapDealer ISBN vs UUID"

Side Note: And I may be going cookoo, but didn't I remember a Sigil plugin made to randomly generate a new UUID? (Or was this just mentioned in passing?)

Side Note #2: Also see the EPUB spec on unique-identifier.

Quote:

Originally Posted by hobnail (Post 4149839)
I think what I'm going to do is use the same template.epub file [...] then I'll fire up a new sigil and copy the one from that and paste it into the one I've just finished.

Yep. That's similar to what I do when I accidentally used the wrong file as my base.

Sigil, fresh EPUB, then go digging into the blank EPUB's UUID and carefully swap lines over.

(See thread above for more details on how to manually adjust UUID.)

Quote:

Originally Posted by Turtle91 (Post 4149875)
I think Sigil will automatically correct that line if it is missing???

No. I don't believe so.

I just tested in Sigil 1.7.0 + 0.9.14.

I deleted the lines (in content.opf + toc.ncx), saved the EPUB, reopened, saved again, and the UUID lines continued to be missing.

KevinH 09-02-2021 12:48 PM

Would a TemplateEpub3 input plugin (and of course a matching TemplateEpub2 plugin) that does the following help:

1. Looks in your Sigil Prefs folder for a "template3" folder that holds an unzipped epub of your choice (ditto for "template2") with any files you want of any type.
The only caveat is none of the font files (if any are even present in the template) can be obfuscated inside the template3 folder.

2. If it exists, it creates a proper uuid bookid for the opf (and ncx if it exists) and then zips it up to create an epub that is loaded into Sigil

If it does not exist, it could either prompt for a temporary path or quietly exit as failed, your choice.

The goal is that once the template3 has been created and the Template3 plugin has been loaded and assigned an icon, then loading your template after starting Sigil is just a single icon click and no further user interaction required.

You can also easily change any of the files inside the template3 folder at any time using Sigil and the FolderIn and FolderOut plugins or even by drag and drop.

Would something like that help?

Turtle91 09-02-2021 01:45 PM

Would this be in addition to, or replacement of, the functionality of a default cover page (using add cover)??

I think it would be a good thing!

KevinH 09-02-2021 03:13 PM

This would be a Sigil plugin. You would need to download and install it just like any other plugin. It would not replace anything.

hobnail 09-02-2021 04:17 PM

Quote:

Originally Posted by KevinH (Post 4151168)
Would a TemplateEpub3 input plugin (and of course a matching TemplateEpub2 plugin) that does the following help:

1. Looks in your Sigil Prefs folder for a "template3" folder that holds an unzipped epub of your choice (ditto for "template2") with any files you want of any type.
The only caveat is none of the font files (if any are even present in the template) can be obfuscated inside the template3 folder.

2. If it exists, it creates a proper uuid bookid for the opf (and ncx if it exists) and then zips it up to create an epub that is loaded into Sigil

If it does not exist, it could either prompt for a temporary path or quietly exit as failed, your choice.

The goal is that once the template3 has been created and the Template3 plugin has been loaded and assigned an icon, then loading your template after starting Sigil is just a single icon click and no further user interaction required.

You can also easily change any of the files inside the template3 folder at any time using Sigil and the FolderIn and FolderOut plugins or even by drag and drop.

Would something like that help?

Yes, that sounds like it would fit the bill. Thanks.

KevinH 09-02-2021 04:23 PM

Quote:

Originally Posted by hobnail (Post 4151224)
Yes, that sounds like it would fit the bill. Thanks.

Okay, I will put something like that together for you to try.

KevinH 09-03-2021 02:00 PM

New Plugins for testing
 
2 Attachment(s)
Okay, I have quickly thrown together two plugins:

Template3_v010.zip
It is an input plugin to load an unzipped epub3 from a folder in Sigil Preferences folder called "template3". It will create and use new unique-identifiers using uuids and update both the OPF and any existing NCX


Template2_v010.zip
It is an input plugin to load an unzipped epub2 from a folder in Sigil Preferences folder called "template2". It will create and use new unique-identifiers using uuids and update both the OPF and any existing NCX

I have attached both plugins.

I have also made an additional change to Sigil's source code that will appear in Sigil 1.8, that if you use an input plugin and your currently loaded book in Sigil has NOT been modified, it will go ahead and load the new epub without prompting to proceed since that is the whole point of an input plugin to begin with.

See the attachments for the plugins. They have not undergone much testing so any feedback on them welcome.

Also any contributions of plugin.svg or plugin.icon files for either or both would be welcome!!

Hope this helps.

BeckyEbook 09-03-2021 05:02 PM

2 Attachment(s)
Quote:

Originally Posted by KevinH (Post 4151435)
Also any contributions of plugin.svg or plugin.icon files for either or both would be welcome!!

I just suggest alternate color versions of the files for the new epub2 and epub3.
The red color also informs that it is not "Blank EPUB2/3 file", but "Template for EPUB2/3 file".

KevinH 09-04-2021 12:38 AM

Thanks BeckyEbook!

hobnail 09-05-2021 10:08 PM

Quote:

Originally Posted by KevinH (Post 4151435)
Okay, I have quickly thrown together two plugins:

Template3_v010.zip
It is an input plugin to load an unzipped epub3 from a folder in Sigil Preferences folder called "template3". It will create and use new unique-identifiers using uuids and update both the OPF and any existing NCX


Template2_v010.zip
It is an input plugin to load an unzipped epub2 from a folder in Sigil Preferences folder called "template2". It will create and use new unique-identifiers using uuids and update both the OPF and any existing NCX

I have attached both plugins.

I have also made an additional change to Sigil's source code that will appear in Sigil 1.8, that if you use an input plugin and your currently loaded book in Sigil has NOT been modified, it will go ahead and load the new epub without prompting to proceed since that is the whole point of an input plugin to begin with.

See the attachments for the plugins. They have not undergone much testing so any feedback on them welcome.

Also any contributions of plugin.svg or plugin.icon files for either or both would be welcome!!

Hope this helps.

Finally got to try it; works perfectly. Thanks.

KevinH 09-05-2021 10:21 PM

Glad to hear it. I will add in BeckyEbook's icons and then create a thread for both and add them to the plugin index. Thanks for testing and feedback.

KevinH

KevinH 09-13-2021 11:30 AM

Okay, I have added in BeckyEbook's icons and produced Template2_v020.zip and Template3_v020.zip and added a thread for them to Sigil's Plugins forum and added them to Sigil's Plugin Index Thread.

They can be found here:

https://www.mobileread.com/forums/sh...d.php?t=341735


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

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