Created
June 23, 2017 16:21
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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