yard 0.7.3 无法在 Markdown 和 Textile 中构建我的自述文件

发布于 2024-12-12 05:30:20 字数 1652 浏览 5 评论 0原文

我决定将我的项目中的 README 文件转换为 Markdown,并一直在使用yard 验证文档是否正确呈现。所以我安装了 rdiscount,将 README 更改为 README.md 并尝试:

yard doc README.md

这给了我一个警告:

[warn]: Syntax error in `readme.md`:(3,18): syntax error, unexpected tinteger, expecting $end

所以我尝试了:

yard doc -m markdown -- README.md

同样的问题。运行:

yard doc --backtrace -- README.md

提供更多信息:

[warn]: Syntax error in `readme.md`:(3,18): syntax error, unexpected tinteger, expecting $end
[error]: ParserSyntaxError: syntax error in `README.md`:(3,18): syntax error, unexpected tINTEGER, expecting $end
[error]: Stack trace:
    /Users/wadewest/.rvm/gems/ruby-1.9.2-p290@peppercorn/gems/yard-0.7.3/lib/yard/parser/ruby/ruby_parser.rb:505:in `on_parse_error'
    /Users/wadewest/.rvm/gems/ruby-1.9.2-p290@peppercorn/gems/yard-0.7.3/lib/yard/parser/ruby/ruby_parser.rb:49:in `parse'
    /Users/wadewest/.rvm/gems/ruby-1.9.2-p290@peppercorn/gems/yard-0.7.3/lib/yard/parser/ruby/ruby_parser.rb:49:in `parse'
    /Users/wadewest/.rvm/gems/ruby-1.9.2-p290@peppercorn/gems/yard-0.7.3/lib/yard/parser/ruby/ruby_parser.rb:15:in `parse'
    /Users/wadewest/.rvm/gems/ruby-1.9.2-p290@peppercorn/gems/yard-0.7.3/lib/yard/parser/source_parser.rb:438:in `parse'
    /Users/wadewest/.rvm/gems/ruby-1.9.2-p290@peppercorn/gems/yard-0.7.3/lib/yard/parser/source_parser.rb:361:in `parse_in_order'

如果我尝试使用纺织品,也会发生同样的情况。如果有人想尝试重现该问题,该项目位于 github。谢谢。

I've decided to convert the README file in a project of mine to markdown and have been using yard verify the documentation rendered out ok. So I installed rdiscount, changed README to README.md and tried:

yard doc README.md

which gave me a waring:

[warn]: Syntax error in `readme.md`:(3,18): syntax error, unexpected tinteger, expecting $end

So I tried:

yard doc -m markdown -- README.md

Same problem. Running:

yard doc --backtrace -- README.md

gives a little bit more info:

[warn]: Syntax error in `readme.md`:(3,18): syntax error, unexpected tinteger, expecting $end
[error]: ParserSyntaxError: syntax error in `README.md`:(3,18): syntax error, unexpected tINTEGER, expecting $end
[error]: Stack trace:
    /Users/wadewest/.rvm/gems/ruby-1.9.2-p290@peppercorn/gems/yard-0.7.3/lib/yard/parser/ruby/ruby_parser.rb:505:in `on_parse_error'
    /Users/wadewest/.rvm/gems/ruby-1.9.2-p290@peppercorn/gems/yard-0.7.3/lib/yard/parser/ruby/ruby_parser.rb:49:in `parse'
    /Users/wadewest/.rvm/gems/ruby-1.9.2-p290@peppercorn/gems/yard-0.7.3/lib/yard/parser/ruby/ruby_parser.rb:49:in `parse'
    /Users/wadewest/.rvm/gems/ruby-1.9.2-p290@peppercorn/gems/yard-0.7.3/lib/yard/parser/ruby/ruby_parser.rb:15:in `parse'
    /Users/wadewest/.rvm/gems/ruby-1.9.2-p290@peppercorn/gems/yard-0.7.3/lib/yard/parser/source_parser.rb:438:in `parse'
    /Users/wadewest/.rvm/gems/ruby-1.9.2-p290@peppercorn/gems/yard-0.7.3/lib/yard/parser/source_parser.rb:361:in `parse_in_order'

Same thing happens if I try using textile. If anyone wants to try reproduce the problem, the project is on github. Thank you.

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

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

发布评论

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

评论(1

留一抹残留的笑 2024-12-19 05:30:20

我认为您只是对 yard 选项感到困惑。帮助是这样说的:

$ yard --help doc
Usage: yard doc [options] [source_files [- extra_files]]
(if a list of source files is omitted, 
  {lib,app}/**/*.rb ext/**/*.c is used.)

Example: yardoc -o documentation/ - FAQ LICENSE
  The above example outputs documentation for files in
  lib/**/*.rb to documentation/ including the extra files
  FAQ and LICENSE.
...

所以当你这样说时:

$ yard doc -m markdown -- README.md

Yard 会尝试将 README.md 解释为某种源文件。您的 README.md 将被解释为 Ruby 源文件(事实并非如此),这会导致 Ruby 错误,如下所示:

unexpected tinteger, expecting $end

如果您编辑 稍微阅读一下 README.md,您会看到错误的位置在移动,但如果您尝试将 README.md 作为 Ruby 源文件来读取,则该错误是有意义的。

运行 yard 时,您根本不需要说任何关于 README.md 的内容,yard 就会知道如何处理 README .md 全部由其本身。

I think you're just confused about the yard options. The help says this:

$ yard --help doc
Usage: yard doc [options] [source_files [- extra_files]]
(if a list of source files is omitted, 
  {lib,app}/**/*.rb ext/**/*.c is used.)

Example: yardoc -o documentation/ - FAQ LICENSE
  The above example outputs documentation for files in
  lib/**/*.rb to documentation/ including the extra files
  FAQ and LICENSE.
...

so when you say this:

$ yard doc -m markdown -- README.md

Yard will try to interpret README.md as a source file of some kind. Your README.md will be interpreted as a Ruby source file (which it isn't) and that results in a Ruby error like this:

unexpected tinteger, expecting $end

If you edit your README.md a bit you'll see the location of the error moving around but the error will make sense if you try to read README.md as a Ruby source file.

You don't need to say anything about README.md when running yard at all, yard will know what to do with README.md all by itself.

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