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
Resolve relative URLs when parsing #32
Comments
Resolve relative URLs in the parsed data since the Ruby parser doesn't do it for us. Issue filed there: microformats/microformats-ruby#32
From the sound of this "If running Microformats2.parse with a URL as an argument, just use that as the URL to compute relative URLs from." that sounds like <base> tags are not taken into account. I believe @barnabywalters has some test cases for that. |
"tags are not taken into account"? I'm not sure I understand |
<base> tags perhaps? assuming the tag was stripped from @tantek's post. |
Thanks @bbauer! |
Yes, what @kylewm said. Updated my plain text comment to escape the tag that should have "just" been displayed. markdown-- |
That would be quite useful for me if this could be fixed too. I haven't seen any other mf2 parser for ruby yet :-/ |
@jeena Finally merged your PR. I haven't built and released a new gem yet. But if you could build and test it locally to let me know if your PR fixes your problems, I'd appreciate it. |
The error was hit when it encountered href="" and didn't have a base at all, the resulting absolute url was nil, which was unexpected. Added a test for the blank href case and added code to get the base from the url if not provided in the header Also added a fix to get the base from the url, which may fix #32 Can someone else confirm this priority for base detection 1 (highest). base provided during call to .parse() 2. base found from <base> tag in html 3. calculated from url given
closed accidentally, please confirm this looks good |
This seems to be pretty well resolved based on some testing i have done. |
Resolve relative URLs in the parsed data since the Ruby parser doesn't do it for us. Issue filed there: microformats/microformats-ruby#32
When parsing a document, all URLs returned should be absolute URLs based off of the URL that is being parsed.
If running Microformats2.parse with a URL as an argument, just use that as the URL to compute relative URLs from. Otherwise, if parsing an HTML string directly, need an additional parameter to pass the URL into.
The text was updated successfully, but these errors were encountered: