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

Replace absolute href and src attributes with relative paths #16

Merged
merged 1 commit into from
Dec 31, 2015

Conversation

j3lamp
Copy link
Contributor

@j3lamp j3lamp commented Dec 30, 2015

This may fix #13.

@technosophos
Copy link
Owner

If I understand this right, you're tracking depth, and then if a src or href references a relative path, you're prepending it with the correct number of ../ prefixes? Given what we're trying to accomplish, that seems like a pretty straightforward approach for docs.

I guess that we could try tracking the base path itself, and passing that into the texasRanger (What in the world was I thinking when I decided to name that?). That might be a little more precise, but I'm guessing it would take more work that what you've accomplished here.

Unless you think there's a reason to wait and try some other approach, I'll merge this as is. It's certainly better than what's there today.

@j3lamp
Copy link
Contributor Author

j3lamp commented Dec 31, 2015

Yes your understanding is correct. I was thinking of passing the base path in, but I assumes that every path encountered would be prefixed by the base path, right? In which case it seemed like a waste to calculate the depth every time, although if that makes the code easier to read then that's the way to do it.

There is another approach that could be useful in some cases: Say you are trying to use dashing on a portion of a website, e.g. <www.hdfgroup.org/HDF5/doc/>, it could have href/src attributes that are already relative but go all the way up to the root first, i.e. the paths are formatted as we'd desire, but have extra ../ prefixes in them. In that case, however, I think the configuration would have to specify which ones should be made external links and which ones could be make relative. What I don't know is how important that use case is.

As for texasRanger I think you were merely having fun when you chose the name. (-:

@technosophos
Copy link
Owner

Alright! Let's give this one a shot, then, and see how it holds up.

technosophos added a commit that referenced this pull request Dec 31, 2015
Replace absolute href and src attributes with relative paths
@technosophos technosophos merged commit df508fa into technosophos:master Dec 31, 2015
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.

Relative path for css/js file
2 participants