Inherit project templates?

User avatar
ScrivTrex
Posts: 151
Joined: Thu Jan 04, 2018 9:37 am
Platform: Windows

Mon Nov 16, 2020 10:30 pm Post

Is it possible to inherit project templates with the current beta version? Something similar to how inheritance works with OOP in supported programming languages.

I want to create a "Developer Blog" project which will contain multiple blog articles. But, over time, it will grow too big to manage, not to mention the performance hit scrivener will take on my PC. So I was thinking maybe breaking it down into smaller manageable projects that represent subset topics of software development. So, the parent template would be the "Developer Blog Template" and the children like, "C# template", "React Template" and so forth. And a deeper hierarchy can be established with these child templates having child subsets of their own, effectively sharing template features. Is this possible?
Last edited by ScrivTrex on Mon Nov 16, 2020 11:06 pm, edited 2 times in total.
I'm a programmer at heart and a heart at programming. :)

Windows 10 Pro 64-bit (1909)
Intel core i7 (920 @2.67GHz)
Nvidia GeForce GTX 560 Ti
Samsung Evo 860 1TB SSD
Western Digital 1TB HDD
24GB RAM
Scrivener 3 for Windows

User avatar
xiamenese
Posts: 4767
Joined: Mon Jan 29, 2007 1:32 am
Platform: Mac
Location: London or Exeter, UK.

Mon Nov 16, 2020 10:35 pm Post

Read up about the <$include:…> placeholder in the v. 3 manual. Will that make it possible for you to do what you want?

:)

Mark
The Scrivenato sometimes known as Mr X.
M1 MacBook Air (2021), 11.2.3, 16GB RAM, !TB SSID
iMac 27" (late 2015) 10.15.7, 24GB RAM, 512GB SSID
2017 iPad, iPadOS 14.4.1, 128GB, Apple Pencil
Scrivener, Scapple, Nisus Writer Pro, Bookends …

User avatar
ScrivTrex
Posts: 151
Joined: Thu Jan 04, 2018 9:37 am
Platform: Windows

Mon Nov 16, 2020 11:02 pm Post

I'm not sure if this will work. Is it possible to implicitly inherit from parent templates?
I'm a programmer at heart and a heart at programming. :)

Windows 10 Pro 64-bit (1909)
Intel core i7 (920 @2.67GHz)
Nvidia GeForce GTX 560 Ti
Samsung Evo 860 1TB SSD
Western Digital 1TB HDD
24GB RAM
Scrivener 3 for Windows

User avatar
devinganger
Posts: 2647
Joined: Sat Nov 06, 2010 1:55 pm
Platform: Mac, Win + iOS
Location: Monroe, WA 98272
Contact:

Mon Nov 16, 2020 11:55 pm Post

ScrivTrex wrote:I'm not sure if this will work. Is it possible to implicitly inherit from parent templates?


No. Templates do not have same relationship to a project that an object class has to an instance of that class. A template is just a pre-set starting point for a new project -- as soon as the project is created, there is no link between the template and the project, and you can immediately modify any and all settings of the project to make it look entirely different.

The easiest way to accomplish what you're talking about is to use one template to create a new project, make the necessary modifications, and then save it as a new "child" template. But if you later make a change to a "parent" template, you'll have to manually push that change back into all your other templates (either manually or by recreating them like you did the first time.) If you want that change to go into all of your existing articles that used those templates, you'll have to manually propagate that change into those articles.

Note that it would probably take you a long, long time to grow a single project to the point where you're having performance issues, especially if you take advantage of image references and don't store any images/screenshots inside of your Scrivener project. Scrivener only loads the component documents that you're actively viewing or editing, so if you structure your project as "one big template" and do it properly, you can avoid situations where Scrivener is having to open hundreds of documents at the same time.
--
Devin L. Ganger
Not a L&L employee; opinions are those of my cat
Life has a way of moving you past wants and hopes -- Kevin Flynn

User avatar
ScrivTrex
Posts: 151
Joined: Thu Jan 04, 2018 9:37 am
Platform: Windows

Tue Nov 17, 2020 12:22 am Post

devinganger wrote:
ScrivTrex wrote:I'm not sure if this will work. Is it possible to implicitly inherit from parent templates?


No. Templates do not have same relationship to a project that an object class has to an instance of that class. A template is just a pre-set starting point for a new project -- as soon as the project is created, there is no link between the template and the project, and you can immediately modify any and all settings of the project to make it look entirely different.

The easiest way to accomplish what you're talking about is to use one template to create a new project, make the necessary modifications, and then save it as a new "child" template. But if you later make a change to a "parent" template, you'll have to manually push that change back into all your other templates (either manually or by recreating them like you did the first time.) If you want that change to go into all of your existing articles that used those templates, you'll have to manually propagate that change into those articles.

Note that it would probably take you a long, long time to grow a single project to the point where you're having performance issues, especially if you take advantage of image references and don't store any images/screenshots inside of your Scrivener project. Scrivener only loads the component documents that you're actively viewing or editing, so if you structure your project as "one big template" and do it properly, you can avoid situations where Scrivener is having to open hundreds of documents at the same time.

Makes sense. Thanks.
I'm a programmer at heart and a heart at programming. :)

Windows 10 Pro 64-bit (1909)
Intel core i7 (920 @2.67GHz)
Nvidia GeForce GTX 560 Ti
Samsung Evo 860 1TB SSD
Western Digital 1TB HDD
24GB RAM
Scrivener 3 for Windows

User avatar
ScrivTrex
Posts: 151
Joined: Thu Jan 04, 2018 9:37 am
Platform: Windows

Tue Nov 24, 2020 1:55 am Post

