Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix HTML links generated by special resource names #93

Conversation

claudiob
Copy link
Contributor

This commit ensures that the links from the index page to the
examples pages of the generated HTML documentation are not broken
when the resource name includes special characters like :.

I'm aware this pull request needs tests to be accepted; however I was not sure how to write the required tests.
I will explain how to reproduce the bug solved by this PR here and hopefully get some feedback on how to write the test (and update this PR accordingly):

  1. chdir to example
  2. edit spec/acceptance/orders_spec.rb, changing resource "Orders" to resource "Super::Orders"
  3. run rake docs:generate
  4. open doc/api/index.html in the browser
  5. click on any example link, for instance Creating an order
  6. The link will wrongly point to super::orders/creating_an_order.html, that is, it will interpret super as the URL protocol, rather than linking to an HTML file in a subfolder

My commit replaces any non-ASCII character with an underscore, which generates filesystem-acceptable filenames

This commit ensures that the links from the `index` page to the
`examples` pages of the generated HTML documentation are not broken
when the resource name includes special characters like `:`.
@oestrich
Copy link
Contributor

I think you could check this in a spec for example.rb. It might be worth having in other writers. I expect that Raddocs has this problem as well.

@oestrich oestrich closed this in 76bfc0e Oct 15, 2013
@oestrich
Copy link
Contributor

Came up with a simple test to get this in. The feature file has a simple spec that contains "::", a pretty indirect test but it fails without it.

@claudiob claudiob deleted the convert-resource-name-to-filename-compatible-string branch October 15, 2013 16:14
@claudiob
Copy link
Contributor Author

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants