Add json reader and its tests

This commit is contained in:
Vit Brunner
2013-06-10 23:55:55 +01:00
parent a5ce7c9f15
commit 9a4fce961b
4 changed files with 51 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
angular.module("sideBySide").factory("jsonReader", () ->
return (source) ->
parsed = eval('(' + source + ')')
new_content = []
for verse in parsed.content
if typeof(verse) == "string"
new_content.push({ section: "", text: verse })
else
if "section" not of verse
verse.section = ""
new_content.push(verse)
parsed.content = new_content
return parsed
)