Skip to content

Commit

Permalink
Merge pull request #565 from geopython/fix-pywps.ext_autodoc.Metadata…
Browse files Browse the repository at this point in the history
…Url-wrong-location

move MetadataUrl to pywps.app.Common to avoid dependencies on sphinx
  • Loading branch information
cehbrecht committed Jan 25, 2021
2 parents effc9cd + d389ee6 commit 0c18a2e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
18 changes: 18 additions & 0 deletions pywps/app/Common.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,21 @@ def __eq__(self, other):
self.role == other.role,
self.type == other.type,
])


class MetadataUrl(Metadata):
"""Metadata subclass to allow anonymous links generation in documentation.
Useful to avoid Sphinx "Duplicate explicit target name" warning.
See https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#anonymous-hyperlinks.
Meant to use in documentation only, not needed in the xml response, nor being serialized or
deserialized to/from json. So that's why it is not directly in the base class.
"""

def __init__(self, title, href=None, role=None, type_='simple',
anonymous=False):
super().__init__(title, href=href, role=role, type_=type_)
self.anonymous = anonymous
"Whether to create anonymous link (boolean)."
17 changes: 1 addition & 16 deletions pywps/ext_autodoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,7 @@
from sphinx.util import force_decode
from docutils.parsers.rst import directives
from pywps import Process
from pywps.app.Common import Metadata


class MetadataUrl(Metadata):
"""Metadata subclass to allow anonymous links generation.
Useful to avoid Sphinx "Duplicate explicit target name" warning.
See https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#anonymous-hyperlinks.
"""

def __init__(self, title, href=None, role=None, type_='simple',
anonymous=False):
super().__init__(title, href=href, role=role, type_=type_)
self.anonymous = anonymous
"Whether to create anonymous link (boolean)."
from pywps.app.Common import Metadata, MetadataUrl


class ProcessDocumenter(ClassDocumenter):
Expand Down
3 changes: 1 addition & 2 deletions pywps/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
from pywps import Process
from pywps.inout import LiteralInput, LiteralOutput, ComplexInput, ComplexOutput, BoundingBoxInput, BoundingBoxOutput
from pywps.inout import Format
from pywps.app.Common import Metadata
from pywps.ext_autodoc import MetadataUrl
from pywps.app.Common import Metadata, MetadataUrl

import re

Expand Down

0 comments on commit 0c18a2e

Please sign in to comment.