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

Help files: spaces in some links are rendered with %20 #2337

Closed
crucialfelix opened this issue Sep 14, 2016 · 9 comments
Closed

Help files: spaces in some links are rendered with %20 #2337

crucialfelix opened this issue Sep 14, 2016 · 9 comments
Labels
comp: class library SC class library comp: help schelp documentation
Milestone

Comments

@crucialfelix
Copy link
Member

crucialfelix commented Sep 14, 2016

This:

(See: link::#NodeProxy elastic behavior setting::)

renders as:

(See: NodeProxy%20elastic%20behavior%20setting)

Source is at:

 HelpSource/Other/JITLibChanges3.7.schelp

The link is correctly escaped and is clickable but the visible text should not have been escaped.

This happens when there is only an anchor. #NodeProxy elastic behavior setting The link is to something on the current page.

@crucialfelix crucialfelix added the comp: class library SC class library label Sep 14, 2016
@crucialfelix crucialfelix added this to the 3.9 milestone Sep 14, 2016
@jamshark70
Copy link
Contributor

jamshark70 commented Jan 12, 2017

It happens for all links: haven't pushed yet but I'm working on one: link::Classes/Ringz#Interaction with sample rate:: which renders as "Ringz: Interaction%20with%20sample%20rate"

Clumsy workaround: link::Classes/Ringz#Interaction with sample rate#Ringz: Interaction with sample rate::

@mossheim
Copy link
Contributor

mossheim commented May 6, 2017

I'm pretty sure the solution is as simple as having SCDocHTMLRenderer::escapeSpacesInAnchor, shown below, return the original string unchanged.

*escapeSpacesInAnchor { |str|
	^str.replace(" ", "%20") // reduce to ^str?
}

@mossheim
Copy link
Contributor

mossheim commented May 6, 2017

(Of course we'd just eliminate the method altogether.)

I did a couple tests with that change; links work, and I don't see any %20 in link names.

@mossheim
Copy link
Contributor

mossheim commented May 6, 2017

Gah, never mind, I found the trail back to why this method was introduced. I will keep looking for a solution.

@mossheim
Copy link
Contributor

mossheim commented Jul 12, 2017

problem is somewhere in SCDocHTMLRenderer:*htmlForLink

@enedrio
Copy link
Contributor

enedrio commented Jul 12, 2017

I just replaced the %20 with spaces where the label for "in same document"-links is created.

Then line 97 in SCDocRenderer.sc says:
f = if(m.size>0) {m.replace("%20", " ")} {"(empty link)"};

It seems to work.
It's a stupid hack, though. :-\

EDIT: I just found one case, that escapes this logic. It's when there is a link to the subsection of another help file. e.g. in the Discussion of GridLayout:*rows

EDIT2: Ok. replacing the return value line (101) with this one, is also a simple solution that seems to work:
"<a href=\""++c++"\">"++ f.replace("%20", " ") ++"</a>";

Is this worthy a pull request?

@mossheim
Copy link
Contributor

mossheim commented Jul 12, 2017

I am working on a fix here: https://github.com/brianlheim/supercollider/tree/issue/2337
Comparison: master...brianlheim:issue/2337

I found myself having to rewrite the method because it is so full of cramped notation and single-letter variables. Hopefully the comments help to explain what is going on.

mossheim added a commit to mossheim/supercollider that referenced this issue Jul 12, 2017
in SCDocHTMLRenderer.htmlForLink:

- Add new variable for the link with spaces escaped

- Update usage of linkAnchor to use spaceEscapedAnchor when appropriate

- This fixes supercollider#2337 by not using the space-escaped anchor where the unaltered anchor string is intended
@mossheim
Copy link
Contributor

mossheim commented Jul 13, 2017

@enedrio #3033.

@enedrio
Copy link
Contributor

enedrio commented Jul 13, 2017

Thanks! You improved the readability of the code a lot. 👍 good work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: class library SC class library comp: help schelp documentation
Projects
None yet
Development

No branches or pull requests

5 participants