devdocs
devdocs copied to clipboard
Add external_urls filter
This a tiny filter whose purpose is replace urls found in <a>
tags for relative URLs pointing to devdocs documentation. This is done manually, each author or maintainer should add (if needed) options[:external_url]
filter option to the scraper.
This is not done server-side as discussed in #234 but it gives an option to avoid links of external documentation when it is available in devdocs.
This commit already implements this filter in the backbone.rb
file.
Code improved by your suggestions @simon04.
Reading the js of devdocs I found that each link ('a' tag) is verified if it is part of devdocs or not before send me to the page that it is pointing, if the link is part of devdocs it will make an xhr request and it will show me content retrieved by the xhr request, this behaviour works if the link is part of the same documentation or if the link is from a documentation that is enabled, if not it will show me an error. I changed this behaviour, if a link is part of devdocs but it is from a different doc it will send to devdocs reloading the page rather than make an xhr request.