How to use the extruct.rdflibxml.host.__init__.HostLanguage function in extruct

To help you get started, we’ve selected a few extruct examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scrapinghub / extruct / extruct / rdflibxml / host / __init__.py View on Github external
from .html5 import html5_extra_attributes, remove_rel

class HostLanguage(object):
    """An enumeration style class: recognized host language types for this processor of RDFa. Some processing details may depend on these host languages. "rdfa_core" is the default Host Language is nothing else is defined."""
    rdfa_core     = "RDFa Core"
    xhtml        = "XHTML+RDFa"
    xhtml5        = "XHTML5+RDFa"
    html5        = "HTML5+RDFa"
    atom        = "Atom+RDFa"
    svg            = "SVG+RDFa"

# initial contexts for host languages
initial_contexts = {
    HostLanguage.xhtml      : ["http://www.w3.org/2011/rdfa-context/rdfa-1.1",
                               "http://www.w3.org/2011/rdfa-context/xhtml-rdfa-1.1"],
    HostLanguage.xhtml5     : ["http://www.w3.org/2011/rdfa-context/rdfa-1.1"],
    HostLanguage.html5      : ["http://www.w3.org/2011/rdfa-context/rdfa-1.1"],
    HostLanguage.rdfa_core  : ["http://www.w3.org/2011/rdfa-context/rdfa-1.1"],
    HostLanguage.atom       : ["http://www.w3.org/2011/rdfa-context/rdfa-1.1"],
    HostLanguage.svg        : ["http://www.w3.org/2011/rdfa-context/rdfa-1.1"],
}

beautifying_prefixes = {
    HostLanguage.xhtml    : {
        "xhv" : "http://www.w3.org/1999/xhtml/vocab#"
    },
    # HostLanguage.html5    : {
    #     "xhv" : "http://www.w3.org/1999/xhtml/vocab#"
    # },
    # HostLanguage.xhtml5    : {
    #     "xhv" : "http://www.w3.org/1999/xhtml/vocab#"
    # },
github scrapinghub / extruct / extruct / rdflibxml / host / __init__.py View on Github external
#     "xhv" : "http://www.w3.org/1999/xhtml/vocab#"
    # },
    # HostLanguage.xhtml5    : {
    #     "xhv" : "http://www.w3.org/1999/xhtml/vocab#"
    # },
    HostLanguage.atom : {
        "atomrel" : "http://www.iana.org/assignments/relation/"
    }
}


accept_xml_base        = [ HostLanguage.rdfa_core, HostLanguage.atom, HostLanguage.svg,  HostLanguage.xhtml5 ]
accept_xml_lang        = [ HostLanguage.rdfa_core, HostLanguage.atom, HostLanguage.svg ]

accept_embedded_rdf_xml    = [ HostLanguage.svg, HostLanguage.rdfa_core ]
accept_embedded_turtle    = [ HostLanguage.svg, HostLanguage.html5, HostLanguage.xhtml5, HostLanguage.xhtml ]

# some languages, eg, SVG, require that embedded content should be combined with the default graph,
# ie, it cannot be turned down by an option
require_embedded_rdf    = [ HostLanguage.svg ]

warn_xmlns_usage = [ HostLanguage.html5, HostLanguage.xhtml5, HostLanguage.xhtml ]

host_dom_transforms = {
    HostLanguage.atom   : [atom_add_entry_type],
    HostLanguage.html5  : [html5_extra_attributes, remove_rel],
    HostLanguage.xhtml5 : [html5_extra_attributes, remove_rel]
}

default_vocabulary = {
    HostLanguage.atom : "http://www.iana.org/assignments/relation/"
}
github scrapinghub / extruct / extruct / rdflibxml / host / __init__.py View on Github external
"atomrel" : "http://www.iana.org/assignments/relation/"
    }
}


accept_xml_base        = [ HostLanguage.rdfa_core, HostLanguage.atom, HostLanguage.svg,  HostLanguage.xhtml5 ]
accept_xml_lang        = [ HostLanguage.rdfa_core, HostLanguage.atom, HostLanguage.svg ]

accept_embedded_rdf_xml    = [ HostLanguage.svg, HostLanguage.rdfa_core ]
accept_embedded_turtle    = [ HostLanguage.svg, HostLanguage.html5, HostLanguage.xhtml5, HostLanguage.xhtml ]

# some languages, eg, SVG, require that embedded content should be combined with the default graph,
# ie, it cannot be turned down by an option
require_embedded_rdf    = [ HostLanguage.svg ]

