1 Reply Latest reply on Nov 5, 2012 4:50 AM by 4everJang

    non breaking space for dates

    gert verrept Level 2

      Hi,

       

      Being a complete newby for FrameMaker (10 on windows 7), I was wondering if someone has a script (javascript) to converts the normal space with a non breaking space in dates, so that the day and the month stay together.

      I'm doing this by hand for the moment, and FM crashes several times, just using the F&C. I'm working with Indesign too, and as seceond question, can I use thes scripts in FM also?

       

      thnkx

        • 1. Re: non breaking space for dates
          4everJang Level 3

          About the InDesign scripts question: no, you would at least have to rewrite the part of the script that finds the text items in Frame, as the object model for FrameMaker will be very much different from InDesign. Some functions might be implemented in a similar way but the scripts have to be exact to work and it is my wild guess that the developers for InDesign are not the same as the developers for FrameMaker. I would doubt that much of your existing scripts could be reused for Frame.

           

          About the conversion of normal space with nonbreaking spaces: you need to get the text strings from your document first, then possibly use a regular expression to get the required result. There are several pitfalls on your way to doing this and making sure it works correctly, but it is certainly doable if you have the time and endurance available. Having text in tables and possibly in text frames that are nested within anchored frames makes things much more complicated. Of course the regular expression should also determine that the breaking space is inside a date, otherwise all spaces become non-breaking and your document would not look good at all. So you see there are a lot of things involved in what seems to be a simple action.

           

          If you work in structured FrameMaker and have the option to roundtrip to XML you might be able to run a regular expression on the XML files instead. But that means you would need an XML editor that supports regular expressions as well, plus your read-write rules should allow for the non-breaking space character, too.

           

          If you need a turnkey script for this I could write one, but I would have to charge something for it, as I do have a lot of work currently and am trying to make a living.

           

          Ciao

           

          Jang