Quote:
Originally Posted by Jade Aislin
I was not aware of the order of precedence. If I am understanding this right, I should use replace_metadata in [defaults](Would there be a reason to use add_to_metadata there?). Then if I don't want one of the lower sections to overwrite that, I use add_to_replace_metadata.
...
I'm trying to transfer my code into the default personal ini to reduce the clutter I seem to have from different tweaks, so I'm not sure where I placed the replace_metadata at the moment as I moved it a few times. But I can try placing the ',=>\s' in [overrides] and see what happens.
|
I can really only give you generalities because I've no idea what rules you're using--I just assume by now it's a HUGE rule set.
If you truly can get all the rules you want for all the sites you read into one set of replace_metadata rules, then [defaults] is the best place for them, IMO.
The precedence order exists for those cases when you can't or don't want all your rules the same. For example, when you want different rules for different sites.
Let's assume for the moment epub and not other formats from the same personal.ini. That simplifies the precedence order to:
- [defaults]
- [test1.com]
- [overrides]
The idea that overrides config values replace test1.com config values which replace defaults config values is pretty simple and I assume you get that. I confess that add_to_ can be a bit more confusing.
Here's a little demo I used to remind myself of how it works. It uses the title label because that is simple to see and generally doesn't show up very much (logpage only, really).
Spoiler:
Code:
# initial value set from defaults.ini
[defaults]
title_label: Title
# from personal.ini
[defaults]
add_to_title_label:,defaults
[test1.com]
add_to_title_label:,test1.com
add_to_titlepage_entries: ,title
[overrides]
add_to_title_label:,overrides
After generating test1.com?sid=2 for example, at the end of it's title page is:
Title,defaults,test1.com,overrides: Test Story Title 2
See how each add_to_title_label was added in order?
Additions go on regardless of which level the 'base' value is set from.
Code:
# initial value from defaults.ini
[defaults]
title_label: Title
# from personal.ini
[defaults]
add_to_title_label:,defaults
[test1.com]
# replaces defaults value:
title_label:Test1Title
add_to_title_label:,test1.com
add_to_titlepage_entries: ,title
[overrides]
add_to_title_label:,overrides
...yields:
Test1Title,defaults,test1.com,overrides: Test Story Title 2