hyperlinks in webhelp --> crossrefs for PDF output

This forum is for Single-Sourcing your Flare content to multiple outputs.
Post Reply
kevinmcl
Sr. Propeller Head
Posts: 252
Joined: Mon Sep 11, 2006 10:58 am

hyperlinks in webhelp --> crossrefs for PDF output

Post by kevinmcl »

G'day, all.

Is there an automatic, or semi-automatic way, within Flare, to convert many hundreds of topic-to-topic hyperlinks into Cross References?

Every topic has one (and only one) H1 heading.

Or am I stuck with manually finding every hyperlink, manually opening its target topic, manually placing markers, manually editing the original topic to replace hyperlink by cross-ref...??

Thanks,

-k
De gustibus non disputandum est
wbrisett
Sr. Propeller Head
Posts: 216
Joined: Mon Oct 05, 2009 3:29 pm
Location: Austin, TX

Re: hyperlinks in webhelp --> crossrefs for PDF output

Post by wbrisett »

Kevin:

There are trivial differences between the two, and hyperlinks do work in a PDF. Obviously there are some reasons you would want to convert from one to another (updates is a biggie). However, unless there are some major reasons to change, then I'm not sure I would do so.

That being said, there are lots of ways to script what you want (I tend to write mine in Ruby, but any language works).

Wayne
nickatwork
Sr. Propeller Head
Posts: 457
Joined: Thu Sep 16, 2010 6:31 am
Location: London

Re: hyperlinks in webhelp --> crossrefs for PDF output

Post by nickatwork »

You could use Find/Replace with regular expressions to do this. Will have to do it in a couple of steps, but it will automate the whole thing for you.

Are your hyperlinks somehow uniform or sharing some similar kind of code? For example <a href="../../Help/Home.htm">Welcome</a>

A cross reference of that same code would be <MadCap:xref href="../../Help/Home.htm"><i>Online Help</i></MadCap:xref>

Pretty much all you need to do is change the [a] to [MadCap:xref] and the [/a] to [/MadCap:xref]

but we need to be able to find a part of the link that you can search on, for example the ../../ otherwise any search will pick up all hyperlinks in your project which maybe you don't want - if you have links to external websites then it will pick up these as well.

Let us know...
Nick
kevinmcl
Sr. Propeller Head
Posts: 252
Joined: Mon Sep 11, 2006 10:58 am

Re: hyperlinks in webhelp --> crossrefs for PDF output

Post by kevinmcl »

OK, but nothing to be done using Flare itself, then?

I was thinking that if Flare offered an approach, within the interface, it might pop up a target picker, for refining the xref text on-the-fly.

Maybe I'll dig up my old copy of RegexBuddy.

Or... Ruby, huh? I had started sniffing around the edges of PHP, but maybe Ruby is an alternative. Anything to recommend one over the other, for somebody who rarely has need to program anything?

Thanks, guys.

-k
De gustibus non disputandum est
wbrisett
Sr. Propeller Head
Posts: 216
Joined: Mon Oct 05, 2009 3:29 pm
Location: Austin, TX

Re: hyperlinks in webhelp --> crossrefs for PDF output

Post by wbrisett »

kevinmcl wrote:OK, but nothing to be done using Flare itself, then?
You can do a search and replace within Flare if you want. I just find it's much slower. It accepts regular expressions, so you can go that route if you want.
kevinmcl wrote: Or... Ruby, huh? I had started sniffing around the edges of PHP, but maybe Ruby is an alternative. Anything to recommend one over the other, for somebody who rarely has need to program anything?
It's all in what you learned, or want to learn. Ruby, for me at least, is easy to learn, compact, and a real object oriented language. You can take what you learn in Ruby and slap one of the many web frameworks (Rails, Sinatra, etc.) around your code and start doing some cool web stuff as well.

There are also some very nice XML parsers within the Ruby community that I currently use to rewrite HTML files into valid XML DITA files. I previously did this in another language without the parser helpers and my code quickly got out of hand. ;)

Wayne
Post Reply