How do I count all the links in my project?

This forum is for all Flare issues related to the HTML5, WebHelp, WebHelp Plus, and Adobe Air Targets
Post Reply
sanjsrik
Sr. Propeller Head
Posts: 103
Joined: Wed Nov 03, 2010 12:57 pm

How do I count all the links in my project?

Post by sanjsrik »

I'm trying to find a report, method, any way through the Flare app to generate a number of how many links there are in my project. I just need a number such as "there are NN of links in the project". I've looked in the reports, I have looked in the help and there's nothing for "counting links".

thanks in advance.
DAV
Propeller Head
Posts: 16
Joined: Thu Jun 14, 2012 12:05 am

Re: How do I count all the links in my project?

Post by DAV »

Hello!
If you have Linux command line you can execute this command:

Code: Select all

find . -name "*.htm" -exec grep -o "href" '{}' \; | wc -l
Result number should be devided by 2.
If you don't have Linux you can use Cygwin on Windows.
sanjsrik
Sr. Propeller Head
Posts: 103
Joined: Wed Nov 03, 2010 12:57 pm

Re: How do I count all the links in my project?

Post by sanjsrik »

Flare is a Windows application. I run Linux at home. Not sure that I can run Windows-reliant apps (perhaps using Wine or some other emulator) but your method implies that I'm running Linux on my Windows machine.

I am sure I can get wingrep to do what is here, but I was just hoping that Flare had a report that showed number of links. This seems to come up once in a while when QA asks how many links are actually in the help project we're working on currently. Would be nice to just run a report that shows this statistic. I think the reporting went so far to be "in-depth" that it doesn't have basic information available any more.

Thanks for the suggestion (meant to write that originally).
DAV
Propeller Head
Posts: 16
Joined: Thu Jun 14, 2012 12:05 am

Re: How do I count all the links in my project?

Post by DAV »

sanjsrik wrote:Flare is a Windows application. I run Linux at home. Not sure that I can run Windows-reliant apps (perhaps using Wine or some other emulator) but your method implies that I'm running Linux on my Windows machine.
No, you should just to install Cygwin (Linux command line emulator for Windows). I have tested this command there.
I agree it more convenient when Software has all what you need, but sometimes it's impossible.
Note that you can use command line for all tasks what you can imagine.
For example this command can count any tags, words or phrases.
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: How do I count all the links in my project?

Post by NorthEast »

Depends what you class as a 'link', and whether you mean source or output.

For example, if you just want to count hyperlinks and cross-references in your source files, you could just use find to see how many results you get; e.g. find "<MadCap:xref" to count xrefs, or perhaps "<a href" to find links.

If you want to count all links in your output, third-party tools will do that, but it's going to also include breadcrumbs, drop downs, togglers, skin menu/TOC items, etc.
sanjsrik
Sr. Propeller Head
Posts: 103
Joined: Wed Nov 03, 2010 12:57 pm

Re: How do I count all the links in my project?

Post by sanjsrik »

I still have to ask, why doesn't the software have a basic "links" count with all the parameters mentioned by Dave here? Why has the software gotten SO complicated that the basics are missing?
Nita Beck
Senior Propellus Maximus
Posts: 3672
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: How do I count all the links in my project?

Post by Nita Beck »

(Preface: Sanjay, I hope you don't take anything I'm about to write personally, and please know that I most certainly respect your viewpoint! I'm engaging in a conversation with a fellow professional about a question he's raised.)

I agree with Dave, that it depends on what you consider a link and whether you're talking source or output.

I have a very large Flare project that probably has thousands of links between files -- from files to stylesheets; from topics to snippets, variable sets, condition sets; from stylesheets to images used as backgrounds as well as to other stylesheets; from targets to TOCs, skins, stylesheets, variable sets, condition sets; and on and on. I cannot see the point at all of knowing how many "links" there are among all the files in my project.

And what if my project were one that used Flare's Runtime Merging feature to pull in output from OTHER Flare projects into order to produce one grand output? Should Flare go out to those "child" projects to fetch their number of "links" too?

Furthermore, even if Flare were able to report on the number of "links" in the project, there will be "uncounted" links until it generates output. Consider how some Flare authors use relationship tables so that Flare will generate links automatically. Flare can't "know" ahead of time how many generated links there might be in generated output because it does not gather all the files to put into an output until it builds (as well as excluding some files from that output because of conditions).

Perhaps you did not mean how many links in your project but instead how many links in generated output. I can (sort of) understand someone caring about how many links there are in generated output, although I can't imagine for what purpose. AFAIK, no, Flare is not programmed to examine output that way.

I dunno, it doesn't at all seem like a basic thing to expect Flare to be able to "count links".
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
sanjsrik
Sr. Propeller Head
Posts: 103
Joined: Wed Nov 03, 2010 12:57 pm

Re: How do I count all the links in my project?

Post by sanjsrik »

Why would I be offended at your opinion?

