Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Use substring from paragraph in <$paratext>?

Enthusiast ,
Apr 15, 2013 Apr 15, 2013

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!

1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Apr 15, 2013 Apr 15, 2013

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 sea

...
Translate
LEGEND ,
Apr 15, 2013 Apr 15, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Apr 15, 2013 Apr 15, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 15, 2013 Apr 15, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Apr 16, 2013 Apr 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:

FM_Variables_Expressions_Suggestion.jpg

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 16, 2013 Apr 16, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Apr 16, 2013 Apr 16, 2013
LATEST

@S.Error & @Arnis,

Thanks very much for the info about Run-In heads! Yes, it'd be far easier to  modify the content this way than to assign markers individually.

We'll go ahead and work on that and report back.

In our case this approach seems like it'll work well, but I do feel that some sort of  quick script mechanism to select (arbitrary) text within the Edit Variable dialog box like I show above would be beneficial to have within FM. I don't know whether it's worth it to suggest such a feature to the FM engineering team though, since it probably only comes up once in a blue moon.

EDIT:

I'm happy to report that the Run-In heads worked for us! Thanks @Arnis and @Error for suggesting that.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 16, 2013 Apr 16, 2013

You could also implement the

Topic Phrase - Tag Line

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines