コード例 #1
0
 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.")
コード例 #2
0
 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.")
コード例 #3
0
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
コード例 #4
0
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
コード例 #5
0
ファイル: table.py プロジェクト: MaxMorais/Trail
 def conv_rules(val):
     return grailutil.conv_enumeration(
         grailutil.conv_normstring(val),
         ['none', 'groups', 'rows', 'cols', 'all'])
コード例 #6
0
ファイル: table.py プロジェクト: MaxMorais/Trail
 def conv_frame(val):
     return grailutil.conv_enumeration(
         grailutil.conv_normstring(val),
         ['void', 'above', 'below', 'hsides', 'lhs', 'rhs',
          'vsides', 'box', 'border'])
コード例 #7
0
ファイル: table.py プロジェクト: MaxMorais/Trail
def conv_halign(val):
    return grailutil.conv_enumeration(grailutil.conv_normstring(val),
                              ['left', 'center', 'right', 'justify', 'char'])
コード例 #8
0
ファイル: table.py プロジェクト: MaxMorais/Trail
def conv_valign(val):
    return grailutil.conv_enumeration(grailutil.conv_normstring(val),
                                      ['top', 'middle', 'bottom', 'baseline'])
コード例 #9
0
ファイル: table.py プロジェクト: MaxMorais/Trail
def conv_color(color):
    return grailutil.conv_normstring(color)
コード例 #10
0
ファイル: table.py プロジェクト: MaxMorais/Trail
 def conv_align(val):
     return grailutil.conv_enumeration(
         grailutil.conv_normstring(val),
         ['top', 'bottom', 'left', 'right']) or 'top'
コード例 #11
0
ファイル: table.py プロジェクト: leon332157/Grail-browser
 def conv_rules(val):
     return grailutil.conv_enumeration(
         grailutil.conv_normstring(val),
         ['none', 'groups', 'rows', 'cols', 'all'])
コード例 #12
0
ファイル: table.py プロジェクト: leon332157/Grail-browser
 def conv_frame(val):
     return grailutil.conv_enumeration(grailutil.conv_normstring(val), [
         'void', 'above', 'below', 'hsides', 'lhs', 'rhs', 'vsides',
         'box', 'border'
     ])
コード例 #13
0
ファイル: table.py プロジェクト: leon332157/Grail-browser
def conv_halign(val):
    return grailutil.conv_enumeration(
        grailutil.conv_normstring(val),
        ['left', 'center', 'right', 'justify', 'char'])
コード例 #14
0
ファイル: table.py プロジェクト: leon332157/Grail-browser
def conv_valign(val):
    return grailutil.conv_enumeration(grailutil.conv_normstring(val),
                                      ['top', 'middle', 'bottom', 'baseline'])
コード例 #15
0
ファイル: table.py プロジェクト: leon332157/Grail-browser
def conv_color(color):
    return grailutil.conv_normstring(color)
コード例 #16
0
ファイル: table.py プロジェクト: leon332157/Grail-browser
 def conv_align(val):
     return grailutil.conv_enumeration(
         grailutil.conv_normstring(val),
         ['top', 'bottom', 'left', 'right']) or 'top'