Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make libdoc work a bit better #4

Merged
merged 2 commits into from
Nov 24, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deploy-ghpages.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
dir = mkdtemp()
check_call("git clone --branch %s %s %s" % (deploy_branch, repo, dir), shell=True)
chdir(dir)
check_call("python -m robot.libdoc robotpageobjects.page.Page index.html", shell=True)
check_call("python -m robot.libdoc robotpageobjects.Page index.html", shell=True)
print "Docs built successfully"
check_call("git config user.name '%s'" % getenv('GIT_NAME'), shell=True)
check_call("git config user.email '%s'" % getenv('GIT_EMAIL'), shell=True)
Expand Down
12 changes: 6 additions & 6 deletions robotpageobjects/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ def get_robot_aliases(cls, name, pageobject_name):
"""
ret = []

# Look through the alias dict if not in libdoc. If there is an alias, add the aliased version to what is returned.
if not in_ld:
if name in cls._aliases:
ret.append(cls._aliases[name].replace(cls._alias_delimiter, "_" + pageobject_name + "_"))
else:
# If not aliased, add the keyword name with the page object name at the end.
# Look through the alias dict. If there is an alias, add the aliased version to what is returned.
if name in cls._aliases:
ret.append(cls._aliases[name].replace(cls._alias_delimiter, "_" + pageobject_name + "_"))
else:
# If not aliased, add the keyword name with the page object name at the end.
if not in_ld:
ret.append("%s_%s" % (name, pageobject_name))

# Add the plain name of the keyword.
Expand Down
20 changes: 13 additions & 7 deletions robotpageobjects/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ class Page(_BaseActions, _SelectorsManager, _ComponentsManager):
"""
__metaclass__ = _PageMeta


def __init__(self):
"""
Initializes the pageobject_name variable, which is used by the _Keywords class
Expand All @@ -144,7 +143,12 @@ def __init__(self):
@staticmethod
@not_keyword
def _titleize(str):
return re.sub(r"(\w)([A-Z])", r"\1 \2", str)
"""
Converts camel case to title case
:param str: camel case string
:return: title case string
"""
return re.sub('([a-z0-9])([A-Z])', r'\1 \2', re.sub(r"(.)([A-Z][a-z]+)", r'\1 \2', str))

@staticmethod
@not_keyword
Expand Down Expand Up @@ -271,16 +275,18 @@ def get_keyword_documentation(self, kwname):
:return: a documentation string for kwname
"""
if kwname == '__intro__':
doc = """\n
docstring = self.__doc__ if self.__doc__ else ''
s2l_link = """\n
All keywords listed in the Selenium2Library documentation are also available in this Page Object.
See http://rtomac.github.io/robotframework-selenium2library/doc/Selenium2Library.html
"""
return self.__doc__ + doc
return docstring + s2l_link
kw = getattr(self, kwname, None)
doc = kw.__doc__ if kw.__doc__ else ''
alias = ''
if kwname in _Keywords._aliases:
doc = '*Alias: %s*\n\n' % _Keywords.get_robot_aliases(kwname, self._underscore(self.name))[0].replace('_', ' ').title() + doc
return doc
alias = '*Alias: %s*\n\n' % _Keywords.get_robot_aliases(kwname, self._underscore(self.name))[0].replace('_', ' ').title()
docstring = kw.__doc__ if kw.__doc__ else ''
return alias + docstring

@not_keyword
def get_keyword_arguments(self, kwname):
Expand Down