Post a reply

Image
Nov 18, 2016 5:40 AM CST
Thread OP
Name: Sue
Ontario, Canada (Zone 4b)
Annuals Native Plants and Wildflowers Keeps Horses Dog Lover Daylilies Region: Canadian
Butterflies Birds Enjoys or suffers cold winters Garden Sages Plant Identifier
Does anyone know why (not just on NGA) occasionally a cut and pasted link sometimes isn't "hyperlinked" right to the end, resulting in the link not working? I had this happen in a post on a thread in Ask a Question, the second link down (see below). The 1.pdf is not in blue so a click results in a Page not Found instead of the article:

http://garden.org/thread/view_...
Image
Nov 18, 2016 7:31 AM CST
Garden.org Admin
Name: Dave Whitinger
Southlake, Texas (Zone 8a)
Region: Texas Seed Starter Vegetable Grower Tomato Heads Vermiculture Garden Research Contributor
Million Pollinator Garden Challenge Charter ATP Member I was one of the first 300 contributors to the plant database! Garden Ideas: Master Level Region: Ukraine Garden Sages
Special characters like parenthesis can break the script that converts URLs to hyperlinks. In the Garden.org code I look at certain characters (like spaces) to mean that a URL has ended. Until now, a parenthesis was treated as an end of the URL character.

I updated the code now to allow extra characters in URLs and they should work just fine now.
Image
Nov 18, 2016 8:17 AM CST
Plants SuperMod
Name: Joshua
Melbourne, Victoria, Australia (Zone 10a)
Köppen Climate Zone Cfb
Plant Database Moderator Forum moderator Region: Australia Cat Lover Bookworm Hybridizer
Orchids Lilies Irises Seed Starter Container Gardener Garden Photography
I assume you've taken care of the case where a URL is added to a post in parenthesis, such as "comment (URL)" or "comment (refer to URL)"? I find I often insert URLs that way and was glad Garden.org didn't mess that up (often other sites include the closing parenthesis as part of the URL).
Plant Authorities: Catalogue of Life (Species) --- International Cultivar Registration Authorities (Cultivars) --- RHS Orchid Register --- RHS Lilium Register
My Notes: Orchid Genera HTML PDF Excel --- Lilium Traits HTML PDF --- Lilium Species Crosses HTML PDF Excel --- Lilium Species Diagram
The current profile image is that of Iris 'Volcanic Glow'.
Image
Nov 18, 2016 8:36 AM CST
Garden.org Admin
Name: Dave Whitinger
Southlake, Texas (Zone 8a)
Region: Texas Seed Starter Vegetable Grower Tomato Heads Vermiculture Garden Research Contributor
Million Pollinator Garden Challenge Charter ATP Member I was one of the first 300 contributors to the plant database! Garden Ideas: Master Level Region: Ukraine Garden Sages
This is the regular expression I'm currently using:

$url = '#(^|[\n (])([\w]+?://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?<![\.,:])#is';

It does have the unfortunate side effect of including the trailing ) as part of the URL. I'm not sure what the right solution is, given that parenthesis in URLs are valid and legal. How can the system be programmed to know whether you intended that character to be a part of the URL, or rather the end of a sentence?
Image
Nov 18, 2016 8:43 AM CST
Garden.org Admin
Name: Dave Whitinger
Southlake, Texas (Zone 8a)
Region: Texas Seed Starter Vegetable Grower Tomato Heads Vermiculture Garden Research Contributor
Million Pollinator Garden Challenge Charter ATP Member I was one of the first 300 contributors to the plant database! Garden Ideas: Master Level Region: Ukraine Garden Sages
Joshua, I just updated the regexp again to try to fix that. Parenthesis at the end of a URL should work fine now.

(Testing: http://fshs.org/proceedings-o/...)
Image
Nov 18, 2016 6:02 PM CST
Plants SuperMod
Name: Joshua
Melbourne, Victoria, Australia (Zone 10a)
Köppen Climate Zone Cfb
Plant Database Moderator Forum moderator Region: Australia Cat Lover Bookworm Hybridizer
Orchids Lilies Irises Seed Starter Container Gardener Garden Photography
Thanks @Dave. I know it can be quite a pain to try to avoid, so all I could think of would be to check if there was a parenthesis just before the URL and pair it to one after the URL.

Otherwise I will fallback to my previous workaround, which was to include a space either side of the URL.
Plant Authorities: Catalogue of Life (Species) --- International Cultivar Registration Authorities (Cultivars) --- RHS Orchid Register --- RHS Lilium Register
My Notes: Orchid Genera HTML PDF Excel --- Lilium Traits HTML PDF --- Lilium Species Crosses HTML PDF Excel --- Lilium Species Diagram
The current profile image is that of Iris 'Volcanic Glow'.
Image
Nov 18, 2016 6:48 PM CST
Garden.org Admin
Name: Dave Whitinger
Southlake, Texas (Zone 8a)
Region: Texas Seed Starter Vegetable Grower Tomato Heads Vermiculture Garden Research Contributor
Million Pollinator Garden Challenge Charter ATP Member I was one of the first 300 contributors to the plant database! Garden Ideas: Master Level Region: Ukraine Garden Sages
Joshua, I got it fixed, actually. I'm checking to see if the URL ends with a parenthesis and if yes, don't include that last character in the URL. It's working well!! (Example: http://www.garden.org/)
Image
Nov 18, 2016 7:16 PM CST
Plants SuperMod
Name: Joshua
Melbourne, Victoria, Australia (Zone 10a)
Köppen Climate Zone Cfb
Plant Database Moderator Forum moderator Region: Australia Cat Lover Bookworm Hybridizer
Orchids Lilies Irises Seed Starter Container Gardener Garden Photography
Thank You!
Plant Authorities: Catalogue of Life (Species) --- International Cultivar Registration Authorities (Cultivars) --- RHS Orchid Register --- RHS Lilium Register
My Notes: Orchid Genera HTML PDF Excel --- Lilium Traits HTML PDF --- Lilium Species Crosses HTML PDF Excel --- Lilium Species Diagram
The current profile image is that of Iris 'Volcanic Glow'.
You must first create a username and login before you can reply to this thread.
  • Started by: sooby
  • Replies: 7, views: 425
Member Login:

( No account? Join now! )

Today's site banner is by RootedInDirt and is called "Botanical Gardens"

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.