Closed Skipants closed 1 month ago
The obvious problem here is a collision between the tag name and some internals of YARD.
One way that seems obvious to fix it is to just .to_s
the class name that it tires to convert. That happens at:
lib/yard/templates/template.rb#268
I have that fix on my fork right now, but I am a little worried that there's still going to be some weirdness with that and I'm looking into it. I am also trying to ensure that the HTML output is as expected.
Sorry for the late reply:
Can you explain a bit about the use case for --tag owner
? I assume this is a custom tag you've used in certain places? If so, then yes, it seems like you might have hit on a reserved name. The best fix here would be to namespace your custom tags.
I think there is a fix that can be applied here (and the reason for the "will accept PR" tag on this issue), but the fix would probably not be what you're looking for: a warning when passing --tag owner
for a reserved name, along with the ignoring of this tag.
@lsegal No worries at all! I appreciate all you do!
Yes, the owner
tag is a custom one we are using ourselves.
I have found that this commit fixes it but I'm not exactly sure why. I just tackled the symptom without fully understanding the problem. We've been generating docs and serving them on a yard server
for at least a month now without issue, though.
I can put up a PR for that and if any issues come up we can go from there.
Steps to reproduce
POC can also be found at: https://github.com/Skipants/yard-poc/tree/master/error-converting-class-to-string
standard_object.rb
containing a class with a comment:yard doc --tag owner standard_object.rb
Actual Output
This errors with
[error]: Exception occurred while generating 'Base.html'
Full debug:
Expected Output
Expecting regular output as if run without a custom tag:
Environment details:
ruby -v
):ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]
yard -v
):yard 0.9.28
I have read the Contributing Guide. ✅