Go Back   PTI Marketing Technologies User Community > Software-Related Talk > The JavaScript Library > Formatting Text

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 8th, 2009, 09:37 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,230
Default Mysteries of the <span> tag revealed

The <span> tag is a powerful feature of the FusionPro VDP products suite. Unfortunately, it's currently undocumented. This post attempts to remedy that shortcoming.

The <span> tag pair was designed to allow style overrides over a specific range, or span, of text. The initial, or opening, <span> tag can take several attributes, which specify style attributes to be overridden in the span. The overrides remain in effect until the ending, or closing, </span> tag is reached.

The <span> tag can take any number of the following optional attributes:
  • suppress={true|false}. Defaults to false. If true, all text within the span is suppressed.
  • accumulate={true|false}. Defaults to false. If false, the ending </span> tag restores the style in effect at the beginning of the span. If true, the ending </span> tag restores the style, taking into account any other changes within the span.
  • color=(color name). If present, the specified named color is applied to the entire span as an override.
  • shading=(percentage) If present, the specified shading, or tint, percentage is applied to the entire span as an override. All colors applied to text within the span are shaded by the specified percentage.
  • pointsize=(number). If present, the specified point size is applied to the entire span as an override. Units are in points.
  • font=(font name). If present, the specified named font is applied to the entire span as an override.
  • bold={true|false}. If present, the style of the entire span is set to either bold or not bold, as an override.
  • italic={true|false}. If present, the style of the entire span is set to either italic or not italic, as an override.
If the <span> tag is used without any attributes, it effectively acts as way to save the running text style and restore it when the ending </span> tag is reached. For example:
Code:
<color name="Black">Hi <span><variable name="NameInColor"></span>, you're a winner!
This ensures that the original running style of the text is restored, no matter what the "NameInColor" rule does, even if it changes the running color of the text using a <color> tag.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});

Last edited by mhilger; April 10th, 2009 at 07:22 AM..
Reply With Quote
  #2  
Old April 9th, 2009, 02:33 PM
Brian F.'s Avatar
Brian F. Brian F. is offline
Regular Contributor
 
Join Date: Sep 2008
Location: Pennslyvania
Posts: 74
Default Re: Mysteries of the <span> tag revealed

Where are the places one could use the tag? Product templates? Custom P1 Copy in store options? Product descriptions or instructions?
Reply With Quote
  #3  
Old April 10th, 2009, 07:25 AM
mhilger's Avatar
mhilger mhilger is offline
Senior Contributor
 
Join Date: Aug 2008
Location: Chicago
Posts: 326
Default Re: Mysteries of the <span> tag revealed

Hello Brian,

The <span> tag information that Dan is sharing here is specific to FusionPro VDP templates as opposed to FusionPro Web store display text.
__________________
--Mark Hilger
Reply With Quote
  #4  
Old April 10th, 2009, 07:50 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,230
Default Re: Mysteries of the <span> tag revealed

Quote:
Originally Posted by mhilger View Post
The <span> tag information that Dan is sharing here is specific to FusionPro VDP templates as opposed to FusionPro Web store display text.
Thus the location of this thread under "The JavaScript Library > Formatting Text". Although technically one can use tagged markup such as this in input and resource files without JavaScript rules.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #5  
Old July 17th, 2009, 10:31 AM
AndyShaw AndyShaw is offline
Forum n00b
 
Join Date: Oct 2008
Posts: 6
Default Re: Mysteries of the <span> tag revealed

Dan:

Thanks for this info. It is very helpful for some things that we are working on right now. I do one follow-up question, though. I don't understand the explanation for the accumulate=true attribute. I'm not sure what you mean by "taking into account any other changes within the span." Can you provide a example to clarify?

Thanks,

-- andy --
Reply With Quote
  #6  
Old July 23rd, 2009, 04:42 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,230
Default Re: Mysteries of the <span> tag revealed

Quote:
Originally Posted by AndyShaw View Post
I don't understand the explanation for the accumulate=true attribute. I'm not sure what you mean by "taking into account any other changes within the span." Can you provide a example to clarify?
This example should illustrate the effect of the "accumulate" attribute:
Code:
return "Accumulate off:<t><span color=Red>Hi<color name=Green> there!</span> After span<br>\n" +
    "Accumulate ON:<t><span color=Red accumulate=true>Hi<color name=Green> there!</span> After span";
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #7  
Old February 25th, 2013, 02:43 AM
biggestbossfan biggestbossfan is offline
Junior Community Member
 
Join Date: Jul 2012
Location: Johannesburg South Africa
Posts: 20
Default Re: Mysteries of the <span> tag revealed

Hi,

I have a business card which includes name and qualification.

If the qualification is not present, just the name will be shown.
The name and qualification need to be indifferent colours.
This appears to be a job for <span>
I have the following:

if (Field("Qualification 1").length < 0)
return < color name ="pantone 335 C"><span> Field("First name") +" " +Field("Last name");</span>
else
return <color name = "pantone 335C"> <span> Field("First name") + " " + Field("Last name")</span>+ "\n" <color name = "grey"> <span>+Field("Qualification 1")+" " + Field("Qualification 2")</span>;

Which clearly doesn't work.

Any pointers would be gratefully accepted.
__________________
FusionPro 9.0.3
Acrobat X 10.1.6
Mac OS Mountain Lion 10.8.3
FPExpression 3.1.13
Reply With Quote
  #8  
Old February 25th, 2013, 03:45 AM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 954
Default Re: Mysteries of the <span> tag revealed

Your syntax is a little off. You need quotes around your tags and you're missing a couple of plus signs. And if you want to simplify a few things, you can just use the color tags, you don't need the span tags as well:

Code:
var result = '<color name ="pantone 335 C">' + Field("First name") + " " + Field("Last name") + '</color>';
result += (Field("Qualification 1") != "") ? '\n <color name = "grey">' + Field("Qualification 1") + " " + Field("Qualification 2") + '</color>' : "";
return result;
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
  #9  
Old February 25th, 2013, 06:44 PM
biggestbossfan biggestbossfan is offline
Junior Community Member
 
Join Date: Jul 2012
Location: Johannesburg South Africa
Posts: 20
Default Re: Mysteries of the <span> tag revealed

Thanks for this. I think I'm missing something though.
I get this returned:
<color name ="pantone 335 C">Bruce Springsteen</color> <color name = "pantone 430 C">BSc Bcom</color>
__________________
FusionPro 9.0.3
Acrobat X 10.1.6
Mac OS Mountain Lion 10.8.3
FPExpression 3.1.13
Reply With Quote
  #10  
Old February 26th, 2013, 02:11 AM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 954
Default Re: Mysteries of the <span> tag revealed

make sure you have "treat returned string as tagged text" checked.
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
Reply

Tags
markup, span, tags

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:20 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.