Make hyperlinks from HTML

Get help using and writing Nisus Writer Pro macros.
Post Reply
User avatar
chazzo
Posts: 25
Joined: 2011-10-27 03:40:31
Location: Norfolk, UK

Make hyperlinks from HTML

Post by chazzo » 2012-03-09 04:18:52

I have a document that's full of hyperlinks in full HTML form:

Code: Select all

... for more information see <a href="http://example.com">this fine website</a>.
and I'd like to convert these to embedded NWP links:
... for more information see this fine website.
Could some kind person suggest a macro to do this?

I guess the macro would need to handle the case where the link text is the same as the URL:

Code: Select all

... for more information see <a href="http://example.com">http://example.com</a>.
and it might also be handy to have the option of converting plain URLs without the full <a href=...>...</a>:

Code: Select all

http://example.com
Would anyone else find this useful?

Thanks
Charles

User avatar
martin
Official Nisus Person
Posts: 4251
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Make hyperlinks from HTML

Post by martin » 2012-03-09 13:50:35

I'm attaching a macro that scans for the kinds of links you describe. It's a little picky about its matching, eg: the opening <a> tag must not have any other attributes besides "href", and the URL must be enclosed in straight quote marks. But hopefully you find it useful!
Attachments

[The extension nwm has been deactivated and can no longer be displayed.]


User avatar
chazzo
Posts: 25
Joined: 2011-10-27 03:40:31
Location: Norfolk, UK

Re: Make hyperlinks from HTML

Post by chazzo » 2013-02-21 04:13:28

Martin: for some reason I missed your reply. I'm sorry not to have thanked you before. That's very useful!

User avatar
martin
Official Nisus Person
Posts: 4251
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Make hyperlinks from HTML

Post by martin » 2013-02-21 19:12:59

No problem, I'm glad it was helpful!

nareng
Posts: 2
Joined: 2013-03-23 06:02:11

Re: Make hyperlinks from HTML

Post by nareng » 2013-03-23 06:07:36

Hello Martin,
Thank you very much for the HTML Macro!

When I write papers, my citation software (Bookends) is able to output:

<a href=”http://www.ncbi.nlm.nih.gov/entrez/quer ... s=23207973 “>PubMed Link</a>

When I run your macro, the URL is made into a link.
Might you have a Macro that links 'PubMed Link' with the URL (http://www.ncbi.nlm.nih.gov/entrez/quer ... s=23207973)


Thank you very much for any of your help!

Naren

nareng
Posts: 2
Joined: 2013-03-23 06:02:11

Re: Make hyperlinks from HTML

Post by nareng » 2013-03-23 06:22:04

Hello Martin,

I am looking for a Macro for creating HTML link from <a href="http://abc">PubMedLink</a>, so that there is a link for "PubMed link' created using "http://abc" but, "http://abc" does not appear on the document. Do you have a Macro to do this, please?

Thank you

Naren

User avatar
martin
Official Nisus Person
Posts: 4251
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Make hyperlinks from HTML

Post by martin » 2013-07-02 10:08:52

Hi Naren: I'm not sure I quite follow what you're trying to accomplish. Would you be able to attach a Nisus Writer file that shows a single example of the text before any link scanning takes place, and also shows the text how you'd like it to appear after a macro scan? The example wouldn't need to be a full document, just a snippet so it's clear what exactly you want to accomplish.

Post Reply