Skip to content

Instantly share code, notes, and snippets.

@opn
Created June 23, 2017 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save opn/aa72250686f4198632dcca6ee0755255 to your computer and use it in GitHub Desktop.
Save opn/aa72250686f4198632dcca6ee0755255 to your computer and use it in GitHub Desktop.
Checks a wiki page array to see if there is a named checkbox in a markdown section. Returns true, false, or empty.
function fedwiki_ItemChecked pageArray, checkboxTitle
put pageArray ["story"] into storyArray
put item 2 of the extents of storyArray into maxItemNum
repeat with itemNum = 1 to maxItemNum
put storyArray [itemNum] into itemArray
if itemArray ["type"] is not "markdown" then next repeat
put itemArray ["text"] into itemText
switch
case itemText contains ("- [x]" && checkboxTitle)
return true
case itemText contains ("- [ ]" && checkboxTitle)
return false
default
next repeat
end switch
end repeat
return false
end fedwiki_ItemChecked
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment