Jump to content

Bullet color change


carloscastro

Recommended Posts

Hello

I created this rule on a mac, I had success with a symbols like @,-,/, but not with the black dot •. It changes the color of the bullet when I have these symbols "@,-,/, " but not when I have the black dot "•".

 

this is the rule

return Field("Paragraph 3").replace(/•/g,'<color name="Lime">•</color>');

Link to comment
Share on other sites

Well, it's hard to say exactly what's going wrong without at least the data file, if not the rest of the job files. But it's likely either one of two things:

  1. The character in question in the data is not actually the same "black dot." There are multiple Unicode characters with a similar appearance.
  2. The data is already in a tagged markup format where the bullet character is represented with an entity such as "•".

Link to comment
Share on other sites

How can a make the rule with the bullet unicode?

I can't really answer the question in the abstract like that, without knowing what actual Unicode character you're using. You need to find that out.

 

Try this: Open up the data file in a text editor, look for one of the bullet characters, copy it, then paste it into a new JavaScript rule like this in place of the X:

return Asc("X");

Validate that rule and see what number it returns. Once we know that, we can write a rule to target that particular Unicode character.

Link to comment
Share on other sites

this is what it shows on the rule when I copy and Paste

 

return Field("PROFESSIONAL MEMBERSHIPS").replace(/ŀ/g,'<color name="Light Blue copy">ŀ</color>');

 

but on the data file it shows as a black dot

• that black dot is the same copy and paste from the rule

 

thanks

Link to comment
Share on other sites

this is what it shows on the rule when I copy and Paste

 

return Field("PROFESSIONAL MEMBERSHIPS").replace(/ŀ/g,'<color name="Light Blue copy">ŀ</color>');

Huh? I need you to try what I suggested in my previous post and tell me what number is returned.

• that black dot is the same copy and paste from the rule

That doesn't really help either, as the forum here may have changed it to a different character.

Link to comment
Share on other sites

Probably the easiest way to handle this would be to do a find/replace all on the "dot" in a text editor and replace it with the HTML bullet entity ()

 

But you could certainly try it this way too:

return Field("PROFESSIONAL MEMBERSHIPS").replace(new RegExp(Chr(8226), 'g'), '<color name="Lime">•</color>');

Link to comment
Share on other sites

when I upload the Product doesn't work there.

When you upload to where exactly? MarcomCentral? DSF? Some other web-to-print app?

I uploaded the project hopefully this might help

Yes, it does, thanks. I see a few problems:

 

1. The main problem is that you have a mixture of tagged markup and untagged "raw" text in your data file. For instance, the value of the "PROFESSIONAL MEMBERSHIPS" field starts with a literal bullet character •, then later it has some • entities. You need to decide whether you want to use tagged data or not, and be consistent. I would recommend NOT using tagged markup in the data, and just sticking with the bullet character.

 

2. If the template is uploaded to MarcomCentral or a similar app, and then being composed with data generated from a web form in that app, then that data is likely going to be comprised of tagged markup. So regardless of whether the data you're using at template design time is tagged markup or not, you still need to account for it. The easiest way to do this is to use the TaggedDataField function in place of the Field function; this always returns tagged markup, regardless of the data file format. (In general, if you have a rule returning tagged markup, you want to convert the data to tagged markup anyway, to avoid losing certain content such as ampersands.)

 

3. As I mentioned before, there are different representations of the bullet character. There's Unicode character 8226, Windows-1252 encoding character 149, Mac Roman encoding character 165, the • entity, and other similar Unicode characters at different code points. These are all perfectly valid representations, and you can't always anticipate which one is going to be used in the data, especially if the data is being generated from another app such as MarcomCentral. So, you need to write the code to potentially handle all of them.

 

So, I think that everything will work if you (a) change the data file to just use bullet characters instead of entities, and (b) change your rule to this:

return TaggedDataField("PROFESSIONAL MEMBERSHIPS").replace(
   new RegExp([Chr(149),Chr(165),Chr(8226),"•"].join("|"), "g"),
   '<color name="Light Blue copy">•</color>');

Link to comment
Share on other sites

Thank you very much for your response, now it worked with a little bug, you cannot hit enter to the text it won't go to the next line, and gives <p> tag as well

attached is the proof, this is a DSF fusion pro template

Okay, thanks for the info. Are you using the TaggedDataField function in your rule? Presumably, the DSF application is putting <p> tags in the data file that it's generating, and those should be simply passed through to FusionPro's tagged markup parser. Why that's not working is hard to say without all of the actual composition files, including the generated data file and the generated CFG file. Can you retrieve those from the DSF server?

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...