Have you seen some of the reports that Flare can produce? They're very in-depth. So, if the software can report on those types of issues within a project, giving me a report that allows me to choose what type of links I'd like to know about doesn't seem all that far-fetched. All your points are valid, and those should be choices in a links report.

I shouldn't have to use an outside utility to see what types of links exist in my project.
Nita Beck
Senior Propellus Maximus
Posts: 3672
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: How do I count all the links in my project?

Post by Nita Beck »

sanjsrik wrote:Why would I be offended at your opinion?
Thanks. Sometimes I know I am strong in my opinion and I worry that I'll offend others. I try never to be disrespectful and I'm glad that you're not offended. :)
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
RamonS
Senior Propellus Maximus
Posts: 4293
Joined: Thu Feb 02, 2006 9:29 am
Location: The Electric City

Re: How do I count all the links in my project?

Post by RamonS »

Out of pure curiosity, what is the value in knowing how many links of any kind there are? Is it better if there are 5000 links versus 500? Maybe there is no such report because the need for such a metric is not obvious.
sanjsrik
Sr. Propeller Head
Posts: 103
Joined: Wed Nov 03, 2010 12:57 pm

Re: How do I count all the links in my project?

Post by sanjsrik »

When you have to report on metrics, all companies are different. What you may consider "not important" to your needs is not what all companies consider important to theirs. There are in fact many uses for knowing how many links there are in a project, both by type as well as overall number.

For example, and no, this is not why I need them, when QA goes through help output they might compare how many links there are to how many are reported to make sure that they match, however, I cannot provide that number. This could be a secondary check to know that nothing has been corrupted in the staging to prod server scrape using an RPM and Jenkins to do the job.

Just because you don't consider it important, don't discount it for everyone. Otherwise, why would people like Apple? (no, I have no answer for this one)
RamonS
Senior Propellus Maximus
Posts: 4293
Joined: Thu Feb 02, 2006 9:29 am
Location: The Electric City

Re: How do I count all the links in my project?

Post by RamonS »

Thanks for the response. I know others operate differently....still leaves me scratching my head. In 20 years doing QA I never counted links in help. Counting links in the project and in the output only and getting a difference only shows that either old output was used, that either count is wrong, or that it indeed is perfectly fine the way it is due to conditions applied in the target. If there is a need to make the math come out right I'd just put a few nonsensical links in place or take a few out if that makes QA happy. Metrics are nice, but they often do not tell you a lot about quality. What I do is check for dead links and make suggestions to the tech writer on what to link together or not, but that decision is in the end a content/design decision, not a matter of quality. Likewise, as QA I do not dictate if a developer uses a temp table, an array, or an object. As long as the specs and requirements are met the quality goals are mainly achieved. If such a requirement is to have 50123 links in the help I would seriously object to that. Test if the help output is technically sound and content is correct (means that steps 1-5 in a topic are indeed the steps needed to accomplish the described task). More importantly check that the content is clear, helpful, and easy to navigate. Those are subjective assessments that do not come with any metrics (although clarity of text has some means to be measured). If anything I'd analyze link depth and evaluate each case to see if there are reasonable means to flatten the structure as that makes it in some cases easier to navigate, but that depends heavily on the what and why.
Do whatever is needed to satisfy the demands of the product owner. If she/he asks for link counts in the project give Notepad++ a try, you can search across multiple files and use a regex to find any links and request a count. I wouldn't trust that number too much because a good number of links might be generated at build time.

So let me rephrase my statement: Counting links is probably not requested by enough users for MadCap to see a value in creating such a report. How's that?
sanjsrik
Sr. Propeller Head
Posts: 103
Joined: Wed Nov 03, 2010 12:57 pm

Re: How do I count all the links in my project?

Post by sanjsrik »

So I remember interviewing many years ago at a company that has its own financial news network whose namesake was the mayor of NYC for a while. Do you know how they count if a tech writer is doing is job? By daily page counts. You are expected to produce X number of pages per day. I scratched my head, thanked them, and never went back.

The statistics people use are sometimes very bizarre. I don't question, just smile and nod.
ChoccieMuffin
Senior Propellus Maximus
Posts: 2650
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: How do I count all the links in my project?

Post by ChoccieMuffin »

sanjsrik, did you watch the Analyzer webinar that was just on? You could have asked on there if there was a way. I would have done but got called away by a colleague so didn't hear all the questions at the end.

(And I'm completely with you on the nodding and smiling thing - sometimes that's the only way to keep your sanity.)
Started as a newbie with Flare 6.1, now using Flare 2024r2.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
SteveS
Senior Propellus Maximus
Posts: 2090
Joined: Tue Mar 07, 2006 5:06 pm
Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
Contact:

Re: How do I count all the links in my project?

Post by SteveS »

Analyzer does have a report for External Links...
Image
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
jjw
Sr. Propeller Head
Posts: 133
Joined: Thu May 08, 2014 4:18 pm
Location: Melbourne

Re: How do I count all the links in my project?

Post by jjw »

