mirror of
https://github.com/django/django.git
synced 2024-12-25 10:35:48 +00:00
Fixed #8971: correctly reverse urls in admindocs reST roles. Thanks, mitsuhiko.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10683 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
f259494f82
commit
e5757f9261
@ -4,6 +4,7 @@ import re
|
|||||||
from email.Parser import HeaderParser
|
from email.Parser import HeaderParser
|
||||||
from email.Errors import HeaderParseError
|
from email.Errors import HeaderParseError
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
|
from django.core.urlresolvers import reverse
|
||||||
try:
|
try:
|
||||||
import docutils.core
|
import docutils.core
|
||||||
import docutils.nodes
|
import docutils.nodes
|
||||||
@ -52,7 +53,7 @@ def parse_docstring(docstring):
|
|||||||
body = "\n\n".join(parts[1:])
|
body = "\n\n".join(parts[1:])
|
||||||
return title, body, metadata
|
return title, body, metadata
|
||||||
|
|
||||||
def parse_rst(text, default_reference_context, thing_being_parsed=None, link_base='../..'):
|
def parse_rst(text, default_reference_context, thing_being_parsed=None):
|
||||||
"""
|
"""
|
||||||
Convert the string from reST to an XHTML fragment.
|
Convert the string from reST to an XHTML fragment.
|
||||||
"""
|
"""
|
||||||
@ -60,7 +61,7 @@ def parse_rst(text, default_reference_context, thing_being_parsed=None, link_bas
|
|||||||
'doctitle_xform' : True,
|
'doctitle_xform' : True,
|
||||||
'inital_header_level' : 3,
|
'inital_header_level' : 3,
|
||||||
"default_reference_context" : default_reference_context,
|
"default_reference_context" : default_reference_context,
|
||||||
"link_base" : link_base,
|
"link_base" : reverse('django-admindocs-docroot').rstrip('/')
|
||||||
}
|
}
|
||||||
if thing_being_parsed:
|
if thing_being_parsed:
|
||||||
thing_being_parsed = "<%s>" % thing_being_parsed
|
thing_being_parsed = "<%s>" % thing_being_parsed
|
||||||
|
Loading…
Reference in New Issue
Block a user