咖啡脚本替换

Coffee Script Replace

找到这个名为 Ubersicht 的新应用。它似乎是 mac 上不错的 GeekTool 桌面替代品,小部件使用咖啡脚本。

我找到了一个很棒的脚本: https://github.com/bgartenmann/uebersicht-only-this-widget

该脚本没有说明。它引用桌面上名为 today.txt 的文本文件。我们的想法是放入当天的任务,它们会显示在小部件中。

 todayfile = '~/Desktop/today.txt'

 command: "cat #{today file}"

 refreshFrequency: 5000

 style: (a long list of css went here, did not think it was relevant)

 render: (output) -> 
 placeholder = "_____________"
 outputArray = output.split "*"
 goal = outputArray[0] || placeholder
 step1 = outputArray[1] || placeholder
 step2 = outputArray[2] || placeholder
 step3 = outputArray[3] || placeholder

    <p>If nothing else, today I am going to <span class="fillout">#{goal}</span>.<br />
     I am going to do this by <span class="fillout">#{step1}</span> then <span class="fillout">#{step2}</span> then <span class="fillout">#{step3}</span>.<br />
     <span class="motivation">If I do this and only this,<br /> today will be a <strong>good</strong> day.</span>"

我不知道如何格式化 .txt 文件中的条目,以便条目最终位于小部件的正确位置。我尝试了多种方法来引用 step1 ,一个例子是..

步骤 1 = "this step"

每当我插入文本时,它们总是在第一行结束。我如何才能使在 .txt 中输入的 "tasks" 最终出现在小部件上的预期显示位置?

首先,感谢您传播有关 Übersicht and this widget 的信息!他们太棒了!

~/Desktop/today.txt 文件中项目的分隔符是星号 * 字符。

这是我的 ~/Desktop/today.txt 的样子:

answer a beyonddynamic’s question on Whosebug
*
reading widget’s source code
*
taking a screenshot
*
posting an answer on stackoverfow

如果您愿意,可以将句子写在一行上。新行是可选的。