[brailleblaster] A more complete block diagram of processing

  • From: "John J. Boyer" <john.boyer@xxxxxxxxxxxxxxxxx>
  • To: brailleblaster@xxxxxxxxxxxxx
  • Date: Mon, 8 Oct 2012 06:53:28 -0500

This diagram owes much to feedback. It will probably be enhanced by 
further feedback. The descriptions of the configuration and 
semantic-action files are included for completeness.

--------------------

This is a sort of informal block diagram in narrative form. It is 
intended as a guide for the future development of BrailleBlaster. 

Input may be in the form of an xml file or it may be a utd working file 
which has been saved so that work can be resumed later. xml files may be 
original well-formed files of any flavor, for example, dtbook, docbook, 
etc. They may also be derived from other formats such as MSWord, rtf, 
and so on. Another source is file sets, such as NIMAS or epub. In this 
case the manifest is opened, and the file to be processed is chosen from 
it. A means is provided to concatenate several files into one. xml files 
can also be derived from plain-text by calling the translateTextFile 
method with formatFor utd or from brf files by calling backTrnslateFile, 
also with formatFor utd.

Whatever its source, an xml file is rendered by calling translateFile 
with formatFor utd. BrailleBlaster then works on the utd file produced. 
In the case of formerly saved utd files or those produced by importing 
plain text or brf files, BrailleBlaster works with these directly.

The file is first parsed to produce a parse tree.

The configuration files indicated in the user's settings are then read 
and used to begin the construction of a semantic table. This table is 
used to specify how markup in the document is to be rendered on the 
screen and how styles and actions are to be associated with markup for 
editing. For more on configuration files see Appendix A.

Semantic-action files are then read. A file is chosen by looking for a 
file with the name of the root element and the extension .sem or 
according to an indication in the configuration files. For more on 
semantic-action files see Appendix B.

If the semantic-action files contain XPath expressions as keys these are 
applied to the parse tree, and the selected nodes are modified by adding 
an attribute indicating the entry in the semantic table to be used. The 
value of each key will already have been entered into this table.

The keys containing markup in the semantic files are then applied to the 
parse tree, and a similar attribute is added to the matching nodes, 
unnless it is already present because it has been added by an XPath 
expression.

This forms the DOM of the document.

This DOM is then used to display the document on the screen. Both the 
print and Braille windows are filled in this process.

Editing of the print document can then take place. If the contents of a 
text node are altered the new contents replace the old. If an element 
node is deleted its entire subtree is deleted. If a new block of 
characters is created the user is prompted to asign it a style and a 
node with the appropriate markup is added to the document at the place 
where the new block was created.

if focus is shifted to the Braille window and the user has checked the 
Edit Braille box on the advanced menu the window can be edited. Any 
editing is highlighted in both the Braille and print windows.

The file can be saved as a utd file so work can be resumed later or it 
can be saved as the original xml file with enhancements. These consist 
of edited Braille which has been moved into the print document with 
proper markup. The attributes used to create the DOM are removed during 
the save process. Editing in the print window is handled automatically 
as part of the conversion of the parse tree to a file.

Besides saving the file as utd or as an envanced document, it can be 
saved as a brf file or embossed.

The enhanced document can then later be rendered by liblouisutdml with 
any liblouisutdml configuration and semantic-action files that the user 
wishes. This can be done either by BrailleBlaster or by another 
application which uses the loblouis-liblouisutdml transcription engine.

Appendix A: Configuration Files 

Here is a description of BrailleBlaster configuration files. They 
specify how BrailleBlaster shall operate. The one which the user has 
selected is referenced in the userSetings.properties file. Selection, 
creation and editing are done via a dialogue. Note that BrailleBlaster 
configuration files are completely separate from liblouisutdml 
configuration files. They are stored in the configurations directory 
within the programData directory. Below is a sample file. Nore lines 
will be added as development proceeds. Explanations follow the sample.

--------------------

hyphenate=no
pageNumberAt=top
topMargin=0.5
leftMargin=1
rightMargin=0.5
bottomMargin=0.5
paperHeight=11
paperWidth=8.5
xmlheader="<?xml=version='1.0'=encoding='UTF-8'=standalone='yes'?>
semanticFiles=*
internetAccessRequired=no
newEntries=yes
filename include
debug=no
styles=para,heading1,heading2,list

--------------------

The first line specifies whether hyphenation should be used when a 
document is displayed onscreen.

The second line specifies where the page number should be placed. 

Then come six lines specifying margins and paper size. These are used 
principally for making hard copies. 

the xmlheader line specifies the header that should be used at the 
beginning of new files.

