Closed jmfederico closed 1 year ago
I was not sure how to test the Role, so no tests were included 😥
Merging #19 into master will increase coverage by
0.76%
. The diff coverage is75%
.
@@ Coverage Diff @@
## master #19 +/- ##
=========================================
+ Coverage 57.84% 58.6% +0.76%
=========================================
Files 6 6
Lines 204 215 +11
=========================================
+ Hits 118 126 +8
- Misses 86 89 +3
Impacted Files | Coverage Δ | |
---|---|---|
sphinxcontrib_django/roles.py | 84.21% <75%> (-15.79%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 5508cf0...3d581c3. Read the comment docs.
Thanks for the PR so far! I like what you're working at!
Did you get this to work in your own projects? I wondered, since I didn't see a py:model
definition somewhere in the code.
The best test would be something like trying to render a small piece of ReStructuredText (e.g. that just renders :model:`auth.User`
and proves it renders a proper link for that)
The Django admin documentation generator has a role to link to models
:model:`app_label.ModelName`
that links to the documentation page generate by Django.This PR create the same role for Sphinx which converts the given model Django path (
app_label.ModelName
) to the real path of the class in python (app_label.models.ModelName
), allowing for the same docstring format to be used by both the Django admin documentation and Sphinx and still generate valid links for both.For instance, one can now refer to the auth User model like this (
:model:`auth.User`
) and it will link todjango.contrib.auth.models.User
if such class was included in the documentation.