searchSpellLink
Code: Select all
[H: numArgs_ = json.length(macro.args)]
[H: assert( numArgs_ >= 1, "<b>searchSpellLink(keyword)</b><br>",0)]
[H: keyword_ = json.get(macro.args,0)]
[H: keyword_ = lower(keyword_)]
[H: keyword_ = replace(keyword_,"[^a-z]","")]
[H: returnLink = json.get(glp("cachedSpellLinks"),keyword_)]
[H: returnLink = if(returnLink == "",json.get(macro.args,0),returnLink)]
[H: macro.return = returnLink]
makeKeywordSpellList
Code: Select all
[H: numArgs_ = json.length(macro.args)]
[H: assert( numArgs_ >= 1, "<b>searchSpellLib(keywords)</b><br>",0)]
[H: keyword_ = json.get(macro.args,0)]
[H: keyword_ = lower(keyword_)]
[H: keyword_ = replace(keyword_,"[^a-z,]","")]
[H: spellLinks_ = glp("cachedSpellLinks")]
[H: listPos = 0]
[H: returnLink = ""]
[H, foreach(keyword_,keywords_), code: {
[H: tempLink = json.get(spellLinks_,keyword_)]
[H, if(tempLink == ""), code: {
[returnLink = listAppend(returnLink,listGet(json.get(macro.args,0),listPos))]
};{
[returnLink = listAppend(returnLink,tempLink)]
}]
[H: listPos = listPos +1]
}]
[H: macro.return = returnLink]