any solutions to make_clickable links problem, especially with PressBooks footnotes?

36 views
Skip to first unread message

jackdrty

unread,
Dec 17, 2014, 9:41:55 AM12/17/14
to press...@googlegroups.com
I'm looking for advice about the following problem, to which I've found an incomplete solution:

Problem: When importing text into my self-hosted PressBooks instance, I am tired of manually converting all URLs into clickable links.

Partial solution: I read about the WP make_clickable function:

I inserted the two recommended functions into the functions.php file of my preferred theme (PressBooks TextBook by Brad Payne at BCcampus). See my modified branch at

Like magic, the URLs in my main text now render as clickable links in the PressBooks web edition, as well as the exports. Furthermore, the function is designed to avoid screwing up links inside shortcodes, such as my iframes. 

But that's my new problem, because the function does NOT convert URLs into clickable links if they are located inside my PressBooks footnote shortcodes. As you recall, footnotes in PressBooks look like this:
Main text. [footnote]Here is the footnote, with link http://www.google.com.[/footnote]

Questions: 
Does anyone have a general solution to the manual conversion of URLs into clickable link issue?
Or if you like this partial solution with the make_clickable function, can anyone suggest how to recode it to work inside PressBooks footnote shortcodes, but NOT other shortcodes?

thanks
Jack

Hugh McGuire

unread,
Dec 17, 2014, 9:55:23 AM12/17/14
to jackdrty, press...@googlegroups.com
This is a general problem that is on the radar of things we need to address, though not top of list. So, we'd encourage attempts at solutions, and would be able to put some time into codereview, pulling quickly if someone solves it.

Some questions :

1. what is the format of the content that you are bringing into Pressbooks ? Word? Other? 
2. How are you importing? Copy-paste? Import tool? 
3. are the urls live in the source document, but getting de-linked in PB in importing?
or
4. are the urls not linked in the source document, but you would like PB to automagically linkify plaintext URLs? 
5. Is the problem seen across the board (ie in body text etc) ... 
6. Or, is the problem only seen in LINKED URLs inside Word Footnotes that get converted by PB Footnote converter (<-- a known problem)



--
You received this message because you are subscribed to the Google Groups "PressBooks" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pressbooks+...@googlegroups.com.
Visit this group at http://groups.google.com/group/pressbooks.


--
---------------------------------------------------------------
hughmcguire.net | twitter.com/hughmcguire 
skype. h.mcguire | tel. +1.514.464.2047
---------------------------------------------------------------

jackdrty

unread,
Dec 17, 2014, 10:17:01 AM12/17/14
to press...@googlegroups.com, jack...@gmail.com
Hugh, thanks for your response and questions. It all boils down to #6, a known issue. See my responses inserted below.


1. what is the format of the content that you are bringing into Pressbooks ? Word? Other? 
MS Word 
2. How are you importing? Copy-paste? Import tool? 
mostly copy-paste; the MS import tool does not work reliably for me, probably due to my formatting
 
3. are the urls live in the source document, but getting de-linked in PB in importing?
yes 
or
4. are the urls not linked in the source document, but you would like PB to automagically linkify plaintext URLs? 
 
5. Is the problem seen across the board (ie in body text etc) ... 
No, links in body text are clickable in the visual editor 
6. Or, is the problem only seen in LINKED URLs inside Word Footnotes that get converted by PB Footnote converter (<-- a known problem)
Yes, this is my problem. 


Hugh McGuire

unread,
Dec 17, 2014, 11:10:37 AM12/17/14
to jackdrty, press...@googlegroups.com
OK I think the best option then would be to fix the footnote conversion tool (which runs a javascript routine) to preserve linked urls. 

If anyone wants to look at the code, it should be here:

This is in our ticket pile, but as mentioned, not top of the heap.

--
You received this message because you are subscribed to the Google Groups "PressBooks" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pressbooks+...@googlegroups.com.
Visit this group at http://groups.google.com/group/pressbooks.

jackdrty

unread,
Jan 9, 2015, 4:17:21 PM1/9/15
to press...@googlegroups.com, jack...@gmail.com, Brad Payne
Big thanks to Brad Payne (@bdolor), who fixed the problem with this elegant one-line code revision:

Now all URLs inside footnotes will automatically be made clickable.

-Jack

Hugh McGuire

unread,
Jan 9, 2015, 4:18:43 PM1/9/15
to jackdrty, press...@googlegroups.com, Brad Payne
a thousand thank yous brad.

--
You received this message because you are subscribed to the Google Groups "PressBooks" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pressbooks+...@googlegroups.com.
Visit this group at http://groups.google.com/group/pressbooks.

bdolor

unread,
Jan 9, 2015, 4:30:58 PM1/9/15
to press...@googlegroups.com, jack...@gmail.com, bpa...@bccampus.ca
It's hard not to be happy with a one liner! 
Reply all
Reply to author
Forward
0 new messages