|
cfgSectionReaderread entries of INI-File like [section] DescriptioncfgSectionReader reads all the entries of exactly one specified section. It needs to be called by another macro. In case of section = "[execute]", the entries are considered of being macros that are executed immediately. The other entries are treated like pairs of keys and values and are stored in Local Variables where the variable name (key) can be prefixed by a configurable string value.
UsageWhile processing the keys of a section, any leading and trailing whitespaces are discarded from the values. Local Variables are explicitly released, if the value of the corresponding key is empty. This mechanism can be used to reset already existing Local Variables (that have come alive by a former call to cfgSectionReader). Used Named Registers (local variables)
ExampleSuppose you have the following configuration settings in file DocBkMode.cfg: [paths] you can access the key/value pairs with the following macro: ReadFile("%b\Config\docbk\DocBkMode.cfg",0); Assign("cfgFileContent","%!0"); Assign("cfgSection","paths"); Exe("%B\Macros\macro\cfgSectionReader.edt"); Assign("cfgSection","classpath"); Assign("SectionReaderPrefix","CP"); Exe("%B\Macros\macro\cfgSectionReader.edt");which delivers the following items as Local Variables:
As you may notice, all Local Variables are expanded automatically and the keys "saxon" and "xalan" got their prefix "CP" . Installation InstructionsPut the macro in the folder %B\Macros\macro\. DownloadMacro contributed by Georges Schmitz <georges.schmitz
|