warn_xmlns_usage = [ HostLanguage.html5, HostLanguage.xhtml5, HostLanguage.xhtml ]

host_dom_transforms = {
    HostLanguage.atom   : [atom_add_entry_type],
    HostLanguage.html5  : [html5_extra_attributes, remove_rel],
    HostLanguage.xhtml5 : [html5_extra_attributes, remove_rel]
}

default_vocabulary = {
    HostLanguage.atom : "http://www.iana.org/assignments/relation/"
}

predefined_1_0_rel  = ['alternate', 'appendix', 'cite', 'bookmark', 'chapter', 'contents',
'copyright', 'glossary', 'help', 'icon', 'index', 'meta', 'next', 'p3pv1', 'prev', 'previous',
'role', 'section', 'subsection', 'start', 'license', 'up', 'last', 'stylesheet', 'first', 'top']

# ----------------------------------------------------------------------------------------------------------
github scrapinghub / extruct / extruct / rdflibxml / host / __init__.py View on Github external
HostLanguage.rdfa_core  : ["http://www.w3.org/2011/rdfa-context/rdfa-1.1"],
    HostLanguage.atom       : ["http://www.w3.org/2011/rdfa-context/rdfa-1.1"],
    HostLanguage.svg        : ["http://www.w3.org/2011/rdfa-context/rdfa-1.1"],
}

beautifying_prefixes = {
    HostLanguage.xhtml    : {
        "xhv" : "http://www.w3.org/1999/xhtml/vocab#"
    },
    # HostLanguage.html5    : {
    #     "xhv" : "http://www.w3.org/1999/xhtml/vocab#"
    # },
    # HostLanguage.xhtml5    : {
    #     "xhv" : "http://www.w3.org/1999/xhtml/vocab#"
    # },
    HostLanguage.atom : {
        "atomrel" : "http://www.iana.org/assignments/relation/"
    }
}


accept_xml_base        = [ HostLanguage.rdfa_core, HostLanguage.atom, HostLanguage.svg,  HostLanguage.xhtml5 ]
accept_xml_lang        = [ HostLanguage.rdfa_core, HostLanguage.atom, HostLanguage.svg ]

accept_embedded_rdf_xml    = [ HostLanguage.svg, HostLanguage.rdfa_core ]
accept_embedded_turtle    = [ HostLanguage.svg, HostLanguage.html5, HostLanguage.xhtml5, HostLanguage.xhtml ]

# some languages, eg, SVG, require that embedded content should be combined with the default graph,
# ie, it cannot be turned down by an option
require_embedded_rdf    = [ HostLanguage.svg ]

warn_xmlns_usage = [ HostLanguage.html5, HostLanguage.xhtml5, HostLanguage.xhtml ]
github scrapinghub / extruct / extruct / rdflibxml / host / __init__.py View on Github external
HostLanguage.xhtml    : {
        "xhv" : "http://www.w3.org/1999/xhtml/vocab#"
    },
    # HostLanguage.html5    : {
    #     "xhv" : "http://www.w3.org/1999/xhtml/vocab#"
    # },
    # HostLanguage.xhtml5    : {
    #     "xhv" : "http://www.w3.org/1999/xhtml/vocab#"
    # },
    HostLanguage.atom : {
        "atomrel" : "http://www.iana.org/assignments/relation/"
    }
}


accept_xml_base        = [ HostLanguage.rdfa_core, HostLanguage.atom, HostLanguage.svg,  HostLanguage.xhtml5 ]
accept_xml_lang        = [ HostLanguage.rdfa_core, HostLanguage.atom, HostLanguage.svg ]

accept_embedded_rdf_xml    = [ HostLanguage.svg, HostLanguage.rdfa_core ]
accept_embedded_turtle    = [ HostLanguage.svg, HostLanguage.html5, HostLanguage.xhtml5, HostLanguage.xhtml ]

# some languages, eg, SVG, require that embedded content should be combined with the default graph,
# ie, it cannot be turned down by an option
require_embedded_rdf    = [ HostLanguage.svg ]

warn_xmlns_usage = [ HostLanguage.html5, HostLanguage.xhtml5, HostLanguage.xhtml ]

host_dom_transforms = {
    HostLanguage.atom   : [atom_add_entry_type],
    HostLanguage.html5  : [html5_extra_attributes, remove_rel],
    HostLanguage.xhtml5 : [html5_extra_attributes, remove_rel]
}