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

Get numerical hashes like #123 to link to notes, not generate tag links #1825

Closed
jywarren opened this issue Dec 4, 2017 · 2 comments
Closed
Labels
help wanted requires help by anyone willing to contribute Ruby

Comments

@jywarren
Copy link
Member

jywarren commented Dec 4, 2017

Please describe the problem (or idea)

Right now, when you use a hashtag like #sampling on PublicLab.org, you get a link to the corresponding tag page, https://publiclab.org/tag/sampling.

If you use a number like #123, you likewise get linked to ../tag/123.

But this would be a good opportunity to link that to the node with matching ID -- like, for example, https://publiclab.org/n/99 for #99

Solution

The regular expression code to find numbers is here:

https://github.com/publiclab/plots2/blob/master/config/initializers/constants.rb#L3

We should exclude just numbers -- so while this should work:

#hello-2

This should not match:

#99

This last #99 should instead be matched by a new one that does /not/ match any letters.

To try these out, you can use http://Rubular.com, using the test string:

#99
#hello-2
#hello

Then, each place we do the substitution should be added to so we replace the numerical ones too:

https://github.com/publiclab/plots2/search?utf8=%E2%9C%93&q=Callouts.const_get(:HASHTAG)

@jywarren jywarren added help wanted requires help by anyone willing to contribute Ruby labels Dec 4, 2017
@sagarpreet-chadha
Copy link
Contributor

@jywarren sir...can i take this ?

@jywarren
Copy link
Member Author

jywarren commented Dec 5, 2017 via email

jywarren pushed a commit that referenced this issue Dec 7, 2017
#1825 (#1826)

* Updated constant.rb

* Updated answer.rb

* Updated comment.rb

* Updated revision.rb

* Added Test for HASHTAGNUMBER regex
@jywarren jywarren closed this as completed Dec 7, 2017
SrinandanPai pushed a commit to SrinandanPai/plots2 that referenced this issue May 5, 2019
…e tag links publiclab#1825 (publiclab#1826)

* Updated constant.rb

* Updated answer.rb

* Updated comment.rb

* Updated revision.rb

* Added Test for HASHTAGNUMBER regex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted requires help by anyone willing to contribute Ruby
Projects
None yet
Development

No branches or pull requests

2 participants