Is it possible to do what I want with the "sync to folder" feature? I'm not sure the $include placeholder tag serves my purpose, unless I'm overlooking something.
I'm a programmer at heart and a heart at programming. :)

Windows 10 Pro 64-bit (1909)
Intel core i7 (920 @2.67GHz)
Nvidia GeForce GTX 560 Ti
Samsung Evo 860 1TB SSD
Western Digital 1TB HDD
24GB RAM
Scrivener 3 for Windows

User avatar
devinganger
Posts: 2647
Joined: Sat Nov 06, 2010 1:55 pm
Platform: Mac, Win + iOS
Location: Monroe, WA 98272
Contact:

Tue Nov 24, 2020 6:24 am Post

ScrivTrex wrote:Is it possible to do what I want with the "sync to folder" feature? I'm not sure the $include placeholder tag serves my purpose, unless I'm overlooking something.


The intent of the external sync/sync to folder feature is to allow Scrivener to create copies of documents in a flat folder (so it flattens out your Binder structure), suitable for use with external applications and editors. Then, Scrivener tracks that folder for changes and re-imports changed documents back into the project to the corresponding project document.

This allows, for example, people who have Android mobile devices to external sync their project to a folder that is synced to their mobile device by the sync engine of their choice, use Android RTF/text/Markdown editors, and have those edits imported back into their Scrivener project.

Let's come at this from another direction -- what kinds of things do you foresee being different between your various templates?

Also, in case you didn't know, Scrivener has both project templates (which are what I mentioned earlier which provide a starting point for a new project) as well as document templates, which are stored within a project and give you a new X document. For example, if you make a document template that is a character template, every time you introduce a new character, you create a new document for it from the character template, and now you have a blank character questionnaire waiting for you to fill out for that character.

If you're looking for your templates to allow you to include some kind of boilerplate in your documents, and want to change the template and have all the boilerplate for new *and existing* documents change -- that's where you may run into the need for some creative endeavors. Automatically changing existing stuff is the gap in capabilities here -- but that's where using the $include placeholder might work for you. What you can do with this is specify one document as the master copy for boilerplate content, then use $include:name_of_master_copy to insert that into other documents throughout your manuscript. *While you are editing* all you will see is the placeholder. When you compile, however, the content of the master copy will be inserted into the output -- so if you updated the master copy, everywhere it's linked will get the updated content. If your compilation is set up to output everything to, say, HTML files, then all of your old files that used the old content will get overwritten with versions that have the new content.
--
Devin L. Ganger
Not a L&L employee; opinions are those of my cat
Life has a way of moving you past wants and hopes -- Kevin Flynn

Online
User avatar
kewms
Posts: 7442
Joined: Fri Feb 02, 2007 5:22 pm
Platform: Mac

Tue Nov 24, 2020 6:48 am Post

Could you explain what you're trying to do in more detail, please?

If you simply want "a group of articles about C#," "a group of articles about React," and so on, you might want to use different *projects,* but there's no particular reason (as far as you've told us) to use different *templates.* In fact, if you're going to post all of them to the same blog, I would think you would want to define a single "Developer Blog Template" that contains whatever standard stuff you use for all of your articles, and use that for all of the subordinate projects. Maybe change a Compile format here or there, but that's it.

Katherine
Scrivener Support Team

User avatar
ScrivTrex
Posts: 151
Joined: Thu Jan 04, 2018 9:37 am
Platform: Windows

Tue Nov 24, 2020 1:51 pm Post

I'll make it clearer. This is an example of the basic project structures I want to achieve:

Legend:

F = Folder
> = folder child level

Root Blog Template ["Blog"]

F: Draft
F: Research
>--F:Stackoverflow
>--F:Blog Articles
>--F:Youtube Tutorials
F: Outlines
F: Notes
F:Trash

Child Blog Template ["C# Blog"]

F: Draft
>-- F: General Concepts
>-- F: Tutorials
F: Research
F: Outlines
F: Notes
F:Trash

So, when I create a project from the C# Blog Template, it should inherit the folder structure from the Root Blog Template and results in the following:

F: Draft
>-- F: General Concepts
>-- F: Tutorials
F: Research
>--F:Stackoverflow
>--F:Blog Articles
>--F:Youtube Tutorials
F: Outlines
F: Notes
F:Trash

And if I make a change to the structure of the Root Blog Template by adding folders or text documents, the WIP C# Blog project should automatically update to reflect the change the next time I open the project.

How can I achieve this, if possible? I see how $include could help, but it's my understanding that it's only used for injecting text into scrivener documents while compiling, not inject folders or text documents into arbitrary locations in the binder, which I want to achive.
I'm a programmer at heart and a heart at programming. :)

Windows 10 Pro 64-bit (1909)
Intel core i7 (920 @2.67GHz)
Nvidia GeForce GTX 560 Ti
Samsung Evo 860 1TB SSD
Western Digital 1TB HDD
24GB RAM
Scrivener 3 for Windows

User avatar
ScrivTrex
Posts: 151
Joined: Thu Jan 04, 2018 9:37 am
Platform: Windows

Wed Nov 25, 2020 2:02 am Post

From all of the replies and from a little more digging on my end, I guess it won't be possible to accomplish what I want do. I'll just do something similar to what Katherine suggested, creating a single multi-dev-blog project. Thanks.
I'm a programmer at heart and a heart at programming. :)

Windows 10 Pro 64-bit (1909)
Intel core i7 (920 @2.67GHz)
Nvidia GeForce GTX 560 Ti
Samsung Evo 860 1TB SSD
Western Digital 1TB HDD
24GB RAM
Scrivener 3 for Windows