Skip to content

Commit

Permalink
version update
Browse files Browse the repository at this point in the history
  • Loading branch information
harel committed Jan 2, 2021
1 parent a22cf2e commit 919ba8d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
37 changes: 22 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ Supports opengraph arrays (and can receive content as input)

Add your own meta tag schema
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You can provide Metatron with your own meta tag schema spec:
You can provide Metatron with your own meta tag schema spec

::

> from metatron import add_schema_spec
> my_spec = {
'name': 'boom',
Expand All @@ -133,12 +135,16 @@ You can provide Metatron with your own meta tag schema spec:
> add_schema_spec(my_spec)

You can then parse tags like:

::

<meta name="boom:title" value="Boom title" />
<meta name="boom:description" value="Boom description" />

Using

::

> mt = Metatron(url='http://example.com', schemas=['boom'])
> mt.traverse()
> {
Expand All @@ -148,18 +154,19 @@ Using
}
}

Note that the `add_schema_spec` call allows for an additional argument to tag the schema as.
Note that the `add_schema_spec` call allows for an additional argument to tag the schema as.
This is useful if you have multiple schema definitions with the same name (or no name).

Custom schema - custom tag
^^^^^^^^^^^^^^^^^^^^^^^^^^
It is possible to add a `tag` key to the custom schema spec,
which can then lookup different tags other than `meta`.
If not provided, `meta` is used by default.
It is possible to add a `tag` key to the custom schema spec,
which can then lookup different tags other than `meta`.
If not provided, `meta` is used by default.

__Added in 0.4__
*Added in 0.4*

::

> from metatron import add_schema_spec
> my_spec = {
'tag': 'link',
Expand All @@ -169,15 +176,15 @@ __Added in 0.4__
}
> # Register the schema as 'link' to avoid duplicating existing no-name schema
> add_schema_spec(my_spec, 'link')
> content = """
<meta property="og:title" content="First title tag" />
<meta property="og::title" content="Second title tag" />
<meta property="og:description" content="description tag" />
<meta property="og:image" content="http://example.com/image.jpg" />
<link rel="canonical" href="https://example.com/cannonicallink/" />
"""
> mt = Metatron(content=content, schemas=['link'])
> content = """
<meta property="og:title" content="First title tag" />
<meta property="og::title" content="Second title tag" />
<meta property="og:description" content="description tag" />
<meta property="og:image" content="http://example.com/image.jpg" />

<link rel="canonical" href="https://example.com/cannonicallink/" />
"""
> mt = Metatron(content=content, schemas=['link'])
> mt.traverse()


Expand Down
2 changes: 1 addition & 1 deletion metatron/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.4'
__version__ = '0.5'

0 comments on commit 919ba8d

Please sign in to comment.