Jump to content

Search the Community

Showing results for tags 'typography'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome
    • Start Here!
    • News
  • Software-Related Talk
    • Documentation
    • Getting Started
    • The JavaScript Library
    • FusionPro® VDP Creator
    • FusionPro® VDP Producer
    • FusionPro® VDP Server (API)
    • FusionPro® Expression®
    • MarcomCentral®
  • Support
    • Issues, Questions, Etc.
    • Digital Workflow Documents
    • Fonts
  • Off Topic
    • Customer Polls
    • Job Board (Moderated)
    • Reviews, Rants, and General Musings

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


Location


Occupation


FusionPro VDP software version


OS


Acrobat Version


Homepage


ICQ


AIM


Yahoo


MSN


Skype


User Title

Found 1 result

  1. I am having issues with perfecting this smart quote javascript. I have a template using both plain and rich text. I have successfully gotten the smart quotes to show in the correct direction a majority of the time. One issue is when an apostrophe is used as the first character in the field, both in a plain text and rich text field. The second issue is when quotes the first character in the rich text editor only. My code is: Rich Text Rule function replaceFunction(field) { // replace quotes at the beginning or end of the entire string first field = field.replace(/^\"(?=[\w|$][^<>]*<)/, "&ldquor;"); field = field.replace(/^\'(?=[\w|$][^<>]*<)/, "&lsquor;"); field = field.replace(/\"$(?=[^<>]*<)/, "&rdquor;"); field = field.replace(/\'$(?=[^<>]*<)/, "&rsquor;"); // now replace quotes before or inside words field = field.replace(/\s"(?=[\w|$][^<>]*<)/g, " &ldquor;"); field = field.replace(/\s'(?=[\w|$][^<>]*<)/g, " &lsquor;"); // finally, replace all other quotes (after words) field = field.replace(/\"(?=[^<>]*<)/g, "&rdquor;"); field = field.replace(/\'(?=[^<>]*<)/g, "&rsquor;"); return field; } if (Field("Body") != "") return replaceFunction(Feild("Body")) else return ""; Plain Text Rule function replaceFunction(field) { // replace quotes at the beginning or end of the entire string first field = field.replace(/^\"/, "&ldquor;"); field = field.replace(/^\'/, "&lsquor;"); field = field.replace(/\"$/, "&rdquor;"); field = field.replace(/\'$/, "&rsquor;"); // now replace quotes before or inside words field = field.replace(/\s"(?=[\w|$])/g, " &ldquor;"); field = field.replace(/\s'(?=[\w|$])/g, " &lsquor;"); // finally, replace all other quotes (after words) field = field.replace(/\"/g, "&rdquor;"); field = field.replace(/\'/g, "&rsquor;"); return field; } if (Field("Headline") != "") return replaceFunction(Field("Headline")) else return ""; I tested modifying the codes a few ways but don't really know how to right the correct fix. I added a line to the "now replace quotes before or inside words" but wasn't able to get it right exactly. During testing, I could add the following line to the replace quotes before or inside words to fix the double quotes: field = field.replace(/\"(?=[\w|$][^<>]*<)/g, "&ldquor;"); , but I can't do this for the single quote because it changes the direction of an apostrophe (&rsquor;) to a left single quote. Can someone help me as I am not very good at creating javascript code? Thanks!
×
×
  • Create New...