List of in-topic headings? (Flare 7)
-
stephencavers
- Jr. Propeller Head
- Posts: 9
- Joined: Tue Sep 14, 2010 1:51 pm
List of in-topic headings? (Flare 7)
I'm looking for a way to insert an auto-generated list of headings (H2 and lower) that are in the same topic — sort of like a mini-toc, but for the topic only. Is such a thing possible with Flare, or should I look elsewhere for a solution?
Re: List of in-topic headings? (Flare 7)
It isn't, sorry. My enhancement request from April 2011 (to offer two mini-TOC options, one for external TOC items, another for internal headings) was not addressed in Flare 8. Perhaps if others bombarded Flare with requests, we might see a resolution? Hint, hint, hint...
Good luck,
Leon
[RH had the internal-headings-only mini-TOC several years ago.]
Good luck,
Leon
[RH had the internal-headings-only mini-TOC several years ago.]
-
stephencavers
- Jr. Propeller Head
- Posts: 9
- Joined: Tue Sep 14, 2010 1:51 pm
Re: List of in-topic headings? (Flare 7)
Thanks, crdmerge. That's unfortunate news. I'll have to bug one of our developers for a custom script, I guess.
Re: List of in-topic headings? (Flare 7)
Would the List-Of proxy work in this case? I haven't looked at it in awhile, but I thought you could specify the tag to use to create a list from. In this case you'd select h2. Can't remember if it allowed for selecting multiple tags in the same list. If not, then you might not be able to get lower than h2, but again, haven't looked at the feature in awhile.
Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
Re: List of in-topic headings? (Flare 7)
You know, you're right, Lisa. I never considered that proxy!
But you can only select one tag, as you surmised. Still, that might help stephencavers.
Leon
But you can only select one tag, as you surmised. Still, that might help stephencavers.
Leon
-
stephencavers
- Jr. Propeller Head
- Posts: 9
- Joined: Tue Sep 14, 2010 1:51 pm
Re: List of in-topic headings? (Flare 7)
In case anyone finds this useful, here's a quick-and-dirty solution that we came up with.
1. In the Windows file browser, go to your Resources folder and add a new folder named "topicTOC".
2. In the topicTOC folder, create a new text file named topicTOC.js, open it in a text editor, and paste this code:
3. In Flare, right-click the master page and choose Open with... > Internal Text Editor.
4. Between the <head> and </head> tags, add these lines:
5. Here's the kludgy bit. You need a way to start the script when the page opens, but Flare strips onload from BODY tags when you generate output. The workaround is to insert a single-pixel transparent image and put the onload element in that. Add your image just after the opening <body> tag in the master page, like this (where the one-pixel image is "spacer.png"):
6. Now all you have to do is insert a placeholder where the in-topic TOC should appear. Open your topic in the Internal Text Editor, and add this DIV tag where you want your TOC to appear:
7. Save everything and generate the webhelp. If you did everything correctly, a bullet list should appear where you put that DIV tag in any topic.
1. In the Windows file browser, go to your Resources folder and add a new folder named "topicTOC".
2. In the topicTOC folder, create a new text file named topicTOC.js, open it in a text editor, and paste this code:
Code: Select all
function getElements()
{
var x=document.getElementsByTagName("h2"); // get list of H2 text
var returnvalue = "<ul>"; // start the list
for (var i = 0; i < x.length; i++)
{
// Add a list item with the heading text, linked to the numbered bookmark A NAME
returnvalue += "<li><a href='#toc" + i + "'>" + x[i].innerHTML + "</a></li>";
// insert a numbered A NAME in front of title
x[i].innerHTML = "<a name='toc" + i + "' />" + x[i].innerHTML;
}
returnvalue += "</ul>"; // close the list
document.getElementById("topicTOC").innerHTML = returnvalue; // insert the string where there's an id "topicTOC"
}
4. Between the <head> and </head> tags, add these lines:
Code: Select all
<script type="text/javascript" src="../../Resources/topicTOC/topicTOC.js">
</script>
Code: Select all
<img src="../Images/spacer.png" onload="getElements()" />Code: Select all
<div id="topicTOC"></div>
Re: List of in-topic headings? (Flare 7)
Can't you add the onLoad event to the body tag in the masterpage? That means it would load the script when each page loads, so you might want to create a second masterpage that has that onLoad event and only apply that masterpage to those topics where you insert the DIV and want the effect to appear.stephencavers wrote:5. Here's the kludgy bit. You need a way to start the script when the page opens, but Flare strips onload from BODY tags when you generate output. The workaround is to insert a single-pixel transparent image and put the onload element in that.
Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
-
stephencavers
- Jr. Propeller Head
- Posts: 9
- Joined: Tue Sep 14, 2010 1:51 pm
Re: List of in-topic headings? (Flare 7)
No, as far as I can tell, you can't add an onload to the body tag in the master page; Flare will omit it in the generated HTML. As I described, you can work around that by adding the single-pixel image to the master page, and the IMG tag supports onload.LTinker68 wrote:Can't you add the onLoad event to the body tag in the masterpage? That means it would load the script when each page loads, so you might want to create a second masterpage that has that onLoad event and only apply that masterpage to those topics where you insert the DIV and want the effect to appear.
Re: List of in-topic headings? (Flare 7)
I know others have put code in the masterpage and had it filter through to the topics. Perhaps one of them will post some instructions, or you could try searching through the forums.
Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
Re: List of in-topic headings? (Flare 7)
Hi all,
Just wanted to confirm whether this may have been included in V9? I've tried looking in the help and can't see anything obvious, but maybe my search-fu isn't working tonight.
If it hasn't been added I'll add my voice to the feature request database.
Thanks,
Amber
Just wanted to confirm whether this may have been included in V9? I've tried looking in the help and can't see anything obvious, but maybe my search-fu isn't working tonight.
If it hasn't been added I'll add my voice to the feature request database.
Thanks,
Amber