You could query the SQLite database in the Analyser folder (Content9.s3db). It has an OutgoingLink table that includes a LinkTag column, so you could filter out undesirable link types (like links to images or snippets or whatever) and just count hyperlinks or cross references for example.

I've been using "SQLite Expert" but there are a bunch of other free SQLite browsers out there. Or you can import the table into Excel with the SQLite ODBC drivers at http://www.ch-werner.de/sqliteodbc/.

J
Nita Beck
Senior Propellus Maximus
Posts: 3672
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: How do I count all the links in my project?

Post by Nita Beck »

J's idea is an interesting one. But I suspect that it still won't account for all the generated links that are created at build time, such as breadcrumb links, miniTOC links, relationship table links, side menu links (in Top Nav). None of those exist in the source files that Analyzer examines and whose dependencies it tracks.
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
jjw
Sr. Propeller Head
Posts: 133
Joined: Thu May 08, 2014 4:18 pm
Location: Melbourne

Re: How do I count all the links in my project?

Post by jjw »

True, it comes down to why you're counting links in the first place I guess. If you want to search in the output then it would be easier to use a tool like PowerGREP or similar.

Actually I've never used the database for counting links (not having any reason to do so). The main use I can think of for it is to look for missing links - like images that don't have any links pointing to them (that I can safely delete), or topics that aren't in any toc. I have to admit that I wrote a bunch of sql scripts when I first started using Flare but I very rarely used them (probably because I have a high mess tolerance and I don't feel the need to tidy up my horrible Frankenstein-monster of a project).

J
MattyQ
Sr. Propeller Head
Posts: 136
Joined: Tue Sep 30, 2014 7:10 am
Location: Roanoke, VA

Re: How do I count all the links in my project?

Post by MattyQ »

I created a utility that recurses on the output of Flare to check for broken links, categorizes the results by internal links, bookmarks, cross-project links, and external links, and outputs an HTML report. It would be fairly trivial to switch it so it just returns the number of links for each, rather than ones that are just broken, if that would be useful. (I suppose, technically, it would work on any local web directory, but the utility is written to account for Flare's nuances.)

It's part of a set of automation utilities for Flare I'm working on for my organization, but nothing really proprietary in this one, if you want to give it a shot.
Carlsen
Propeller Head
Posts: 43
Joined: Fri Apr 08, 2011 2:30 pm

Re: How do I count all the links in my project?

Post by Carlsen »

Why not just use MadCap Analyzer? I'm surprised no one else mentioned that. One of its report types is called "External Links". It counts up every link in your Flare project that goes to the World Wide Web. This excludes cross references and hyperlinks to topics within your project. It doesn't seem to take into account what some others have mentioned, such as project merging, etc. but it's not meant to because you run it on a single project.

I don't see a report for counting cross references, but it may be in here and I'm just not seeing it.

The one caveat is that it doesn't count unique links, so if you have ten links to www.amazon.com, it will count it ten times. So I just ran it on my project, and it counts 200 links. I can sort on the links and see that some are repeated 8 times. But since I'm generating seven output types this doesn't bother me much.

Anyway, just thought I would point out this other MadCap tool that may get you closer to where you want.
SteveS
Senior Propellus Maximus
Posts: 2090
Joined: Tue Mar 07, 2006 5:06 pm
Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
Contact:

Re: How do I count all the links in my project?

Post by SteveS »

Carlsen wrote:Why not just use MadCap Analyzer? I'm surprised no one else mentioned that. One of its report types is called "External Links". It counts up every link in your Flare project that goes to the World Wide Web. This excludes cross references and hyperlinks to topics within your project. It doesn't seem to take into account what some others have mentioned, such as project merging, etc. but it's not meant to because you run it on a single project.

I don't see a report for counting cross references, but it may be in here and I'm just not seeing it.

The one caveat is that it doesn't count unique links, so if you have ten links to http://www.amazon.com, it will count it ten times. So I just ran it on my project, and it counts 200 links. I can sort on the links and see that some are repeated 8 times. But since I'm generating seven output types this doesn't bother me much.

Anyway, just thought I would point out this other MadCap tool that may get you closer to where you want.
See my post (above)...
Image
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
Carlsen
Propeller Head
Posts: 43
Joined: Fri Apr 08, 2011 2:30 pm

Re: How do I count all the links in my project?

Post by Carlsen »

@SteveS
So short and to the point, I missed it. :D
SteveS
Senior Propellus Maximus
Posts: 2090
Joined: Tue Mar 07, 2006 5:06 pm
Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
Contact:

Re: How do I count all the links in my project?

Post by SteveS »

Carlsen wrote:@SteveS
So short and to the point, I missed it. :D
Yep.
Image
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
SteveS
Senior Propellus Maximus
Posts: 2090
Joined: Tue Mar 07, 2006 5:06 pm
Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
Contact:

Re: How do I count all the links in my project?

Post by SteveS »

:D (wasn't going to use a smilie when I was being succinct)
Image
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
Post Reply