Formatting Variables: Only Works Sometimes

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.
Post Reply
Curlyshell
Propeller Head
Posts: 65
Joined: Fri Mar 01, 2019 9:14 am

Formatting Variables: Only Works Sometimes

Post by Curlyshell »

I have a style to mimic the look of a button in our software by adding a background color and a rounded border.

Some buttons contain MadCap variables. Normally, styling works fine with variables - such as in headers, or when bolding.

Code: Select all

Click <span class="ButtonLD">Add/Edit <MadCap:variable name="Labdaq Aliasing.Patient" class="Initial-Caps" /></span>
The HTML5 target is just peachy! All aspects of my formatting appear as expected. But for the PDF target, only some of the formatting works. To wit:

[*]The font and size of the variable match the rest of the text.
[*]The border surrounds all the text (including the variable).
[*]The right and left padding is absent from all my button text in PDF (including non-variable text).
[*]The gray background is PRESENT for the common text but ABSENT for the variable.
temp.png
(Don't mind the deliberate differences between the buttons, such as font size.)

My point is that the variable, "Patient," in the HTML5 button looks like the rest of the text, but "Patient" in the PDF button loses the background. ALSO, there's supposed to be a 4-pt right-left padding on the PDF button, but it's missing in all cases, with or without the variable—though the 4px right-left padding works just fine in the HTML5 output.

And...yes, I do understand that I have to pay attention to the PDF vs. the HTML medium in my style sheet.
You do not have the required permissions to view the files attached to this post.
Last edited by Curlyshell on Thu Sep 26, 2019 5:49 am, edited 1 time in total.
"I'm a technical writer, not a developer," she said...
ajturnersurrey
Sr. Propeller Head
Posts: 346
Joined: Fri Nov 05, 2010 3:30 am

Re: Formatting Variables: Only Works Sometimes

Post by ajturnersurrey »

Sorry, this is not a solution, but I have had a similar experience and would like to compare notes.

My button names are in snippets rather than variables, but I also found that I could not get padding respected when building a pdf.

After much experimentation I settled for this:

html5:
html5_button.png
pdf:
pdf_button.png
This comes from the topic content:

Code: Select all

Then use the <span class="SWbutton"><MadCap:snippetText src="../Resources/Snippets/Button_Search.flsnp" /></span> or
In the snippet file my button name is wrapped around by non-breaking spaces:

Code: Select all

<body>   Search   </body>
In the css I can then have something that is identical for html5 or pdf, albeit some of the settings are ignored in pdf...

Code: Select all

span.SWbutton
{
	border-color: #ababaa;
	border: solid 1px #ababaa;
	background: #dcdcdc;
	color: #000000;
	text-align: center;
	vertical-align: middle;
	border-radius: 3px;
	-moz-border-radius: 3px;
	-webkit-border-radius: 3px;
	padding-bottom: 3px;
	font-size: 0.8em;
	padding: 3px;
	display: inline-block;
	font-weight: normal;
	background-clip: border-box;
	line-height: 1.8;
	padding-left: 1px;
	padding-right: 1px;
	padding-top: 3px;
	margin-top: 3px;
	margin-bottom: 3px;
}
I'm far from happy with the solution, but it passed review for me to get the docs published. If I find a better way I will be quick to change!
You do not have the required permissions to view the files attached to this post.
Curlyshell
Propeller Head
Posts: 65
Joined: Fri Mar 01, 2019 9:14 am

Re: Formatting Variables: Only Works Sometimes

Post by Curlyshell »

I put in a bug report for this. I also mentioned your snippets.

And I found something else: some of my buttons have a little drop-down arrow, so I added a transparent graphic to the text. But it's white in the PDF.
"I'm a technical writer, not a developer," she said...
ajturnersurrey
Sr. Propeller Head
Posts: 346
Joined: Fri Nov 05, 2010 3:30 am

Re: Formatting Variables: Only Works Sometimes

Post by ajturnersurrey »

So far as I am aware transparency has never been well respected in Flare pdfs.

I have dealt with the occasional 'on button arrow' this way:

On html5:
html5_button_arrow.png
On pdf:
pdf_button_arrow.png

In this case my button snippet looks like this

Code: Select all

<body>   <img src="../Images/EdgeConnector_logos_and_icons/green_arrow.png" class="icon_on_grey" alt="green forward arrow" />Next   </body>
where green_arrow.png is a green arrow with a transparent background

and img.icon_on_grey in the css looks like this in the default medium (collecting the background it ought to have from being transparent!):

Code: Select all

	img.icon_on_grey
{		background: #dcdcdc;
		margin: 0px;
		vertical-align: 0;
		max-height: 1.2em;
		display: inline-block;
		padding-bottom: 3px;
		margin-bottom: -3px;
		margin-top: 0px;
		padding-top: 0px;
}
and has this correction in the print medium (because otherwise I kept ending up with a tiny bit of white top/bottom):

Code: Select all

	max-height: 1.5em;
You do not have the required permissions to view the files attached to this post.
Curlyshell
Propeller Head
Posts: 65
Joined: Fri Mar 01, 2019 9:14 am

Re: Formatting Variables: Only Works Sometimes

Post by Curlyshell »

This has been entered as Bug #154537.
"I'm a technical writer, not a developer," she said...
doloremipsum
Sr. Propeller Head
Posts: 290
Joined: Mon Aug 26, 2019 2:11 pm

Re: Formatting Variables: Only Works Sometimes

Post by doloremipsum »

Probably an obvious question, but it has to be asked - neither of you have any styling on the Madcap variable or Madcap snippettext selectors respectively?
in hoc foro dolorem ipsum amamus, consectimur, adipisci volumus.
ChoccieMuffin
Senior Propellus Maximus
Posts: 2632
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Formatting Variables: Only Works Sometimes

Post by ChoccieMuffin »

doloremipsum wrote:Probably an obvious question, but it has to be asked - neither of you have any styling on the Madcap variable or Madcap snippettext selectors respectively?
It isn't possible to define the style for a variable in your stylesheet. But I don't understand what you mean by " Madcap snippettext selectors". If you mean <MadcapSnippetBlock> or <MadcapSnippetText> as it appears in the topic, then you can't define its style in the stylesheet either - and that's exactly the point of variables and snippets, that they should take the style of whatever they're inserted into.
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
tnordling
Jr. Propeller Head
Posts: 3
Joined: Wed Oct 02, 2019 11:53 am

Re: Formatting Variables: Only Works Sometimes

Post by tnordling »

Noob here, two weeks into Flare trial. I can definitely agree that there seems to be very different behaviors from the rendering engine for screen/preview, HTML, and PDF output. Having a heck of a time getting <span> elements to inherit the font size of their surrounding text. Ditto for just using <b></b> tags. If I use a <span> class to format, say, the background color, my body copy changes from the body-copy font size to 10pt even though there's no font size specified in the span class. But only in PDF output. I'm genuinely curious where it's getting the 10pt from, except that my academic interest in this behavior is giving way to impatience. I don't want to specify a font size in my span classes! I resorted to using a CSS variable (body-font-size), but the PDF output ignores that, too. Hmmmmmm.
doloremipsum
Sr. Propeller Head
Posts: 290
Joined: Mon Aug 26, 2019 2:11 pm

Re: Formatting Variables: Only Works Sometimes

Post by doloremipsum »

ChoccieMuffin wrote:
doloremipsum wrote:Probably an obvious question, but it has to be asked - neither of you have any styling on the Madcap variable or Madcap snippettext selectors respectively?
It isn't possible to define the style for a variable in your stylesheet. But I don't understand what you mean by " Madcap snippettext selectors". If you mean <MadcapSnippetBlock> or <MadcapSnippetText> as it appears in the topic, then you can't define its style in the stylesheet either - and that's exactly the point of variables and snippets, that they should take the style of whatever they're inserted into.
I beg to differ! Check out this page in the help and CTRL+F for 'snippet' and 'variable': https://help.madcapsoftware.com/flare20 ... erties.htm
in hoc foro dolorem ipsum amamus, consectimur, adipisci volumus.
NorthEast
Master Propellus Maximus
Posts: 6365
Joined: Mon Mar 05, 2007 8:33 am

Re: Formatting Variables: Only Works Sometimes

Post by NorthEast »

doloremipsum wrote:
ChoccieMuffin wrote:
doloremipsum wrote:Probably an obvious question, but it has to be asked - neither of you have any styling on the Madcap variable or Madcap snippettext selectors respectively?
It isn't possible to define the style for a variable in your stylesheet. But I don't understand what you mean by " Madcap snippettext selectors". If you mean <MadcapSnippetBlock> or <MadcapSnippetText> as it appears in the topic, then you can't define its style in the stylesheet either - and that's exactly the point of variables and snippets, that they should take the style of whatever they're inserted into.
I beg to differ! Check out this page in the help and CTRL+F for 'snippet' and 'variable': https://help.madcapsoftware.com/flare20 ... erties.htm
CM is actually correct.

Although you can set styles for variables and snippets, this doesn't change how they look in the output, only how they appear in the XML editor.
Flare help wrote:MadCap|variable

Modifies the look of variables that have been inserted in the XML Editor.

For example, if you want all of your variables to stand out with a blue font—making it easier to identify them as you work—you can use this style.

This style does not affect the output.
robdocsmith
Sr. Propeller Head
Posts: 248
Joined: Thu May 24, 2018 3:11 pm
Location: Queensland, Australia

Re: Formatting Variables: Only Works Sometimes

Post by robdocsmith »

This doesn't help that much but it does make it easier to add left/right padding without having to code a snippet per button. If you add the before and after selectors to your element:

Code: Select all

css:
.ButtonLD::before, .ButtonLD::after {
   content:"   ";
   background-color: #dcdcdc;
}
the content is then always centred within the span - you need to apply the background-color to the before and after elements too.

Shame that Flare doesn't seem to accept multiple background images, because you might be able to otherwise do something fancy with a fixed left and right image and a repeating centre one.

The only other solution I can suggest (and one that looks pretty good and will match your online output) is if you know that your buttons are generally either fixed width or fall within a small number of widths. You might then be able to code a fixed blank button background image for each button width, centering the text within it. No white on grey issue with the variable in this case. However, if you did this, you would have to make it a block element and float it left (and the previous text will also have to be block/float left) with a clear afterwards. Perhaps it is overly complicated to implement - would depend on your use case. Whether the good appearance justified the effort needed to implement and maintain it.

Cheers,

Rob
Curlyshell
Propeller Head
Posts: 65
Joined: Fri Mar 01, 2019 9:14 am

Re: Formatting Variables: Only Works Sometimes

Post by Curlyshell »

FOLLOW-UP: MadCap says they use a third-party engine to produce the PDF, and the bug lives in the engine. So it's not getting fixed as far as I can tell.
"I'm a technical writer, not a developer," she said...
ChoccieMuffin
Senior Propellus Maximus
Posts: 2632
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Formatting Variables: Only Works Sometimes

Post by ChoccieMuffin »

Curlyshell wrote:FOLLOW-UP: MadCap says they use a third-party engine to produce the PDF, and the bug lives in the engine. So it's not getting fixed as far as I can tell.
There are several PDF buggy things knocking around. I wonder if they're planning on upgrading the PDF third-party tool any time soon?
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Post Reply