Jump to content

formatted text + changing bullet point color


Recommended Posts

Hello

I'm using formatted text to create different paragraph styles, I have a question regarding how to include a bullet point of any other color than the paragraph color, can you help?

 

you posted a thread of how to change a bullet point color returning a field, this time i'm trying to return the resource + the bullet point color changed.

 

return Field("name").replace(/•/g,'<color name="THR Blue">•</color>');

 

thanks in advance

Link to comment
Share on other sites

It works only on the first line, see attachment

Well, I only see one bullet, and it seems to be in a different color than the text. So what's not working? How are you getting that output? I need a bit more to go on to troubleshoot. Maybe attach a minimal FusionPro template that demonstrates it.

Link to comment
Share on other sites

Here's the file, I'm trying to make a bullet point list, I used formatted text inside a rule, I hope it makes more sense when you see the file.

 

I have another question regarding formatted text, I'm using suppress if empty check box, but there is an extra space when that field is missing, and I don't know where to change it.

TESTFLY3-000-XX-00-16 EP.zip

Link to comment
Share on other sites

Thanks for attaching the job.

 

My first thought is that this seems unnecessarily complicated. You have a text frame, which calls out the rule "Professionalmem_PRULE", which returns the resource "PROFESSIONA_P", which in turn calls out the field "PROFESSIONAL MEMBERSHIPS (3-4 bullet points)". I don't see a need for a resource in there at all; just call out the data field directly in the text frame, and if you need to do something to tweak it, you can just call out a rule which returns the data field. The resource only adds an extra layer of complexity.

 

So the "Professionalmem_PRULE" rule can just do this to show the data in the output:

return Field("PROFESSIONAL MEMBERSHIPS (3-4 bullet points)");

And now we're back to the original problem, where you need to figure out how to change the color of the bullets in there. So we're basically back to the example in your first post:

return Field("PROFESSIONAL MEMBERSHIPS (3-4 bullet points)").replace(/•/g,'<color name="THR Blue-CMYK">•</color>');

This seems like it should work, and it does work in the Rule Editor when you click Validate, but there's a bit of hidden complexity at composition time, where the bullet character is sometimes treated as an eight-bit Latin-1 or Mac Roman character, and sometimes as a 16-bit Unicode character. And it can also be represented as an entity (•) in certain cases. This should handle all of those cases:

var bulletMatcher = new RegExp("([" + [Chr(149), Chr(165), Chr(8226)].join("") + "]|•)", "g")
return TaggedDataField("PROFESSIONAL MEMBERSHIPS (3-4 bullet points)").replace(bulletMatcher, '<color name="THR Blue-CMYK">$1</color>');

Note the call to TaggedDataField there. You probably want to do that anyway, in case the field contains certain characters which could be otherwise mistaken as tagged markup. This will also work correctly if the job is composed in MarcomCentral, where the data file actually is tagged markup.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...