Hi, Forum.
I was wondering if there is any way I could get Flare to automatically create a bookmark for every p.figure_caption style I create? Flare automatically recognizes heading styles as "cross-reference-able", so I was thinking that there might be some way to also make figure captions automatically "cross-reference-able"?
The only way I can think of doing this automatically is to make my figure captions a heading style - that way Flare will automatically include it in the list of cross-reference-able headings, and I won't have to manually add a bookmark. Clever, right? Not really...You see, it works if I create, say, h6.figure_caption, but only if I remove "mc-heading-level: 0" from h6. That's bad because I don't want h6 showing up in the TOC. But if I add "mc-heading-level: 0" to h6, then Flare doesn't recognize h6.figure_caption as a heading and it defeats the purpose - back to square one.
Is there another way to prevent a heading style from being included in the TOC?
Is there any other way I can achieve my goal of automatic bookmarks for figure captions?
Thanks,
Yossi Karp
Automatic Bookmarks as Part of the Style
-
kwag_myers
- Propellus Maximus
- Posts: 810
- Joined: Wed Jul 25, 2012 11:36 am
- Location: Ann Arbor, MI
Re: Automatic Bookmarks as Part of the Style
I tried playing around with p.TOC6 to see if I could find a way of hiding it (setting the color to white, negative top and bottom margins, etc.). But I couldn't get rid of the space in the TOC. I also tried replacing the TOC with a mini-TOC poxy (because you can set the heading levels to be included in the TOC). However, the result was a blank page and I couldn't figure out why.
Sorry, but I don't see how you can do it within Flare. I'm interested to see if someone comes up with a way to do it. If it were me, I'd write a VBS file to add the bookmarks, or do it manually.
Sorry, but I don't see how you can do it within Flare. I'm interested to see if someone comes up with a way to do it. If it were me, I'd write a VBS file to add the bookmarks, or do it manually.
"I'm tryin' to think, but nothin' happens!" - Curly Joe Howard
Re: Automatic Bookmarks as Part of the Style
I don't know if there is a more convenient way than inserting bookmarks manually.
I use a snippet that contains all elements i need for images.
This includes a dummy image, a dummy caption and a dummy bookmark.
Whenever i insert an image i insert that snippet, convert it into text and change the image url, adapt the caption and the bookmark.
So i have bookmarks for my images "semi-automatically".
Snippet looks like this:
I dont like the image caption to be the bookmark itself since in most cases the image caption is placed below the image (as you can see in my example snippet).
So if you select a hyperlink to that image you will see the image caption at the top of the screen but not the image itself because it is above the current viewport. You always would have to scroll up to see the full image.
I use a snippet that contains all elements i need for images.
This includes a dummy image, a dummy caption and a dummy bookmark.
Whenever i insert an image i insert that snippet, convert it into text and change the image url, adapt the caption and the bookmark.
So i have bookmarks for my images "semi-automatically".
Snippet looks like this:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<html>
<head>
</head>
<body>
<div class="figure">
<p><a name="[--- Enter bookmark here ---]" class="anchor"></a>
<img src=".../Images/Placeholder.png" title="Placeholder image" alt="Placeholder image" />
</p>
<p class="figcaption">Placeholder-Image - Enter description here.</p>
</div>
</body>
</html>So if you select a hyperlink to that image you will see the image caption at the top of the screen but not the image itself because it is above the current viewport. You always would have to scroll up to see the full image.
Re: Automatic Bookmarks as Part of the Style
Thank you for your answers. Kwag_myers, I appreciate the effort you went to to check out using p.TOC6. Do you have a good resource for implementing VBS scripts in Flare - sounds intriguing .
I think that the idea if building in a bookmark to every figure snippet is a clever idea. The problem with adding the bookmark to the graphic, rather than to the figure, is that you lose the ability to refer to a figure number in a cross reference - is that right?
Yossi Karp
I think that the idea if building in a bookmark to every figure snippet is a clever idea. The problem with adding the bookmark to the graphic, rather than to the figure, is that you lose the ability to refer to a figure number in a cross reference - is that right?
Yossi Karp
Re: Automatic Bookmarks as Part of the Style
Ah, yes, you're right.The problem with adding the bookmark to the graphic, rather than to the figure, is that you lose the ability to refer to a figure number in a cross reference - is that right?
I did not think of that.
In this case you indeed need to place the bookmark inside the paragraph that has the autonumber format.
-
kwag_myers
- Propellus Maximus
- Posts: 810
- Joined: Wed Jul 25, 2012 11:36 am
- Location: Ann Arbor, MI
Re: Automatic Bookmarks as Part of the Style
Unfortunately, I'm the best source I could find (with the help of Google and Stackoverflow.com). I've been teaching myself VBS over the years because I often work with Excel and Word periodicals and I use a lot of macros. I use scripts with Flare because the output files are overwritten on each build and there are customizations to the UI that I have to make which are not always available in Flare.yossikarp wrote:Thank you for your answers. Kwag_myers, I appreciate the effort you went to to check out using p.TOC6. Do you have a good resource for implementing VBS scripts in Flare - sounds intriguing .
In this scenario, you have to decide on a key to search for, such as Resources\Images\. Then copy the image file name (without the extension) and insert it as the bookmark. So your script would consist of the following segments:
1. Search the XML files in a folder for the syntax "Resources\Images\".
2. Copy between the last slash and period marking the file extension.
3. Paste "<a name="bookmark"></a> (where "bookmark" is the file name) before the <img syntax.
If I have some down time I can work on it, but I can't promise when that might be. Things are starting to stack up here in the mire.
"I'm tryin' to think, but nothin' happens!" - Curly Joe Howard
Re: Automatic Bookmarks as Part of the Style
This means you will have to create the topics without bookmarks for the figures first, apply the bookmarks using a script and then reopen all topics again where you want to link to those bookmarks.If it were me, I'd write a VBS file to add the bookmarks
[...]
1. Search the XML files in a folder for the syntax "Resources\Images\".
2. Copy between the last slash and period marking the file extension.
3. Paste "<a name="bookmark"></a> (where "bookmark" is the file name) before the <img syntax.
Sounds weird.
IMHO this is currently the only solution in Flare.[...] or do it manually.
Meanwhile i removed the bookmarks from my snippets and insert them manually when typing the figcaption.
I just insert my figure-snippet, adapt the path to the image, enter a figcaption, mark the figcaption, press [CTRL] + [SHIFT] + [K] (the "insert/edit bookmark dialog" opens) and press [ENTER] (the marked figcaption will be used as bookmark - whitespaces already converted to underscores - cool).
It is not as convenient as automatic bookmarks like in headings, but at least its an easy workaround since i can link to my figures while typing.
Feature-Request:
Anyway wouldn't it be cool if there would be a feature to select a template when inserting images.
If you don't select an image template, the <img> is inserted as is.
If you select one you could access all properties that are entered in the form as variables in the image template to create all those <figure> stuff you need. So you could create auto-bookmarks by using the alt, tooltip, tab index, image caption or the image filename in that image template.
(hope anyone get my meaning)
-
ChoccieMuffin
- Senior Propellus Maximus
- Posts: 2650
- Joined: Wed Apr 14, 2010 8:01 am
- Location: Surrey, UK
Re: Automatic Bookmarks as Part of the Style
Sounds like a cool feature request. To make it official, click the link in my post footer. And keep your fingers crossed...
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
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Re: Automatic Bookmarks as Part of the Style
Finally i have a workaround for this feature!
MadCap Flare uses the stylesheets of the primary target output when editing content.
So just use a special target output as the primary one wich is only used for editing - never for publishing.
For example call it "Only for Editing!".
In this output use a certain stylesheet - for example call it "edit.css".
In this stylesheet import the styles of your "real" primary target output at the very top of your file.
So you have the same styles available as in your "real" primary output.
You can override these styles but without having any effect to your "real" primary target output but only to MadCap Flare when editing content.
So this is my "edit.css" that is only used in my target output "Only for Editing!":I think you got the idea
Since the figcaption has a heading level set to 6 it will be "auto-cross-reference-able" when editing content.
But since i don't use this stylesheet in any other output but only for editing -> my figcaptions won't be displayed in any toc.
But the links and bookmarks will still work in any other output.
Cool, eh?
(This is by design! Not coincidental! MadCap automatically inserts anchor-links inside the target topic next to the "auto-cross-reference-able" element as soon as the element is selected as bookmark - at least when the TOC for the output is created. So it does not matter what heading level actually is set in the target outputs css when creating the output. An anchor is an anchor is an anchor is an ... independent of the css. But it does matter when creating the toc. Because therefore the actual heading levels of target outputs css are used to create the toc – not the anchor links in the content.)
To avoid accidently creating the target output "Only for Editing!" i changed it with an external editor to not contain any TOC.
No TOC -> no content -> no output.
The only downside is that you cannot use the buttons "Create/View/Publish primary" - since the primary target output is for editing only. You always have to select your "real" primary target output from the dropdown of these buttons.
But i can live with that.
MadCap Flare uses the stylesheets of the primary target output when editing content.
So just use a special target output as the primary one wich is only used for editing - never for publishing.
For example call it "Only for Editing!".
In this output use a certain stylesheet - for example call it "edit.css".
In this stylesheet import the styles of your "real" primary target output at the very top of your file.
So you have the same styles available as in your "real" primary output.
You can override these styles but without having any effect to your "real" primary target output but only to MadCap Flare when editing content.
So this is my "edit.css" that is only used in my target output "Only for Editing!":
Code: Select all
@charset "utf-8";
@import "MyRealPrimaryTarget.css";
@media print {
p.figcaption
{
mc-heading-level:6;
}
}
@media screen {
p.figcaption
{
mc-heading-level:6;
}
}Since the figcaption has a heading level set to 6 it will be "auto-cross-reference-able" when editing content.
But since i don't use this stylesheet in any other output but only for editing -> my figcaptions won't be displayed in any toc.
But the links and bookmarks will still work in any other output.
Cool, eh?
(This is by design! Not coincidental! MadCap automatically inserts anchor-links inside the target topic next to the "auto-cross-reference-able" element as soon as the element is selected as bookmark - at least when the TOC for the output is created. So it does not matter what heading level actually is set in the target outputs css when creating the output. An anchor is an anchor is an anchor is an ... independent of the css. But it does matter when creating the toc. Because therefore the actual heading levels of target outputs css are used to create the toc – not the anchor links in the content.)
To avoid accidently creating the target output "Only for Editing!" i changed it with an external editor to not contain any TOC.
No TOC -> no content -> no output.
The only downside is that you cannot use the buttons "Create/View/Publish primary" - since the primary target output is for editing only. You always have to select your "real" primary target output from the dropdown of these buttons.
But i can live with that.