Jump to content

Horizontal Scale Rule Ampesand Issue


Brad Sawatzky

Recommended Posts

I'm currently working on a business card template that uses a rule I found on this forum to horizontally scale my "Title" field, and I've run into a problem with ampersands. The rule looks like this:

 

return '<magnify type=setwidth factor=91.72>' + NormalizeEntities (Field("Title")) + '</magnify>';

 

Everything composes correctly, but when I load it to my DSF and test it, ampersands in my "Title" field return: "Barrister & Solicitor"

 

I have "Treat returned strings as tagged text" box checked, but I'm not sure how to tweek the rule to return "Barrister & Solicitor"

 

Any assistance would be appreciated.

 

Thanks,

Link to comment
Share on other sites

The DSF is using tagged markup input, which already has entity replacements, while your local composition uses flat file input. The way to resolve this is with the TaggedDataField function, like so:

return '<magnify type=setwidth factor=91.72>' + TaggedDataField("Title") + '</magnify>';

Link to comment
Share on other sites

If you open a rule (any rule) and find the Building Blocks dialog window, then go to the "Functions" tab and locate the "FusionPro" group do you see the "TaggedDataField" function listed? If it is not there, then it is not compatible with your version of the software. Dan may not have noticed that you were using an older version.
Link to comment
Share on other sites

Maybe this will work:

return '<magnify type=setwidth factor=91.72>' + Field("Title").replace(/&(?!\w+;)/g,"&") + '</magnify>';

The replace is looking for any occurrence of an ampersand that is not followed by a string of characters and a semicolon (an existing entity) and replacing it with the ampersand entity.

 

Don't forget to remove the "NormalizeEntities" function that you had in your original code and leave the "Treat returned strings as tagged text" box checked.

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