Verbatim regions mixing spaces and tabs as left indention text output differently between yard and rdoc

21 views
Skip to first unread message

Perry Smith

unread,
Dec 20, 2015, 10:11:24 AM12/20/15
to YARD
I have a README where I grabbed the output of my --help command output, indented it two spaces and assumed it would come out as a verbatim.

It was probably emacs that jumped up and said "Oh!! let me help you with that" and converted some of the spaces on the left hard margin to tabs.

When I feed this to rdoc, it came out as expected with all the output in a verbatim block.  When I use yard, it does not.  I'm using rdoc as my markup in yard.

I've attached a simple test file.  I can open an issue if you want but this may fall under the "fix your source" category.

yard is 0.8.7.6; rdoc is 4.2.0; ruby 2.2.3

Thank you,
Perry

README

Loren Segal

unread,
Dec 20, 2015, 5:06:46 PM12/20/15
to yar...@googlegroups.com
Hey Perry,

It looks like RDoc is doing some extra pre/post processing on the files that it's hiding from its markup processor. That may include forcibly gsubbing tabs by spaces before marking up HTML. YARD is doing nothing other than calling out to RDoc::Markup to get the generated HTML. A bare reproduction that you can run on any Ruby 2.x install is attached to this email. You can see it on repl.it here: https://repl.it/B9q0

If RDoc really is just replacing the tabs, it's something YARD could do, but I'm not sure it's something we'd want to, since that could be confusing for other reasons.

Loren
--

---
You received this message because you are subscribed to the Google Groups "YARD" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yardoc+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

rdoc-markup-repro.rb

Perry Smith

unread,
Dec 21, 2015, 9:03:37 AM12/21/15
to yar...@googlegroups.com
I agree. I would not change Yard.

For any others who might stumble upon this: the symptom was in the output, parts were verbatim and others were not. The parts that were had the same initial indentation as the first line (spaces in this case) and the parts that were not had the opposite (tabs). It may be that tabs do not ever work. I did not try that. But changing tabs to spaces avoids the issue.

Hope this helps someone…
Perry


Reply all
Reply to author
Forward
0 new messages