Custom tags, handlers, and templates

Thomas Walpole's Avatar

Thomas Walpole

13 Sep, 2016 07:10 PM

I recently pushed an update to Capybara - https://github.com/jnicklas/capybara/commit/6af2a4609f6093d470a52f8b2132cd7342ef8792 - that adds custom yard tags, handlers and templates to document built-in selectors that are defined with a DSL. This info isn't showing up on http://www.rubydoc.info/github/jnicklas/capybara/Capybara/Selector. Are custom tags, etc not supported?

  1. Support Staff 1 Posted by lsegal on 17 Sep, 2016 06:27 AM

    lsegal's Avatar

    Custom tags are supported when supplied in the command line / .yardopts file (--tag, etc), but arbitrary Ruby code is not executed on rubydoc.info (--load is disabled) by default. We could potentially whitelist the project and allow code to be executed for this and its gem. It does look like some of this can be solved with standard --tag calls, though.

  2. 2 Posted by Thomas Walpole on 17 Sep, 2016 04:34 PM

    Thomas Walpole's Avatar

    If you'd be willing to whitelist the Capybara project that would be great, If not - from the documentation I've read - I don't see how it would possible to get this to work with starndard --tags calls.

  3. Support Staff 3 Posted by lsegal on 18 Sep, 2016 07:43 PM

    lsegal's Avatar

    It wouldn't work exactly the same as you have it, but it may not be necessary to define custom CodeObjects, since the tags could be defined on any arbitrary namespace. Using @!parse with private modules would work, and then included in some class or extra file markdown document via {render:TheSelectorModule}. It's not as nicely automated (you'd have to manually document the xpath/css calls), but it could work. Given that you're already defining the filter/locator tags manually which builds the bulk of your Selectors template, it wouldn't be that much of a change.

    YARD could benefit from some kind of @!parseinto directive to force parsing in a block, which would allow you to define macros on the xpath/css calls, which could simplify some of this and remove the need for custom templating.

    For whitelisting, open an issue on http://github.com/docmeta/rubydoc.info so we can track it there. Thanks!

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac