コード例 #1
0
ファイル: codeintel_mxml.py プロジェクト: sdroz/udl
 def xml_default_dataset_info(self, node):
     # print "%s node %r" % (self.lang, node)
     log.debug("%s node %r", self.lang, node)
     tree = self.xml_tree
     if node is not None and not tree.namespace(node):
         # Do we have an output element, if so, figure out if we're html.
         # Cheap way to get the output element.
         output = tree.tags.get(tree.namespace(
             tree.root), {}).get('output', None)
         if output is not None:
             lang = output.attrib.get('method').upper()
             publicId = output.attrib.get('doctype-public')
             systemId = output.attrib.get('doctype-system')
             if publicId or systemId:
                 default_dataset_info = (publicId, systemId, None)
             else:
                 datasetSvc = getService()
                 default_dataset_info = (
                     datasetSvc.getDefaultPublicId(lang, self.env),
                     None,
                     datasetSvc.getDefaultNamespace(lang, self.env)
                 )
             # print "get output type %r" % (default_dataset_info,)
             return default_dataset_info
     return XMLParsingBufferMixin.xml_default_dataset_info(self, node)
コード例 #2
0
ファイル: langinfo_mxml.py プロジェクト: nagyist/KomodoEdit
 def xml_tree_handler(self, node=None):
     log.debug(">> MXMLBuffer.xml_tree_handler")
     default = self._mxml_default_dataset_info(node)
     if default:
         # force HTML based completion
         return koXMLDatasetInfo.getService().getDocumentHandler(default[0], default[1], default[2])
     return XMLParsingBufferMixin.xml_tree_handler(self, node)
コード例 #3
0
 def xml_tree_handler(self, node=None):
     log.debug(">> MXMLBuffer.xml_tree_handler")
     default = self._mxml_default_dataset_info(node)
     if default:
         # force HTML based completion
         return koXMLDatasetInfo.getService().getDocumentHandler(
             default[0], default[1], default[2])
     return XMLParsingBufferMixin.xml_tree_handler(self, node)
コード例 #4
0
 def xml_default_dataset_info(self, node=None):
     if self._xml_default_dataset_info is None:
         import koXMLDatasetInfo
         datasetSvc = koXMLDatasetInfo.getService()
         self._xml_default_dataset_info = (datasetSvc.getDefaultPublicId(self.m_lang, self.env),
                                         None,
                                         datasetSvc.getDefaultNamespace(self.m_lang, self.env))
     return self._xml_default_dataset_info
コード例 #5
0
ファイル: driver.py プロジェクト: SublimeCodeIntel/codeintel
 def do_set_xml_catalogs(self, request, driver):
     catalogs = request.get("catalogs")
     import koXMLDatasetInfo
     datasetHandler = koXMLDatasetInfo.getService()
     if catalogs is None:
         import koXMLDatasetInfo
         kodevel_basedir = dirname(dirname(dirname(abspath(__file__))))
         catalog = join(kodevel_basedir, "catalogs", "catalog.xml")
         catalogs = [catalog]
     datasetHandler.setCatalogs(catalogs)
     driver.send(request=request)
コード例 #6
0
 def do_set_xml_catalogs(self, request, driver):
     catalogs = request.get("catalogs")
     import koXMLDatasetInfo
     datasetHandler = koXMLDatasetInfo.getService()
     if catalogs is None:
         import koXMLDatasetInfo
         kodevel_basedir = dirname(dirname(dirname(abspath(__file__))))
         catalog = join(kodevel_basedir, "catalogs", "catalog.xml")
         catalogs = [catalog]
     datasetHandler.setCatalogs(catalogs)
     driver.send(request=request)
コード例 #7
0
ファイル: citestsupport.py プロジェクト: 2lost4u/codeintel
def init_xml_catalogs():
    global _xml_catalogs_initialized
    if _xml_catalogs_initialized:
        return
    # We have to initialize the catalog service so completion testing
    # will work.
    _xml_catalogs_initialized = True
    import koXMLDatasetInfo
    kodevel_basedir = dirname(dirname(dirname(dirname(abspath(__file__)))))
    catalog = join(kodevel_basedir, "test", "stuff", "xml", "testcat.xml")
    catsvc = koXMLDatasetInfo.getService()
    catsvc.resolver.resetCatalogs([catalog])
