Awful/Awful.app — pull request #293 by shaver (2014-03-31 07:03:25+00:00)
Title: Auto-close open bbcode. 

Handles

/*
* Tests:
* "[b][i]" -> "i"
* "[b][i][/i]" -> "b"
* "[b][/b]" -> nil
* "[url=foo]" -> "url"
* "[url=foo][b][i][/b]" -> "url"
*/

Open [code] tags trump inner markup:

/* Tests:
* "[code] [b]" -> TRUE
* "[code] [b] [/code]" -> FALSE
* "[code] [b] [/code][code]" -> TRUE
* "[code=cpp] [b]" -> TRUE
* "[/code]" -> FALSE
* "[codemonkey] [b]" -> FALSE
* "[code][codemonkey]" -> TRUE
*/