Difference between revisions of "Custom Personality Tutorial"
(→Creating A Tutorial Personality) |
(→Creating A Tutorial Personality) |
||
Line 53: | Line 53: | ||
[main] | [main] | ||
− | views = | + | views = tutorialView |
nesting = document/spread/frame/+frame.vertical/+frame.horizontal/text.paragraph/text.run | nesting = document/spread/frame/+frame.vertical/+frame.horizontal/text.paragraph/text.run | ||
Line 61: | Line 61: | ||
[appContextData] | [appContextData] | ||
− | + | TUTORIAL_FILENAME_EXTENSION = .txt | |
− | [main: | + | [main:tutorialView] |
fileSplitLevel = document | fileSplitLevel = document | ||
Line 69: | Line 69: | ||
accepted = document, spread, page, text.story, frame.text, text.paragraph, text.run | accepted = document, spread, page, text.story, frame.text, text.paragraph, text.run | ||
− | [flush: | + | [flush:tutorialView] |
text.run = | text.run = |
Revision as of 04:35, 30 December 2013
First, we'll build a very simple personality, and we'll gradually extend it.
The basis of nearly all document conversion personalities is the ViewExporter adapter.
The ViewExporter combines two 'main' adapters: a disassembler (which breaks a document granule into smaller granules) and an assembler (which takes the granules coming out of the disassembler, and builds the desired end-result).
The disassembler is part of the default Crawler setup. When running Crawler, it'll ask the currently active application to provide it with a disassembler, and it will use that disassembler in the ViewExporter.
The disassembler is configured through the configuration files.
Adjusting The Top-Level config.ini
First, we'll enhance the top-level configuration file so it knows about the new personality we're going to build.
Let's call the personality 'tutorial'.
Change the config.ini so it looks similar to this (I've omitted the comments for brevity):
[conditionals] selectors = tutorial [main] personalityConfig?tutorial = "./Personalities/Tutorial/config.ini" personalityConfig?text = "./Personalities/Text/config.ini" # ******************************************************************************** [debug] debugMonitoring = true monitorAdapters = inputSplitter logLevel = 5 logFileName = Crawler.log
This tells Crawler that we want to select 'tutorial', and it also says that the personalityConfig entry needs to be the config.ini in the Tutorial folder inside the Personalities folder.
We also switch on debug monitoring, and hook a Debug Monitor into the inputSplitter adapter inside the ViewExporter.
Creating A Tutorial Personality
The next step is to make a start building the new personality. Open the Personalities folder, and create a new subfolder called Tutorial. Inside that subfolder, create a text file called config.ini.
Put the following text in this config.ini file:
[main] views = tutorialView nesting = document/spread/frame/+frame.vertical/+frame.horizontal/text.paragraph/text.run formulasFile = ./formulas.jsx.snippet [appContextData] TUTORIAL_FILENAME_EXTENSION = .txt [main:tutorialView] fileSplitLevel = document xmlEncode = 0 accepted = document, spread, page, text.story, frame.text, text.paragraph, text.run [flush:tutorialView] text.run = text.paragraph = text.run text.story = text.run, text.paragraph frame.text = text.run, text.paragraph page = text.run, text.paragraph, frame.text, frame spread = text.run, text.paragraph, frame.text, frame, page document = text.run, text.paragraph, text.story, frame.text, frame, page, spread