Last active
August 29, 2015 14:13
-
-
Save clkao/43843e24f4ee7b31e43d to your computer and use it in GitHub Desktop.
中選會回應產生器
This file contains hidden or 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
#!/usr/bin/lsc | |
# | |
# Usage: | |
# % npm i -g LiveScript | |
# % lsc cec.ls 2 | |
# (stdout) | |
# 中選會:分享「 | |
# 分享「 | |
# 分享「不能宣傳 2/14 罷免蔡正元」難判定有無違法,盡量不要分享「不能宣傳 2/14 罷免蔡正元」,以免觸法。 | |
# 」難判定有無違法,盡量不要分享「 | |
# 分享「不能宣傳 2/14 罷免蔡正元」難判定有無違法,盡量不要分享「不能宣傳 2/14 罷免蔡正元」,以免觸法。 | |
# 」,以免觸法。 | |
# 」難判定有無違法,盡量不要分享「 | |
# 分享「 | |
# 分享「不能宣傳 2/14 罷免蔡正元」難判定有無違法,盡量不要分享「不能宣傳 2/14 罷免蔡正元」,以免觸法。 | |
# 」難判定有無違法,盡量不要分享「 | |
# 分享「不能宣傳 2/14 罷免蔡正元」難判定有無違法,盡量不要分享「不能宣傳 2/14 罷免蔡正元」,以免觸法。 | |
# 」,以免觸法。 | |
# 」,以免觸法。 | |
quotes = [ | |
* \「」 | |
* \『』 | |
* \【】 | |
] | |
quote = (text, lv) -> | |
[quotes[lv % quotes.length].0, text, quotes[lv % quotes.length].1].join '' | |
warning = (text, lv) -> | |
"分享#{quote text, lv}難判定有無違法,盡量不要分享#{quote text, lv},以免觸法。" | |
indent = (text, level)-> | |
text.split("\n") | |
.map -> " " * level + it | |
.join "\n" | |
generate = (text, level) -> | |
ret = text | |
for i in [0 to level] | |
if i | |
ret = ["\n", indent(ret, 2), "\n"].join '' | |
ret = warning ret, i | |
ret | |
console.log "中選會:" + generate "不能宣傳 2/14 罷免蔡正元", process.argv.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment