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

SCDoc HTML renderer includes literal spaces in links with anchors #1650

Closed
jamshark70 opened this issue Sep 7, 2015 · 2 comments
Closed
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: SCDoc scdoc syntax, parser, and renderer. for changes to schelp files, use "comp: help"
Milestone

Comments

@jamshark70
Copy link
Contributor

The SCDoc HTML renderer generates named anchors for section and subsection names. That makes sense.

Sections and subsections may have spaces in their titles. The named anchors don't take this into account. As a result, if you want to post a link to doc.sccode.org to a specific section, the following workflow is broken with some browsers:

  1. Navigate to the help file at doc.sccode.org.
  2. Click on the table of contents at the top of the page, and choose a section.
  3. Copy and paste the link from the browser's URL field.

You might get a link that looks something like this:

http://doc.sccode.org/Tutorials/A-Practical-Guide/PG_06g_Data_Sharing.html#Other information storage patterns

It turns out that Firefox on my computer automatically fixes the spaces when copying the URL. Other browsers don't. If I do this on my Android tablet, I get real space characters in the URL. If I don't fix them manually, then the recipient of an e-mail into which I have pasted the link will get a broken link. (This has been an annoyance for years.)

Here, I have updated SCDocHTMLRenderer:

https://github.com/supercollider/supercollider/tree/topic/fixSCDocToc
a451a06

But this doesn't completely fix the problem, because the links in the Table of contents are generated dynamically in JavaScript. My JavaScript is not up to snuff -- it'll take me too long to figure out how to fix it. I can see that the problem is in lines 551-593 of https://github.com/supercollider/supercollider/blob/master/HelpSource/scdoc.js but I don't know how to copy the existing link's "name" property into the new link generated by JS.

I pushed my change into a topic branch in the main SC repository, so anyone else can push the rest of the fix.

@jamshark70 jamshark70 added bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: SCDoc scdoc syntax, parser, and renderer. for changes to schelp files, use "comp: help" labels Sep 7, 2015
@jamshark70 jamshark70 added this to the 3.8 milestone Sep 7, 2015
@crucialfelix
Copy link
Member

the built in js function is encodeURI

encodeURI("http://doc.sccode.org/Tutorials/A-Practical-Guide/PG_06g_Data_Sharing.html#Other information storage patterns")
"http://doc.sccode.org/Tutorials/A-Practical-Guide/PG_06g_Data_Sharing.html#Other%20information%20storage%20patterns"

@crucialfelix
Copy link
Member

Fixed by #2336

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: SCDoc scdoc syntax, parser, and renderer. for changes to schelp files, use "comp: help"
Projects
None yet
Development

No branches or pull requests

2 participants