01-01-2019, 03:47 PM | #1 |
Zealot
Posts: 120
Karma: 5276
Join Date: Feb 2013
Device: Asus Zen Pad
|
Can I create a template for the xhtml files?
When writing my book, I create one xhtml file for each chapter. Each chapter has some boilerplate in it such as a formatted date, link to a css stylesheet, a link back to the TOC etc.
I currently have to create all of that stuff in each file after I create the new file. Is there some way I can create a new xhtml file from a template file of my design so that I am not starting from scratch each time? Thanks, Banjo (_)=='=~ |
01-01-2019, 04:09 PM | #2 |
Guru
Posts: 688
Karma: 150000
Join Date: Feb 2010
Device: none
|
I guess if it were me, I'd start with a new epub in sigil, and modify the Section0001.xhtml file to suit, with all the boilerplate you want. Then right click on it in the book browser and chose "save as" and save the file with some generic name like "template.xhtml" in your working directory.
Each time I needed a new file, I would right-click on "Text" in the book browser and choose "add existing files" and pick the "template.xhtml" from wherever I'd saved it. Then rename it something appropriate, like "Chapter002.xhtml, and go from there. HTH Albert |
01-01-2019, 06:59 PM | #3 |
null operator (he/him)
Posts: 20,459
Karma: 26645808
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
|
01-01-2019, 07:52 PM | #4 |
Zealot
Posts: 120
Karma: 5276
Join Date: Feb 2013
Device: Asus Zen Pad
|
Thank you for the suggestion. My concern with it is that after I import a template file and rename it, the actual template file will be renamed. Is that the way it works? If it leaves the original file unchanged then that could work.
WRT the book templates, I can do that with a template eBook that I open and then SaveAs under a different file name. I need a SaveAs for the chapter files instead of a Rename. I suppose I could keep a template file in the directory and make a copy of it outside of Sigil, then import the copy into Sigil. That could work. Thanks for the ideas. Banjo (_)=='=~ |
01-02-2019, 10:54 AM | #5 |
Guru
Posts: 688
Karma: 150000
Join Date: Feb 2010
Device: none
|
Yes, it basically copies the file into the ebook. If you rename it in sigil, you are renaming that copy. Every time you need a new chapter, just re-insert the template.
|
01-02-2019, 11:18 AM | #6 |
Zealot
Posts: 120
Karma: 5276
Join Date: Feb 2013
Device: Asus Zen Pad
|
Thanks. That works fine for me.
|
01-02-2019, 01:14 PM | #7 | |
Grand Sorcerer
Posts: 5,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
|
|
01-02-2019, 03:53 PM | #8 | |
Zealot
Posts: 120
Karma: 5276
Join Date: Feb 2013
Device: Asus Zen Pad
|
Quote:
|
|
01-02-2019, 04:21 PM | #9 | |
null operator (he/him)
Posts: 20,459
Karma: 26645808
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
BR |
|
01-02-2019, 07:37 PM | #10 |
Zealot
Posts: 120
Karma: 5276
Join Date: Feb 2013
Device: Asus Zen Pad
|
I tried it. That's pretty cool. It isn't what I was looking for this time, but it might be useful next time I start a new book.
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Some files.html & toc.xhtml (also Cover.xhtml) | chaot | Workshop | 23 | 02-13-2017 12:20 PM |
How to create a send to device template that works | Pouget | Library Management | 6 | 11-26-2014 11:16 AM |
How would one create an identifier template? | Sidetrack | Library Management | 0 | 06-06-2014 01:38 AM |
Create a template to only list one author. | PMGeuze | Calibre | 2 | 12-04-2013 02:53 PM |
mkepub tool to create epub from xhtml | sethportman | ePub | 0 | 02-03-2012 08:59 AM |