コード例 #8
0
def init_xml_catalogs():
    global _xml_catalogs_initialized
    if _xml_catalogs_initialized:
        return
    # We have to initialize the catalog service so completion testing
    # will work.
    _xml_catalogs_initialized = True
    import koXMLDatasetInfo
    kodevel_basedir = dirname(dirname(dirname(dirname(abspath(__file__)))))
    catalog = join(kodevel_basedir, "test", "stuff", "xml", "testcat.xml")
    catsvc = koXMLDatasetInfo.getService()
    catsvc.resolver.resetCatalogs([catalog])
コード例 #9
0
ファイル: driver.py プロジェクト: Acidburn0zzz/KomodoEdit
 def do_get_xml_catalogs(self, request, driver):
     import koXMLDatasetInfo
     public = set()
     system = set()
     datasetHandler = koXMLDatasetInfo.getService()
     for catalog in datasetHandler.resolver.catalogMap.values():
         public.update(catalog.public.keys())
         system.update(catalog.system.keys())
     namespaces = datasetHandler.resolver.getWellKnownNamspaces().keys()
     driver.send(request=request,
                 public=sorted(public),
                 system=sorted(system),
                 namespaces=sorted(namespaces))
コード例 #10
0
ファイル: driver.py プロジェクト: zqy1/SublimeCodeIntel
 def do_get_xml_catalogs(self, request, driver):
     import koXMLDatasetInfo
     public = set()
     system = set()
     datasetHandler = koXMLDatasetInfo.getService()
     for catalog in datasetHandler.resolver.catalogMap.values():
         public.update(catalog.public.keys())
         system.update(catalog.system.keys())
     namespaces = datasetHandler.resolver.getWellKnownNamspaces().keys()
     driver.send(request=request,
                 public=sorted(public),
                 system=sorted(system),
                 namespaces=sorted(namespaces))
コード例 #11
0
ファイル: lang_xml.py プロジェクト: MisatoTremor/dotfiles
    def async_eval_at_trg(self, buf, trg, ctlr):
        if _xpcom_:
            if hasattr(trg, "_comobj_"):
                trg = UnwrapObject(trg)
            if hasattr(ctlr, "_comobj_"):
                ctlr = UnwrapObject(ctlr)

        cplns = None
        ctlr.start(buf, trg)
        type = trg.type
        if type == "tags-and-namespaces":
            # extract tag hierarchy context -> context
            # pass context to schema-based-evaluator -> completions
            cplns = self.cpln_start_tag(buf, trg, True)
        elif type == "gt-bang":
            cplns = [
                ('doctype', 'DOCTYPE'),
                ('cdata', '[CDATA['),
                ('comment', '--'),
            ]
        elif type == "end-tag":
            cplns = self.cpln_end_tag(buf, trg)
        elif type == "well-known-ns":
            # this is a hack, we should get this from the catalog, but
            # prefix names are *not* standardized.
            cplns = common_namespace_cplns
        elif type == "well-known-ns-uri":
            # we get all uri's known to our catalog system
            uris = getService().resolver.getWellKnownNamspaces()
            cplns = [('namespace', x) for x in uris]
        elif type == "ns-tags":
            plns = self.cpln_start_tag(buf, trg, False)
        elif type == "ns-tags-attrs":
            cplns = self.cpln_start_attrribute(buf, trg)
        elif type == "tag-attrs":
            cplns = self.cpln_start_attrribute(buf, trg)
        elif type == "attr-enum-values":
            cplns = self.cpln_start_attribute_value(buf, trg)
        else:
            ctlr.error(
                "lang_xml.py: async_eval_at_trg:\n    Internal error: Unknown UDL-based XML completion type: %r"
                % (type, ))
            ctlr.done("error")
            return
        if cplns:
            ctlr.set_cplns(cplns)
        ctlr.done("success")
