以可编写脚本的方式将 .rtf 转换为 mac .r 资源
我目前有 .rtf 格式的 SLA,将使用 Rez 实用程序使用的中间 .r mac 资源格式将其集成到 .dmg 中。我已经手动完成过一次,但对 .rtf 文件所做的更新难以传播到磁盘映像,并且容易出错。我想自动化此任务,这也可以帮助添加其他语言或变体。
.rtf 到 .r 文本转换过程如何自动化?
谢谢。
I currently have a SLA in a .rtf format, which is to be integrated into .dmg using the intermediary .r mac resource format, which is used by the Rez utility. I had already done it by hand once, but updates made to the .rtf file are overwhelming to propagate to the disk image, and error-prone. I would like to automate this task, which could also help adding other languages or variants.
How could the process of .rtf to .r text conversion be automated?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只是因为我没有完全理解接受的答案实际上是如何实现目标的,所以我使用脚本的组合来生成十六进制编码:
在构建过程中将其输出插入到变量中,然后该变量最终以模板(我们使用 Ant 来做到这一点,但具体细节并不是特别有趣):
其中需要相当长一段时间才能弄清楚的一点是可以使用
'RTF '
直接获取资源。 Apple 文档说要单独插入'TEXT'
(仅包含纯文本)和'styl'
(仅包含样式)。当然有一些工具可以做到这一点,但它是又一个需要运行的工具,我永远无法弄清楚如何使超链接在生成的 DMG 中工作。使用'RTF '
,超链接就可以工作。希望这可以在将来节省某人的时间。
Only because I didn't fully understand how the accepted answer actually achieved the goal, I use a combination of a script to generate the hex encoding:
The output of this is inserted into a variable during the build and then the variable ends up in a template (we're using Ant to do this, but the specifics aren't particularly interesting):
The one bit of this which did take quite a while to figure out is that
'RTF '
can be used for the resource directly. The Apple docs say to separately insert'TEXT'
(with just the plain text) and'styl'
(with just the style). There are tools to do this of course, but it was one more tool to run and I could never figure out how to make hyperlinks work in the resulting DMG. With'RTF '
, hyperlinks just work.Hoping that this saves someone time in the future.
使用
unrtf
端口(来自 macports),然后使用 shell 脚本格式化行、标题和尾部。Use the
unrtf
port (from macports), then format the lines, heading and tail with a shell script.