Skip to main content
Inspiring
April 16, 2013
Answered

Use substring from paragraph in <$paratext>?

  • April 16, 2013
  • 2 replies
  • 1549 views

Hello all,

Does FM (we're using version 11) allow any type of expressions within  variables in order to pull a substring out of a paragraph for use in a Running H/F? I've researched this as much as possible and I've done a search on the forum and the initial responses don't look promising, although those responses seem to be for prior versions...

An example would be a  paragraph that looks like this:

Tropical Island - A wonderful place to be

and we want to pull out only

Tropical Island

for the Running H/F so that we can take advantage of FM's automatic population of the header on left/right pages similar to a dictionary  using <$paratext[MyTag]> and <$paratext[+,MyTag]>, only that MyTag is  the substring from the paragraph, not the entire paragraph.

I greatly appreciate any help or suggestions.

Thank you!

    This topic has been closed for replies.
    Correct answer Arnis Gubins

    Using Extendscript (or Framescript) would be the way to go, provided you have some way of uniquely identifying the fractional part of the paragraph text that you need.

    Regarding the expression functionality, how would you imagine that to work in FM? A regex expression of some kind? Would the content always be unique enough to get the desired match?

    Note: if you're heading titles were of the type "Item - descriptor", then you could have used two separte paratags in a run-in mode to make it look seamless, but still allow you to use the <$paratext[...]> building blocks.

    2 replies

    Bob_Niland
    Community Expert
    Community Expert
    April 16, 2013

    You could also implement the

    Topic Phrase - Tag Line

    as two separate paragraphs, with one as a Run-In.

    Arnis Gubins
    Inspiring
    April 16, 2013

    For controlled content, think marker instead of variable. FM lets you define up to 8 running h/f markers, Header/Footer $1...Header/Footer $8, that you can insert in your content. Then in the running header/footer on the master pages, use the <$marker1> variable to indicate the first item on the page and the <$marker2> variable for the last. Insert these markers on every Body page. Unfortunately it's a manual operation to populate the markers (Tip:if you highlight the text first and then click on the New Markre button, you save a lot of typing) , but that's the only way you can control getting a subset of the entire text of paragraph.

    Inspiring
    April 16, 2013

    Thanks for your reply Arnis!

    We looked into markers, but sadly it won't work for us simply because we have a massive amount of content that we'd have to manually go through.

    I'm surprised that FM11 doesn't   provide some sort of expression functionality for this purpose.

    I'm hoping that I can create this functionality via the ESTK though.

    Arnis Gubins
    Inspiring
    April 16, 2013

    Fortunately for us, all the terms follow the same format, so it'd be a cinch to pull out what's needed in the scripting environment, but I was hoping to simply plug in a simple expression and it would do the heavy lifting for us.

    As far as  being able to generate an expression (ExtendScript/JavaScript or Regular Expression) directly within the Edit Variable environment, something like this mockup I created would be nice and extremely powerful:

    Of course, that would mean that an entire Regex engine would also have to be implemented by the FM team.

    I am a programmer and don't have much FM experience, so that's why I wasn't sure how much I might be missing in built-in FM functionality.

    Arnis, could you elaborate a little more about your last sentence where you describe two separate paratags in run-in mode? I understand this to mean that there is a way to concatenate two paragraphs (with two different paragraph tags) into one paragraph within the body content. Is that correct?

    Thanks very much!


    As Error indicates, if the structure is consistent as you've indicated, then you could be using two paratags instead. The first one would be the "Topic Phrase" and it would be set to run into  (Paragraph Designer > Pagination: Run-in Head Default Punctuation) the following paragraph with the " - " set as the default punctuation to separate the two paragraphs.

    Visually they would appear as one line, but Inernally within FM's database they are then two separate paratags. In that case, you could then use your original running h/f variables in the dictionary mode. It probably would be a lot easier to re-tag and split on the "-" then to assign content, populate markers and insert them in the correct locations.