def do_meta(self, attrs): # CONTENT='...' is required; # at least one of HTTP-EQUIV=xyz or NAME=xyz is required. if not attrs.has_key("content") \ or not (attrs.has_key("http-equiv") or attrs.has_key("name")): self.badhtml = 1 return name = extract_keyword("name", attrs, conv=grailutil.conv_normstring) http_equiv = extract_keyword("http-equiv", attrs, conv=grailutil.conv_normstring) key = name or http_equiv if not key: self.badhtml = 1 return content = extract_keyword("content", attrs, conv=string.strip) item = (name, http_equiv, content) if self._metadata.has_key(key): self._metadata[key].append(item) else: entries = self._metadata[key] = [item] if key == "grail:parse-mode": content = grailutil.conv_normstring(content) strict = self.sgml_parser.strict_p() if content == "strict" and not strict: self.sgml_parser.restrict(0) self.context.message("Entered strict parsing mode on" " document request.") elif content == "forgiving" and strict: self.sgml_parser.restrict(1) self.context.message("Exited strict parsing mode on" " document request.")
def conv_align(val): # This should work, but Tk doesn't actually do the right # thing so for now everything gets mapped to BASELINE # alignment. return BASELINE conv = grailutil.conv_enumeration( grailutil.conv_normstring(val), {'top': TOP, 'middle': CENTER, # not quite right 'bottom': BASELINE, 'absbottom': BOTTOM, # compatibility hack... 'absmiddle': CENTER, # compatibility hack... }) if conv: return conv else: return CENTER
def conv_rules(val): return grailutil.conv_enumeration( grailutil.conv_normstring(val), ['none', 'groups', 'rows', 'cols', 'all'])
def conv_frame(val): return grailutil.conv_enumeration( grailutil.conv_normstring(val), ['void', 'above', 'below', 'hsides', 'lhs', 'rhs', 'vsides', 'box', 'border'])
def conv_halign(val): return grailutil.conv_enumeration(grailutil.conv_normstring(val), ['left', 'center', 'right', 'justify', 'char'])
def conv_valign(val): return grailutil.conv_enumeration(grailutil.conv_normstring(val), ['top', 'middle', 'bottom', 'baseline'])
def conv_color(color): return grailutil.conv_normstring(color)
def conv_align(val): return grailutil.conv_enumeration( grailutil.conv_normstring(val), ['top', 'bottom', 'left', 'right']) or 'top'
def conv_frame(val): return grailutil.conv_enumeration(grailutil.conv_normstring(val), [ 'void', 'above', 'below', 'hsides', 'lhs', 'rhs', 'vsides', 'box', 'border' ])
def conv_halign(val): return grailutil.conv_enumeration( grailutil.conv_normstring(val), ['left', 'center', 'right', 'justify', 'char'])