如何自定义 rdoc Darkfish 样式表?

发布于 2024-10-30 17:44:40 字数 503 浏览 3 评论 0原文

我正在使用 Rake 为我的项目生成 RDoc 文档,但我真的很讨厌 Darkfish 似乎生成的灰色对灰色的风格。我对其他一切都很满意,我只是想让配色方案更具可读性。

这是我的 rake 任务:

Rake::RDocTask.new do |rd|
    rd.main = "README.rdoc"
    rd.title = "My Title"
    rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
    rd.options = ['--main', 'README.rdoc']
end

我尝试将 '--style', 'doc/rdoc.css' 添加到上面的 rd.options 中,但它抱怨 --style 是一个未知选项并忽略它。我似乎找不到任何关于如何自定义模板或 CSS 等的文档;我是否必须忍受 Darkfish 认为看起来不错的东西?

I'm using Rake to generate RDoc documentation for my project, but I really hate the gray-on-gray style that Darkfish seems to generate. I'm happy with everything else, I'd just like to make the color scheme a little more readable.

Here's my rake task:

Rake::RDocTask.new do |rd|
    rd.main = "README.rdoc"
    rd.title = "My Title"
    rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
    rd.options = ['--main', 'README.rdoc']
end

I've tried adding '--style', 'doc/rdoc.css' to the rd.options above, but it complains that --style is an unknown option and ignores it. I can't seem to find any documentation on how to customize templates or css etc; do I just have to put up with what Darkfish thinks looks good?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

如果您查看 Darkfish 模板,您会看到的唯一 CSS 引用是这样的:

<link type="text/css" media="screen" href="<%= rel_prefix %>/rdoc.css" rel="stylesheet" />

其中一些具有 rel_prefix,有些则没有。任何模板中都没有包含其他样式表的内容。据推测,您应该只将颜色更改应用于 rdoc.css 或手动编辑模板以包含带有修改的另一个样式表。

更好的方法是将 --style 支持修补到 Darkfish 中并向作者发送补丁。看起来您只需要在模板中添加一点额外的 erb、一些开关解析逻辑,以及在 lib/rdoc/generator 中调用 self.render_template 的新变量/darkfish.rb。听起来这对 Darkfish 来说是一个有用的补充,作者甚至可能会很高兴有人想让他的软件变得更好。

If you look at the Darkfish templates, the only CSS references you'll see are things like this:

<link type="text/css" media="screen" href="<%= rel_prefix %>/rdoc.css" rel="stylesheet" />

Some of them have the rel_prefix and some don't. There's nothing in any of the templates for including other stylesheets. Presumably, you should just apply your coloring changes to rdoc.css or hand-edit the templates to include another stylesheet with your modifications.

A better approach would be to patch --style support into Darkfish and send the author a patch. Looks like you'd just need to add a small bit of extra erb to the templates, some switch parsing logic, and a new variable around calls to self.render_template in lib/rdoc/generator/darkfish.rb. Sounds like this would be a useful addition to Darkfish, the author might even be pleased that someone wants to make his software better.

私野 2024-11-06 17:44:40

难道您不能直接获取 darkfish 生成的 .css 文件的副本,然后进行修改,并将其存储在硬盘上的单独目录中吗?然后在你的 rake 任务中,当 rdoc 完成时覆盖 .css 文件?

Can't you just grab the copy of the .css file that darkfish generates, then make your modifications, and store it in a separate directory on your hard disk. Then in your rake task, just overwite the .css file when rdoc is done?

沦落红尘 2024-11-06 17:44:40

Darkfish 通过 --template 'your_template_name' 提供模板支持;我相信,需要将其设置为 rdoc 插件 gem。

这也可能有帮助: http://fossplanet.com/f14/making- rdoc-template-gem-26986/

一个 RDoc 插件 gem,表示具有如下目录结构的 gem:

./lib/rdoc/generator/template/#{您的模板名称和从 rdoc-2 复制的文件.blah/lib/rdoc/generator/template/darkfish}

./rdoc/generate.rb 将上述模板目录添加到 $LOAD_PATH 之前。 ($LOAD_PATH.unshift(File.expand_path(File.join(Dir.pwd,'..','lib', "#{..... 等等}")

Darkfish has template support with --template 'your_template_name'; which will need to be set up as a an rdoc plugin gem, i believe.

This might help as well: http://fossplanet.com/f14/making-rdoc-template-gem-26986/

An RDoc plugin gem meaning a gem with a directory structure like:

./lib/rdoc/generator/template/#{your template name and files copied from rdoc-2.blah/lib/rdoc/generator/template/darkfish}

and

./rdoc/generate.rb prepending the above template directory to the $LOAD_PATH. ($LOAD_PATH.unshift(File.expand_path(File.join(Dir.pwd,'..','lib', "#{..... and so on}")

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文