template :: TemplateString :: iterator
self
macros on the form macro.name
/macro.replacement
.Given that all macros with the same name are all replaced with the same replacement, this view contains only one entry for each name.
var tpl = new TemplateString("Hello %FIRSTNAME%, %LASTNAME%!")
for name, rep in tpl do assert rep == null
tpl.replace("FIRSTNAME", "Corben")
tpl.replace("LASTNAME", "Dallas")
for name, rep in tpl do assert rep != null
# Returns a view on `self` macros on the form `macro.name`/`macro.replacement`.
#
# Given that all macros with the same name are all replaced with the same
# replacement, this view contains only one entry for each name.
#
# var tpl = new TemplateString("Hello %FIRSTNAME%, %LASTNAME%!")
# for name, rep in tpl do assert rep == null
# tpl.replace("FIRSTNAME", "Corben")
# tpl.replace("LASTNAME", "Dallas")
# for name, rep in tpl do assert rep != null
fun iterator: MapIterator[String, nullable Writable] do
return new TemplateStringIterator(self)
end
lib/template/macro.nit:261,2--273,4