From: Alexandre Terrasa Date: Sat, 15 Jun 2019 18:55:56 +0000 (-0400) Subject: nitiwiki: Update to new INI api X-Git-Url: http://nitlanguage.org nitiwiki: Update to new INI api Signed-off-by: Alexandre Terrasa --- diff --git a/contrib/nitiwiki/src/wiki_base.nit b/contrib/nitiwiki/src/wiki_base.nit index 2e93a74..f1fb6ae 100644 --- a/contrib/nitiwiki/src/wiki_base.nit +++ b/contrib/nitiwiki/src/wiki_base.nit @@ -612,7 +612,13 @@ end # # This class provides services that ensure static typing when accessing the `config.ini` file. class WikiConfig - super ConfigTree + super IniFile + autoinit ini_file + + # Path to this file + var ini_file: String + + init do load_file(ini_file) # Returns the config value at `key` or return `default` if no key was found. protected fun value_or_default(key: String, default: String): String do @@ -779,8 +785,8 @@ class WikiConfig var sidebar_blocks: Array[String] is lazy do var res = new Array[String] if not has_key("wiki.sidebar.blocks") then return res - for val in at("wiki.sidebar.blocks").as(not null).values do - res.add val + for val in section("wiki.sidebar.blocks").as(not null).values do + res.add val.as(not null) end return res end @@ -834,7 +840,13 @@ end # Each section can provide its own config file to customize # appearance or behavior. class SectionConfig - super ConfigTree + super IniFile + autoinit ini_file + + # Path to this file + var ini_file: String + + init do load_file(ini_file) # Returns the config value at `key` or `null` if no key was found. private fun value_or_null(key: String): nullable String do