コード例 #12
0
ファイル: lang_xml.py プロジェクト: Fairvol/SublimeCodeIntel
    def async_eval_at_trg(self, buf, trg, ctlr):
        if _xpcom_:
            if hasattr(trg, "_comobj_"):
                trg = UnwrapObject(trg)
            if hasattr(ctlr, "_comobj_"):
                ctlr = UnwrapObject(ctlr)

        cplns = None
        ctlr.start(buf, trg)
        type = trg.type
        if type == "tags-and-namespaces":
            # extract tag hierarchy context -> context
            # pass context to schema-based-evaluator -> completions
            cplns = self.cpln_start_tag(buf, trg, True)
        elif type == "gt-bang":
            cplns = [
                ('doctype', 'DOCTYPE'),
                ('cdata', '[CDATA['),
                ('comment', '--'),
            ]
        elif type == "end-tag":
            cplns = self.cpln_end_tag(buf, trg)
        elif type == "well-known-ns":
            # this is a hack, we should get this from the catalog, but
            # prefix names are *not* standardized.
            cplns = common_namespace_cplns
        elif type == "well-known-ns-uri":
            # we get all uri's known to our catalog system
            uris = getService().resolver.getWellKnownNamspaces()
            cplns = [('namespace', x) for x in uris]
        elif type == "ns-tags":
            plns = self.cpln_start_tag(buf, trg, False)
        elif type == "ns-tags-attrs":
            cplns = self.cpln_start_attrribute(buf, trg)
        elif type == "tag-attrs":
            cplns = self.cpln_start_attrribute(buf, trg)
        elif type == "attr-enum-values":
            cplns = self.cpln_start_attribute_value(buf, trg)
        else:
            ctlr.error(
                "lang_xml.py: async_eval_at_trg:\n    Internal error: Unknown UDL-based XML completion type: %r" % (type,))
            ctlr.done("error")
            return
        if cplns:
            ctlr.set_cplns(cplns)
        ctlr.done("success")
コード例 #13
0
 def _mxml_default_dataset_info(self, node):
     log.debug(">> MXMLBuffer._mxml_default_dataset_info")
     #print "%s node %r" % (buf.lang, node)
     tree = self.xml_tree
     parent = node
     while parent is not None:
         if parent.localName == "Content":
             if parent.attrib.get("type", "").startswith("html"):
                 datasetSvc = koXMLDatasetInfo.getService()
                 default_dataset_info = (datasetSvc.getDefaultPublicId(
                     "HTML", self.env), None,
                                         datasetSvc.getDefaultNamespace(
                                             "HTML", self.env))
                 return default_dataset_info
             break
         parent = tree.parent(parent)
     return None
コード例 #14
0
ファイル: langinfo_mxml.py プロジェクト: nagyist/KomodoEdit
 def _mxml_default_dataset_info(self, node):
     log.debug(">> MXMLBuffer._mxml_default_dataset_info")
     # print "%s node %r" % (buf.lang, node)
     tree = self.xml_tree
     parent = node
     while parent is not None:
         if parent.localName == "Content":
             if parent.attrib.get("type", "").startswith("html"):
                 datasetSvc = koXMLDatasetInfo.getService()
                 default_dataset_info = (
                     datasetSvc.getDefaultPublicId("HTML", self.env),
                     None,
                     datasetSvc.getDefaultNamespace("HTML", self.env),
                 )
                 return default_dataset_info
             break
         parent = tree.parent(parent)
     return None
コード例 #15
0
ファイル: lang_xslt.py プロジェクト: p4p3r/CodeIntel
 def xml_default_dataset_info(self, node):
     #print "%s:%s node %r" % (self.lang, trg.lang, node)
     tree = self.xml_tree
     if node is not None and not tree.namespace(node):
         # Do we have an output element, if so, figure out if we're html.
         # Cheap way to get the output element.
         output = tree.tags.get(tree.namespace(tree.root),
                                {}).get('output', None)
         if output is not None:
             lang = output.attrib.get('method').upper()
             publicId = output.attrib.get('doctype-public')
             systemId = output.attrib.get('doctype-system')
             if publicId or systemId:
                 default_dataset_info = (publicId, systemId, None)
             else:
                 datasetSvc = getService()
                 default_dataset_info = (datasetSvc.getDefaultPublicId(
                     lang, self.env), None,
                                         datasetSvc.getDefaultNamespace(
                                             lang, self.env))
             #print "get output type %r" % (default_dataset_info,)
             return default_dataset_info
     return XMLParsingBufferMixin.xml_default_dataset_info(self, node)
コード例 #16
0
ファイル: driver.py プロジェクト: Acidburn0zzz/KomodoEdit
 def do_set_xml_catalogs(self, request, driver):
     catalogs = request["catalogs"]
     import koXMLDatasetInfo
     datasetHandler = koXMLDatasetInfo.getService()
     datasetHandler.setCatalogs(catalogs)
     driver.send(request=request)
コード例 #17
0
ファイル: driver.py プロジェクト: zqy1/SublimeCodeIntel
 def do_set_xml_catalogs(self, request, driver):
     catalogs = request["catalogs"]
     import koXMLDatasetInfo
     datasetHandler = koXMLDatasetInfo.getService()
     datasetHandler.setCatalogs(catalogs)
     driver.send(request=request)