Package translate :: Package storage :: Module dtd
[hide private]
[frames] | no frames]

Module dtd

source code

classes that hold units of .dtd files (dtdunit) or entire files (dtdfile) these are specific .dtd files for localisation used by mozilla

Classes [hide private]
  dtdunit
this class represents an entity definition from a dtd file (and possibly associated comments)
  dtdfile
this class represents a .dtd file, made up of dtdunits
Functions [hide private]
 
quotefordtd(source) source code
 
unquotefromdtd(source)
unquotes a quoted dtd definition
source code
String
removeinvalidamps(name, value)
Find and remove ampersands that are not part of an entity definition.
source code
Variables [hide private]
  labelsuffixes = ('.label', '.title')
Label suffixes: entries with this suffix are able to be comibed with accesskeys found in in entries ending with accesskeysuffixes
  accesskeysuffixes = ('.accesskey', '.accessKey', '.akey')
Accesskey Suffixes: entries with this suffix may be combined with labels ending in labelsuffixes into accelerator notation

Imports: base, quote, re, warnings, StringIO, etree


Function Details [hide private]

removeinvalidamps(name, value)

source code 

Find and remove ampersands that are not part of an entity definition.

A stray & in a DTD file can break an applications ability to parse the file. In Mozilla localisation this is very important and these can break the parsing of files used in XUL and thus break interface rendering. Tracking down the problem is very difficult, thus by removing potential broken & and warning the users we can ensure that the output DTD will always be parsable.

Parameters:
  • name (String) - Entity name
  • value (String) - Entity text value
Returns: String
Entity value without bad ampersands