Skip to content

Commit 8d05638

Browse files
committed
Add another inheritance feature
1 parent 672d145 commit 8d05638

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

Users/toml_config.rst

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,50 @@ The same in coafile format appears as
182182
p = 5
183183
q = 6
184184
185+
Sometimes during multiple inheritance you may want to specify
186+
what key you want to inherit from what section. For that
187+
you can use `appends.parent_section` as a key.
188+
189+
For example
190+
191+
.. code::
192+
193+
[section1]
194+
colors = 'red'
195+
fruits = 'grapes'
196+
197+
[section2]
198+
colors = 'green'
199+
fruits = 'orange'
200+
201+
[section3]
202+
inherits = ['section1', 'section2']
203+
appends.section1 = 'color'
204+
appends.section2 = 'fruits'
205+
colors = 'blue'
206+
fruits = 'apple'
207+
208+
The same in coafile format appears as
209+
210+
.. code::
211+
212+
[section1]
213+
colors = red
214+
fruits = grapes
215+
216+
[section2]
217+
colors = green
218+
fruits = orange
219+
220+
[section1.section3]
221+
colors = red, blue
222+
fruits = apple
223+
224+
[section2.section3]
225+
colors = blue
226+
fruits = orange, apple
227+
228+
185229
.. note::
186230

187231
- If you want to append multiple settings then use ``appends`` as a list
@@ -194,7 +238,7 @@ The same in coafile format appears as
194238
inherits = [ 'section1', 'section2']
195239
- You can only inherit sections
196240
- You can only append settings
197-
- If a setting is redefined in the inherited section then it will
241+
- If a setting is redefined in the inherited section then it will
198242
overwritten if appends is not used.
199243

200244
Defining Aspects and Tastes

0 commit comments

Comments
 (0)