Jump to content

Multiple headings in paragraph to color


oleooo

Recommended Posts

What I am creating is a brochure and the user have requested that they put all the text in one field. My issue is that some of them want headings and other text to standout in the panels. I have tried using the rule below but it did not work. I am not sure of the syntax that I should be using. My first attempt was with creating Heading fields and body text fields. I made 4 per panel but the users did not like this they wanted more freedom. So I gave them the option of tagging text with <color name="pantone 288 C"> heading example</color>. This worked for some but others thought it was to hard. I hope you get the idea from this it is a bit wordy.

return ReplaceSubstring(TaggedTextFromRaw(Field("body text)), "</>", '<color name="pantone 288 c"></></color>');

Link to comment
Share on other sites

What I am creating is a brochure and the user have requested that they put all the text in one field. My issue is that some of them want headings and other text to standout in the panels. I have tried using the rule below but it did not work. I am not sure of the syntax that I should be using. My first attempt was with creating Heading fields and body text fields. I made 4 per panel but the users did not like this they wanted more freedom. So I gave them the option of tagging text with <color name="pantone 288 C"> heading example</color>. This worked for some but others thought it was to hard. I hope you get the idea from this it is a bit wordy.

If you want to let users enter tagged markup which you pass directly to FusionPro, that should work, in theory. However, it's very easy to enter invalid markup, which can really mess things up.

return ReplaceSubstring(TaggedTextFromRaw(Field("body text)), "</>", '<color name="pantone 288 c"></></color>');

I'm not sure why you're trying to replace "</>" in the text. Can you give me an example of the original field data to which you're applying this rule, and what you want the result to be?

Link to comment
Share on other sites

The field that I am working on is body text field and the result would be that any text which is taged as such <text> would be the spot color pantone 288. the end result would be that the user can mark up the text then. where the tag<> exsist would be pantone 288. I have tried to upload the file but it cancels out.
Link to comment
Share on other sites

The field that I am working on is body text field and the result would be that any text which is taged as such <text> would be the spot color pantone 288. the end result would be that the user can mark up the text then. where the tag<> exsist would be pantone 288. I have tried to upload the file but it cancels out.

I see. So let's say your field contains something like this:

I'm feeling <blue>.

Then you want that to turn into this:

I'm feeling <color name="pantone 288 C">blue</color>.

Right?

 

Try this rule:

return TaggedTextFromRaw(Field("body text")).replace(/(\&lt\(\S+)(\&gt\;)/g, '<color name="pantone 288 c">$2</color>');

Link to comment
Share on other sites

Sorry for getting back so late have been out of office.

 

The last script work ok but then I did not describe my problem very well so basicly what iI need is this

User inputs this:

 

<This is your ******* needs training.>

We will show you the reslut of many different aspects of the ******* field. All you have to do is get yourself ingear and find out how it is done. Your next step is to find a way to work out the details. here are a few refernce guides <www.letmehavit.com> and <www.liverfunction.com>

 

<One way track to medicine>

Next paragraph goes here

 

This would be the output I would be looking for:

 

This is your ******* needs training.

We will show you the result of many different aspects of the ******* field. All you have to do is get yourself ingear and find out how it is done. Your next step is to find a way to work out the details. here are a few referrence guides www.letmehavit.com and www.liverfunction.com

 

One way track to medicine

Next paragraph goes here

 

 

I am working on something like this but still not able to get it to work.

 

If (Field("Body text").indexOf("<\>") > -1)

{

return '<color name = "Pantone 288 c">' + TaggedTextFromRaw("<\>") +'</color>';

}

return Field("Body text");

Link to comment
Share on other sites

User inputs this:

 

<This is your ******* needs training.>

We will show you the reslut of many different aspects of the ******* field. All you have to do is get yourself ingear and find out how it is done. Your next step is to find a way to work out the details. here are a few refernce guides <www.letmehavit.com> and <www.liverfunction.com>

 

<One way track to medicine>

Next paragraph goes here

 

This would be the output I would be looking for:

 

This is your ******* needs training.

We will show you the result of many different aspects of the ******* field. All you have to do is get yourself ingear and find out how it is done. Your next step is to find a way to work out the details. here are a few referrence guides www.letmehavit.com and www.liverfunction.com

 

One way track to medicine

Next paragraph goes here

Okay, try this variation on what I posted earlier:

return TaggedTextFromRaw(Field("body text")).replace(/(\&lt\([^&]+)(\&gt\;)/g, '<color name="pantone 288 c">$2</color>');

The only other problem here is, how is the user adding the new lines (paragraph breaks) to the inputted text? Usually we recommend that any kind of Web-to-Print or similar system which is capturing multi-line free-form user input in a text box on a form should convert new lines to <br> or <p> tags. But that won't work here since we're calling TaggedTextFromRaw. However, if the paragraph breaks are represented by newline characters ('\n' in JavaScript), then TaggedTextFromRaw will convert them to <br> tags for you.

 

Also, this whole thing might work better if you use different characters besides angle brackets <> to denote the formatting, since those are also special characters in FusionPro's tagged markup. If you use something like curly braces {} instead, the rule becomes a bit simpler:

return TaggedTextFromRaw(Field("body text")).replace(/({)([^{}]+)(})/g, '<COLOR name="pantone 288 c">$2</color>');

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...