From: Clark C . E. <cc...@cl...> - 2002-03-07 04:41:29
|
| - !include file://home/ingy/foo.yaml Overall, I don't see !include as a type as much as I see it as a filter that gets applied. That said, the "include" filter could just scan for leaves having the filter type. And then replace itself with the content of the document. The default yaml parser could have the "include" filter built-in, but there should be some way to escape it. | 1) Since a file (stream) may contain several documents, the loader | should load them as a sequence. IMHO, include without a #fragment should assume only one document (it being an error if the target has more than one document). And it should load the content of the document as is (no conversion to a sequence). For those cases where there are multiple documents in the target such that conversion to a sequence is desierable, then a fragment should be provided enclosed in brackets, like {1,3-4}. To get fancy the wildcard, {*}, could be used to let the filter know that one or more documents are expected. | 2) If a particular document/douments is desired you can specify | it/them like: | | - !include file://home/ingy/foo.yaml#1 | - !include file://home/ingy/foo.yaml#2,5-7 Neat. Keep in mind that we'd like to extend this further in the future to enable a particular node in the document to be selected. file://home/ingy/foo.yaml#{1/key/3;5-7} So, perhaps this extracts the fourth sequence entry from the "key" entry in the first document of the "foo.yaml" file, followed by all of document 5, 6, and 7. Just playing, Clark |