-
Notifications
You must be signed in to change notification settings - Fork 5
[RFC] Migrated to Sphinx #6
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
Conversation
@@ -0,0 +1,10 @@ | |||
This is the common Sphinx Theme for all Doctrine Project Documentations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably change this README?
I'd leave a notice you based it on the doctrine theme.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this theme is now a default theme (pyramid) but I forgot to delete this README :)
OK. I have split the tutorial into chapters. Open for comments but no proof reading just yet :P |
About the API link thing. That's done by the def php_namespace_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
text = utils.unescape(text)
env = inliner.document.settings.env
base_url = env.app.config.api_url
has_explicit_title, title, namespace = split_explicit_title(text)
try:
full_url = base_url % namespace.replace('\\', '.') + '.html'
except (TypeError, ValueError):
env.warn(env.docname, 'unable to expand %s api_url with base '
'URL %r, please make sure the base contains \'%%s\' '
'exactly once' % (typ, base_url))
full_url = base_url + utils.escape(full_class)
if not has_explicit_title:
name = namespace.lstrip('\\')
ns = name.rfind('\\')
if ns != -1:
name = name[ns+1:]
title = name
list = [nodes.reference(title, title, internal=False, refuri=full_url, reftitle=namespace)]
pnode = nodes.literal('', '', *list)
return [pnode], []
def php_class_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
text = utils.unescape(text)
env = inliner.document.settings.env
base_url = env.app.config.api_url
has_explicit_title, title, full_class = split_explicit_title(text)
if len(re.findall(r'[^\\]\\[^\\]', rawtext)) > 0:
env.warn(env.docname, 'backslash not escaped in %s' % rawtext, lineno)
try:
full_url = base_url % full_class.replace('\\', '.') + '.html'
except (TypeError, ValueError):
env.warn(env.docname, 'unable to expand %s api_url with base '
'URL %r, please make sure the base contains \'%%s\' '
'exactly once' % (typ, base_url))
full_url = base_url + utils.escape(full_class)
if not has_explicit_title:
class_name = full_class.lstrip('\\')
ns = class_name.rfind('\\')
if ns != -1:
class_name = class_name[ns+1:]
title = class_name
list = [nodes.reference(title, title, internal=False, refuri=full_url, reftitle=full_class)]
pnode = nodes.literal('', '', *list)
return [pnode], []
def php_method_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
text = utils.unescape(text)
env = inliner.document.settings.env
base_url = env.app.config.api_url
has_explicit_title, title, class_and_method = split_explicit_title(text)
ns = class_and_method.rfind('::')
full_class = class_and_method[:ns]
method = class_and_method[ns+2:]
if len(re.findall(r'[^\\]\\[^\\]', rawtext)) > 0:
env.warn(env.docname, 'backslash not escaped in %s' % rawtext, lineno)
try:
full_url = base_url % full_class.replace('\\', '.') + '.html' + '#method_' + method
except (TypeError, ValueError):
env.warn(env.docname, 'unable to expand %s api_url with base '
'URL %r, please make sure the base contains \'%%s\' '
'exactly once' % (typ, base_url))
full_url = base_url + utils.escape(full_class)
if not has_explicit_title:
title = method + '()'
list = [nodes.reference(title, title, internal=False, refuri=full_url, reftitle=full_class + '::' + method + '()')]
pnode = nodes.literal('', '', *list)
return [pnode], []
def setup(app):
app.add_config_value('api_url', {}, 'env')
app.add_role('namespace', php_namespace_role)
app.add_role('class', php_class_role)
app.add_role('method', php_method_role) And then configure |
I think it shouldn't be a problem to make the format configurable. |
No, but I don't have enough Python knowledge. You can just follow the steps done with |
Shouldn't be that hard. If you need it I can create a pull request making it configurable. |
Regarding the API links .. its a bit of a non-issue currently as we hardly reference any classes by their names currently. I have done a quick proof-reading of the reformatted documentation and made some fixes. Shall we merge this and link to readthedocs from the website? |
# built documents. | ||
# | ||
# The short X.Y version. | ||
version = '0.1' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be 2.1
+1 for this, i like it. can you please also update the README to link to phpcr.github.io and the new readthedocs page? |
Updated, merging .. |
Just FYI, the URL pattern is now configurable in the Sphinx extension (if you ever have the need to use it). |
This PR migrates the tutorial to sphinx and adds a theme.
http://phpcr.readthedocs.org/en/latest/