Using the Text Filter

=Introduction=

Creating a document with a consistent look can be made easy at least when it comes to the text formatting. The secrets for success are document templates, paragraph styles, text filters and article submitters who don't mind some extra work for public good.

=How it works=

For your articles create some paragraph styles with describing names. I've here created three which I'm going to use with my articles at least in the next three issues of Tsoots' digest.



After creating all desired paragraph styles I'll save the document as a template so these styles will be there when ever I get more articles from busy writers. File->Save as Template... It's now guaranteed that my work will have a consistent look between issues cause this is the only template I'm gonna use when making them.



For the first issue I don't have a text filter created so that's the next thing to do. Create a text frame and from context menu choose Get Text... You'll get a dialog that will look like this. Notice the red dot. That's the drop down box from where I pick "Text Filters" before hitting ok. 'Do not let the picture below fool you. You must select "Text Filters" or it will automatically select a filter for you.'



Text filters are simple text filters that tell Scribus how to format the text being imported. It's also possible to apply paragraph styles to paragraphs based on different rules. What I've been thinkin is that writers should prepend every paragraph they make with \P1 and \P2 (P1 for the first paragraphs without indent) and headers with \H1. Once the text filter is created be sure to give it a name to the bottom left largish text field so it will be available whenever you get the next article for laying out.



And here's how the format for the text file looks like. Notice the red spots again. That's how I want my writers to prepend headers and paragraphs.



OK, that's about it. Here's what I do when i next time get an article from a writer.


 * Launch scribus and goto New From Template from where I pick my article doc template which will include the paragraph styles needed




 * Draw a text frame to the page


 * use Get Text... from the context menu and from the file dialog that opens I'll choose Text Filters as my importer (of course I'll also select the file where the article is)


 * Now after Text Filter dialog has opened up I'll choose my saved filter that I called "Article Style" and press ok and the text will be nicely formatted just like I wanted.



=Final word=

Scribus has a simple to use C++ api for building formatted text importers. Text Filter plugin has also been built using it. If you are interested in coding such a plugin please visit page Get Text How-to

--Tsoots 18:16, 9 Feb 2005 (UTC)