AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
How to create a tagspaces import file11/12/2023 The question of whether/when/how to deal with returns in the original imported text file is not the main point, and could profitably be ignored as not relevant to the problem at hand. The problem is that successive conversions of a series of tags corrupts/undoes/invalidates the styling of previously converted text. I want to reiterate that the problem I encountered is not with converting one type of tagged content to one Publisher paragraph style. Furthermore, import of HTML-like or XML-like content is going to have returns as returns are generally not significant in XML-derived formats anywhere except specially designated stretches of preformatted text. I have tried working with return-less paragraphs and the experience is just horrible, endlessly keystroking to move forward or back or constantly taking my hands off the keyboard to reposition the cursor with the mouse. If Publisher would leave returns as line-breaks, I would let it. txt file into Publisher without conversion of returns to paragraph breaks, I would. When those two operations are combined into a single replace, the new styling "bleeds" into adjacent, previously styled and paragraph-marked Bruce The imported text file has no extraneous spaces, and has returns in the text to make it practical to work in my preferred text editor (vi) with both hands on the keyboard and little or no use of the mouse. When those two operations are separated, everything proceeds exactly as expected. And no, the problem seems to be the attempting to use Find&Replace to introduce a paragraph break and assign a paragraph style simultaneously. Convert first, then and it will be clear that the one or both occurrences of the previously converted text (depending on whether your replacement string puts the paragraph-break before or after the \1) will be re-styled as. If you want a slightly richer example, just concatenate two copies of the sample text. The sample text I provided in my original posting is entirely adequate to demonstrate the issue as a sample input file. Trying to chop out paragraphs and style them at the same time using Find&Replace is not "stable", at least in this version of walt.ferrell The purpose is to remove all the superfluous paragraph breaks that Publisher introduces for each end-of-line in the imported text file. The solution is to introduce the paragraph breaks first to separate all the paragraphs cleanly, before styling each paragraph. I tried both "para-break \1" and "\1 para-break" as replacement patterns, but neither leaves the previously converted text alone. So, why did I do it this way? Why didn't I just strip off the tags and superfluous spaces, apply the styling and add a paragraph break in one step, combining my 2nd and 3rd Find&Replace steps? The answer is simple: It doesn't work! When I apply the 2nd tag style, the style is also applied to the adjacent paragraphs previously converted to the 1st tag style. Similarly for and Heading 1 and the other tags. Then for each tag, I use an RE that strips off the start and end tags and any superfluous white space and applies the appropriate paragraph style Then I use an RE that captures end tags together with any surrounding spaces and replaces them with the end tag, spaces stripped off, and adds a paragraph break. Obviously the actual paragraph break and space characters are used in the RE patterns, but I'm spelling them out here to be clear. When I place such a tagged text file (.txt) in a Publisher text frame, the first thing I do is find and replace all the paragraph breaks with single spaces. My import text is a very simplistic HTML-like structure with free line breaks, which Publisher imports as paragraph breaks. This is somewhat more involved than the Find&Replace recipe which has been posted on several threads here, and may help someone with similar difficulty. I've had some difficulty using Find&Replace to apply styles to tagged text on import, but found a solution that worked.
0 Comments
Read More
Leave a Reply. |