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

code block may block item links #125

Closed
ialbert opened this issue Apr 15, 2012 · 6 comments
Closed

code block may block item links #125

ialbert opened this issue Apr 15, 2012 · 6 comments

Comments

@ialbert
Copy link
Owner

ialbert commented Apr 15, 2012

From: Ryan Thompson rct@thompsonclan.org
To: biostar-central biostar-central@googlegroups.com
Cc:
Date: Sun, 15 Apr 2012 15:58:50 -0700 (PDT)
Subject: Bug: User activity page links broken by code blocks
If you look at the activity page on my profile, you can see that in
one of the entries, the link to the activity item is trapped inside a
code block and therefore visible as raw Markdown and not a clickable
link.

http://www.biostars.org/user/profile/285/

-Ryan

@gawbul
Copy link

gawbul commented May 9, 2012

I have this issue too! See screendump here http://dl.dropbox.com/u/4423356/biostar_issue.png and my user profile http://www.biostars.org/user/profile/446/

Cheers,

Steve

@gawbul
Copy link

gawbul commented May 9, 2012

I've been trying to have a little poke around and sort this out. It seems to be something to do with {{ note.html|safe }} in main/server/templates/user.profile.html. What exactly does that do? Are the notifications created when comments etc. are made, or are they rendered on the fly? It seems to be killing links to the posts when they are evaluated within code blocks.

@ialbert
Copy link
Owner Author

ialbert commented May 9, 2012

It probably comes from earlier where a note is generated on an action. A note is basically a little text snipped that describes an action and is created upon post creation. After this snippet the link is included separately. The code responsible for it is the function post_action in

https://github.com/ialbert/biostar-central/blob/master/main/server/notegen.py

Now the content of the note is just a partial content of the post but since it is html that I am trimming back I think the problem ends up being that some html tags remain open and that interacts with the link that follows it. This problem is also likely to manifest itself differently in different browsers since it is a matter of trying to display occasionally incorrect markup.

The real solution is to trim back the original markup to be shorter, and from that generate a new html rather than taking the html and chopping it off.

@gawbul
Copy link

gawbul commented May 9, 2012

Could you add some checks in under the chop subroutine, to sanitise the HTML tags? Perhaps using BeautifulSoup or Tidy? From what I can tell, it seems to be closing off the tags after the postlink, but it should probably be doing it before.

@ialbert
Copy link
Owner Author

ialbert commented May 9, 2012

On Wed, May 9, 2012 at 3:34 PM, Steve Moss
reply@reply.github.com
wrote:

Could you add some checks in under the chop subroutine, to close off any tags?

well, detecting that is not that easy since tags can nest etc.
basically it would need a a full html parsing into document, plus one
would also need to decide how to close them properly. Not trivial
either. Recreating it from a shorter input is probably simpler.

@ialbert
Copy link
Owner Author

ialbert commented Jul 31, 2012

The order of links has changed as requested in #161 The changes in 7ba74c7 also fix this issue.

@ialbert ialbert closed this as completed Jul 31, 2012
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

No branches or pull requests

2 participants