semanticFiles is a comma-separated list of the semantic files to be 
used. Here the value is an asterisk, which means to use the file which 
is named for the root element of the document. This is actually the 
default, so this line is not strictly necessary.

InternetAccessRequired specifies whether the Internet will be needed for 
processing a document, e.g., for getting a DTD.

newEntries specifies whether a record should be kept of the markup in a 
document which has not been assigned to a semantic action or style. This 
is useful when processing a new flavor of xml for which a 
semantic-action file does not exist. It applies to all documents. 
Semantic-action files can also have a newEntries line. It applies to 
that type of document only.

The include line, with a preceding filename, specifies that another 
configuration file is to be read at the point where it is encountered.

debug specifies whether extra testing should be done, experimental 
features used, and extra logging done.

The styles line gives a comma-separated list of styles that will be used 
in displaying and editing a document. These styles are in the styles 
directory.

The order of entries in a configuration file is generally not important. 
However, an include line does cause the referenced file to be read at 
the point where it is encountered.

Appendix B: Semantic-Action Files

Semantic-action files associate the markup in a particular type of xml 
document with BrailleBlaster styles, methods (actions) and macros. 
Usually they are named by concatenating the name of the root element of 
the document flavor with the extension .sem They are not to be confused 
with liblouisutdml semantic-action files. The latter are concerned with 
rendering an xml document into Braille and tactile graphics. 
BrailleBlaster semantic-action files are concerned with displaying the 
contents of a document on the screen and with editing them. They are 
stored in the semantics directory in the programData directory. There is 
a dialogue for creating and editing them.

the key part of a line in a semantic-action file is a reference to 
markup in the document. This may be literal markup or an XPath 
expression. There are a few exceptions, which will be discussed later. 
The value part contains the name of a style or action, or of a macro, 
which can combine several styles and actions. it may also contain 
parameters.

Literal keys may have one of the following forms: an element name; an 
element name, a comma, and an attribute name; an element name, a comma, 
an attributename, an attribute value. XPath keys begin with the 
characters &x with the XPath expression imediately followint and 
enclosed in parentheses. The key may also be the word newEntries. If the 
value is yes markup which has not yet been associated with anything is 
recorded and placed in a prototype semantic-action file. The key may 
also be the word file, followed by a colon followed by a filename. In 
this case the value is the word include, and the line specifies that 
another semantic file should be read at this point.

Values start with one of the words action macro style. This is followed 
by a space. If action is specified, the action is one of those below. If 
style is specified a style name follows. The extension .properties is 
added to it and it is looked up in the styles directory. Likewise, 
macros are looked up in the macro directory. All three may have 
parameters enclosed in parentheses.

The following actions may be specified.

  no, Do nothing except insert a space.
  skip, Skip the subtree of which this markup is the root.
  generic, Apply the parameters.
  cdata, Special processing for CData sections.
  htmllink, Insert a link
  htmltarget, to this target.
  configfile, Specify a configuration file.
  configstring, Specify a configuration string.
  configtweak, Use new configurations while rendering.
  # reserved styles. These styles are predefined, but may be altered
  document, Assign to the node that actually contains the content, such 
        as the book node in dtbook.
  para, A paragraph.
  heading1,various levels of headings 
  heading2,
  heading3,
  heading4,
  heading5,
  heading6,
  heading7,
  heading8,
  heading9,
  heading10,
  contentsheader, The heading of the table of contents.
  contents1, Various levels within the contents.
  contents2,
  contents3,
  contents4,
  contents5,
  contents6,
  contents7,
  contents8,
  contents9,
  contents10,
  # General text 
  attrtotext, Transform an attribute value to text.
  runninghead, Specify a running header.
  footer, Specify a page footer.
  boxline, Specify a line of identical characters.
  italicx, Italicise the text within the markup.
  boldx, Bold it.
  underlinex, Underline it.
  linespacing, Number of blank lines between lines of characters.
  blankline, Leave a blank  line.
  softreturn, Start a new line, but not a new style.
  newpage, Start a new page.
  brl, Process the <brl> subtree rooted at this node.
  music, Display/edit the music notation in this subtree.
  math, Display/edit the MathML notation in this subtree.
  chemistry, Display/edit the chemistry notation in this subtree.
  graphic, Display/edit the graphic pointed to by the markup.

-- 
John J. Boyer; President, Chief Software Developer
Abilitiessoft, Inc.
http://www.abilitiessoft.com
Madison, Wisconsin USA
Developing software for people with disabilities


Other related posts:

  • » [brailleblaster] A more complete block diagram of processing - John J. Boyer