Is it possible to have alternate versions of a document managed inside Scrivener?

So, ideally I would like that if a tag was specified for a particular piece of text, I could specify at compile time to include all the text marked with that tag in the document and otherwise not.

So,

Scrivener Text


Now at compile time, I ask the compiler to include everything with tag1… so the final output is

Thanks

Amit

It is possible, provided that you break down the alternating pieces of text in separate documents and then label them differently.

Have a look at the Replacements compile option pane. These are search & replaces that run whenever you compile, and they can be saved into individual compile presets as well, meaning some tags can be excluded sometimes but not always, but all tag markings can be stripped out.

Markings then become text-based tokens—however you wish to do it. If you are good with regular expressions then you should be able to take it from here. If not, try using this simple example (be sure to check off the “RegEx” column):

Replace: {tag1:([^}]*)}
With:

The search pattern looks for “{tag1:” and then starts skipping over text (but storing it for potential future use) until it encounters “}”.{tag1: Hence a tagged line in your text could look like this.} In the example above we replace it with nothing, effectively removing the tag and the tagged text. If we used “$1” as our “With” value, then only “Hence a tagged line in your text could look like this” is printed, without the brackets and tag marker.

If you’d prefer a more visual approach than typing in {tag2:stuff} into your text, then you could make use of inline annotations to essentially insert all of the stuff that isn’t unique to the tag—namely everything but the numeral. The compiler can then be instructed to leave annotations intact, but wrap them in “{tag” and “}”.

A project is attached, demonstrating both techniques in a working example.
tagged_text.zip (42 KB)

Lunk, thank you for your answer but I think I was seeking the kind of answer that AmberV provided. I still need to play with it but that looks like will get me what I want.

Thank you

Amit