mirror of
https://github.com/wassname/side-by-side.git
synced 2026-09-09 11:34:24 +08:00
Remove unnecessary returns
This commit is contained in:
@@ -3,16 +3,16 @@ angular.module("sideBySide").factory "fetch", ['$http', 'readerFactory', ($http,
|
||||
#
|
||||
# @param file [String] Path to config file
|
||||
# @return [Object] Promises and heading
|
||||
return (file = "/config.json") ->
|
||||
(file = "/config.json") ->
|
||||
$http.get(file).then((response) ->
|
||||
promises = []
|
||||
for poem in response.data.files
|
||||
promises.push($http.get(poem).then((response) ->
|
||||
reader = readerFactory(poem)
|
||||
return reader(response.data)
|
||||
reader(response.data)
|
||||
))
|
||||
|
||||
return {
|
||||
{
|
||||
promises: promises
|
||||
heading: response.data.heading
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ angular.module("sideBySide").factory("readerFactory", ($injector) ->
|
||||
#
|
||||
# @param [String] Source file name
|
||||
# @return [Object] Reader
|
||||
return (filename) ->
|
||||
(filename) ->
|
||||
extension = filename.split(".").pop()
|
||||
switch extension
|
||||
when "json"
|
||||
|
||||
@@ -6,7 +6,7 @@ angular.module("sideBySide").factory("jsonReader", () ->
|
||||
#
|
||||
# @param source [String] Json poem
|
||||
# @return [Object] Poem object
|
||||
return (source) ->
|
||||
(source) ->
|
||||
parsed = eval('(' + source + ')')
|
||||
|
||||
for i,verse of parsed.content
|
||||
@@ -16,5 +16,5 @@ angular.module("sideBySide").factory("jsonReader", () ->
|
||||
verse.section = "" if "section" not of verse
|
||||
parsed.content[i] = verse
|
||||
|
||||
return parsed
|
||||
parsed
|
||||
)
|
||||
|
||||
@@ -6,7 +6,7 @@ angular.module("sideBySide").factory("markdownReader", () ->
|
||||
#
|
||||
# @param source [String] Markdown poem
|
||||
# @return [Object] Poem object
|
||||
return (source) ->
|
||||
(source) ->
|
||||
# Read meta information from markdown block
|
||||
#
|
||||
# @param block [string] Meta block
|
||||
@@ -18,7 +18,7 @@ angular.module("sideBySide").factory("markdownReader", () ->
|
||||
lexed = inlineLexer.output(line)
|
||||
match = /([^:]*):(.*)/.exec(lexed)
|
||||
meta[match[1].trim()] = match[2].trim()
|
||||
return meta
|
||||
meta
|
||||
|
||||
# Read and remove one section from start of lexed blocks
|
||||
#
|
||||
@@ -29,7 +29,7 @@ angular.module("sideBySide").factory("markdownReader", () ->
|
||||
while lexed.length > 0
|
||||
break if lexed[0]["type"] in separators
|
||||
items.push(lexed.shift())
|
||||
return items
|
||||
items
|
||||
|
||||
# Read content from lexed blocks
|
||||
#
|
||||
@@ -50,18 +50,16 @@ angular.module("sideBySide").factory("markdownReader", () ->
|
||||
section: heading
|
||||
text: marked.parser(text)
|
||||
})
|
||||
return content
|
||||
content
|
||||
|
||||
marked.setOptions({
|
||||
smartypants: true
|
||||
})
|
||||
marked.setOptions({ smartypants: true })
|
||||
lexed = marked.lexer(source)
|
||||
meta = lexed.shift()
|
||||
meta = readMeta(meta.text, new marked.InlineLexer(lexed.links))
|
||||
separators = if meta.Separator \
|
||||
then [meta.Separator] else ['heading', 'hr']
|
||||
|
||||
return {
|
||||
{
|
||||
meta: meta
|
||||
content: readContent(lexed, separators)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ angular.module("sideBySide").factory("transformer", () ->
|
||||
# @param translations [Array] Translations with 'meta' and 'content' keys
|
||||
# @throw No poems or uneven number of verses
|
||||
# @return [Array] Translations transformed into row-based format
|
||||
return (translations) ->
|
||||
(translations) ->
|
||||
# Check whether all translations have same number of verses
|
||||
#
|
||||
# @param translations [array] Translations to check
|
||||
@@ -62,5 +62,5 @@ angular.module("sideBySide").factory("transformer", () ->
|
||||
data.verses.push(translation.content[i] \
|
||||
for translation in translations)
|
||||
|
||||
return data
|
||||
data
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user