-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Embed: add tests for glossary and citations and foot notes #7986
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d59aeb3
Embed: add tests for sphinx-bibtex
stsewd 9b8e506
Embed: add tests for glossary
stsewd ab997bd
Merge branch 'master' into embed-test-def-lists
stsewd 039859a
Update tests
stsewd ed82e79
Merge branch 'master' into embed-test-def-lists
stsewd da5eff4
Test with multiple versions
stsewd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import pytest | ||
from rest_framework.test import APIClient | ||
|
||
pytest_plugins = 'sphinx.testing.fixtures' | ||
|
||
@pytest.fixture | ||
def api_client(): | ||
return APIClient() |
166 changes: 166 additions & 0 deletions
166
readthedocs/embed/tests/data/sphinx/bibtex/page-getting-started.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
<div class="section" id="getting-started"> | ||
<h1>Getting Started<a class="headerlink" href="http://project.readthedocs.io/en/latest/index.html#getting-started" title="Permalink to this headline">¶</a></h1> | ||
<div class="section" id="overview"> | ||
<h2>Overview<a class="headerlink" href="http://project.readthedocs.io/en/latest/index.html#overview" title="Permalink to this headline">¶</a></h2> | ||
<p>Sphinx extension for BibTeX style citations.</p> | ||
<p> | ||
The bibtex extension allows <a class="reference external" href="http://www.bibtex.org/">BibTeX</a> | ||
citations to be inserted into documentation generated by | ||
<a class="reference external" href="https://www.sphinx-doc.org/en/master/">Sphinx</a>, via | ||
a <code class="docutils literal notranslate"><span class="pre">bibliography</span></code> directive, | ||
along with <code class="docutils literal notranslate"><span class="pre">:cite:p:</span></code> and <code | ||
class="docutils literal notranslate"><span class="pre">:cite:t:</span></code> roles. | ||
These work similarly to LaTeX\u2019s <code | ||
class="docutils literal notranslate"><span class="pre">thebibliography</span></code> environment | ||
and the <code class="docutils literal notranslate"><span class="pre">\\citet</span></code> and <code | ||
class="docutils literal notranslate"><span class="pre">\\citep</span></code> commands. | ||
</p> | ||
<p> | ||
For formatting, the extension relies on <a class="reference external" href="https://pybtex.org/">pybtex</a> | ||
written by Andrey Golovizin. The extension is inspired by Matthew Brett’s | ||
<a class="reference external" href="https://github.com/matthew-brett/bibstuff">bibstuff.sphinxext.bibref</a> | ||
and Weston Nielson’s | ||
<a class="reference external" | ||
href="https://github.com/mcmtroffaes/sphinxcontrib-bibtex/blob/develop/test/natbib.py">sphinx-natbib</a>. | ||
</p> | ||
<ul class="simple"> | ||
<li> | ||
<p> | ||
Download: <a class="reference external" | ||
href="https://pypi.org/project/sphinxcontrib-bibtex/#files">https://pypi.org/project/sphinxcontrib-bibtex/#files</a> | ||
</p> | ||
</li> | ||
<li> | ||
<p> | ||
Documentation: <a class="reference external" | ||
href="https://sphinxcontrib-bibtex.readthedocs.io/en/latest/">https://sphinxcontrib-bibtex.readthedocs.io/en/latest/</a> | ||
</p> | ||
</li> | ||
<li> | ||
<p> | ||
Development: <a class="reference external" | ||
href="https://github.com/mcmtroffaes/sphinxcontrib-bibtex/">https://github.com/mcmtroffaes/sphinxcontrib-bibtex/</a> | ||
</p> | ||
</li> | ||
</ul> | ||
</div> | ||
<div class="section" id="installation"> | ||
<h2>Installation<a class="headerlink" href="http://project.readthedocs.io/en/latest/index.html#installation" title="Permalink to this headline">¶</a></h2> | ||
<p> | ||
Install the module with <code | ||
class="docutils literal notranslate"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">sphinxcontrib-bibtex</span></code>, | ||
or from source using <code | ||
class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">install</span></code>. | ||
Then add: | ||
</p> | ||
<div class="highlight-python notranslate"> | ||
<div class="highlight"> | ||
<pre><span></span><span class="n">extensions</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'sphinxcontrib.bibtex'</span><span class="p">]</span> | ||
<span class="n">bibtex_bibfiles</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'refs.bib'</span><span class="p">]</span> | ||
</pre> | ||
</div> | ||
</div> | ||
<p> | ||
to your project’s Sphinx configuration file <code | ||
class="docutils literal notranslate"><span class="pre">conf.py</span></code>. | ||
</p> | ||
</div> | ||
<div class="section" id="minimal-example"> | ||
<h2>Minimal Example<a class="headerlink" href="http://project.readthedocs.io/en/latest/index.html#minimal-example" title="Permalink to this headline">¶</a></h2> | ||
<p> | ||
In your project\u2019s documentation, you can use | ||
<code class="docutils literal notranslate"><span class="pre">:cite:t:</span></code> for textual citation | ||
references, | ||
<code class="docutils literal notranslate"><span class="pre">:cite:p:</span></code> for parenthetical citation | ||
references, and <code | ||
class="docutils literal notranslate"><span class="pre">..</span> <span class="pre">bibliography::</span></code> | ||
for inserting the bibliography. For <a class="reference external" | ||
href="https://github.com/mcmtroffaes/sphinxcontrib-bibtex/tree/develop/test/roots/test-debug_minimal_example">example</a>: | ||
</p> | ||
<div class="highlight-rest notranslate"> | ||
<div class="highlight"> | ||
<pre><span></span>See <span class="na">:cite:t:</span><span class="nv">`1987:nelson`</span> for an introduction to non-standard analysis. | ||
Non-standard analysis is fun <span class="na">:cite:p:</span><span class="nv">`1987:nelson`</span>. | ||
|
||
<span class="p">..</span> <span class="ow">bibliography</span><span class="p">::</span> | ||
</pre> | ||
</div> | ||
</div> | ||
<p> | ||
where <code class="file docutils literal notranslate"><span class="pre">refs.bib</span></code> would contain an | ||
entry: | ||
</p> | ||
<div class="highlight-default notranslate"> | ||
<div class="highlight"> | ||
<pre><span></span><span class="nd">@Book</span><span class="p">{</span><span class="mi">1987</span><span class="p">:</span><span class="n">nelson</span><span class="p">,</span> | ||
<span class="n">author</span> <span class="o">=</span> <span class="p">{</span><span class="n">Edward</span> <span class="n">Nelson</span><span class="p">},</span> | ||
<span class="n">title</span> <span class="o">=</span> <span class="p">{</span><span class="n">Radically</span> <span class="n">Elementary</span> <span class="n">Probability</span> <span class="n">Theory</span><span class="p">},</span> | ||
<span class="n">publisher</span> <span class="o">=</span> <span class="p">{</span><span class="n">Princeton</span> <span class="n">University</span> <span class="n">Press</span><span class="p">},</span> | ||
<span class="n">year</span> <span class="o">=</span> <span class="p">{</span><span class="mi">1987</span><span class="p">}</span> | ||
<span class="p">}</span> | ||
</pre> | ||
</div> | ||
</div> | ||
<p>In the default style, this will get rendered as:</p> | ||
<p> | ||
See Nelson <a class="reference internal" href="http://project.readthedocs.io/en/latest/index.html#nel87a" id="id1"><span>[Nel87a]</span></a> for an introduction to | ||
non-standard analysis. | ||
Non-standard analysis is fun <a class="reference internal" href="http://project.readthedocs.io/en/latest/index.html#nel87a" id="id2"><span>[Nel87a]</span></a>.</p> | ||
<dl class="citation"> | ||
<dt class="label" id="nel87a"><span class="brackets">Nel87a</span><span class="fn-backref">(<a | ||
href="http://project.readthedocs.io/en/latest/index.html#id1">1</a>,<a href="http://project.readthedocs.io/en/latest/index.html#id2">2</a>)</span></dt> | ||
<dd> | ||
<p>Edward Nelson. <em>Radically Elementary Probability Theory</em>. Princeton University Press, 1987.</p> | ||
</dd> | ||
</dl> | ||
<p> | ||
Citations in sphinx are resolved globally across all documents. | ||
Typically, you have a single <a class="reference internal" href="http://project.readthedocs.io/en/latest/usage.html#directive-bibliography" | ||
title="bibliography directive"><code | ||
class="xref rst rst-dir docutils literal notranslate"><span class="pre">bibliography</span></code></a> | ||
directive across | ||
your entire project which collects all citations. | ||
Advanced use cases with multiple <a class="reference internal" href="http://project.readthedocs.io/en/latest/usage.html#directive-bibliography" | ||
title="bibliography directive"><code | ||
class="xref rst rst-dir docutils literal notranslate"><span class="pre">bibliography</span></code></a> | ||
directives | ||
across your project are also supported, but some care | ||
needs to be taken from your end to avoid duplicate citations. | ||
</p> | ||
<p> | ||
In contrast, footnotes in sphinx are resolved locally per document. | ||
To achieve local bibliographies per document, you can use citations | ||
represented by footnotes as follows: | ||
</p> | ||
<div class="highlight-rest notranslate"> | ||
<div class="highlight"> | ||
<pre><span></span>Non-standard analysis is lovely. <span class="na">:footcite:</span><span class="nv">`1987:nelson`</span> | ||
|
||
<span class="p">..</span> <span class="ow">footbibliography</span><span class="p">::</span> | ||
</pre> | ||
</div> | ||
</div> | ||
<p>which will get rendered as:</p> | ||
<p>Non-standard analysis is lovely. <a class="footnote-reference brackets" href="http://project.readthedocs.io/en/latest/index.html#nel87b" id="id3">1</a></p> | ||
<dl class="footnote brackets"> | ||
<dt class="label" id="nel87b"><span class="brackets"><a class="fn-backref" href="http://project.readthedocs.io/en/latest/index.html#id3">1</a></span></dt> | ||
<dd> | ||
<p>Edward Nelson. <em>Radically Elementary Probability Theory</em>. Princeton University Press, 1987.</p> | ||
</dd> | ||
</dl> | ||
<p> | ||
Typically, you have a single <a class="reference internal" href="http://project.readthedocs.io/en/latest/usage.html#directive-footbibliography" | ||
title="footbibliography directive"><code | ||
class="xref rst rst-dir docutils literal notranslate"><span class="pre">footbibliography</span></code></a> | ||
directive | ||
at the bottom of each document that has <a class="reference internal" href="http://project.readthedocs.io/en/latest/usage.html#role-footcite" | ||
title="footcite role"><code | ||
class="xref rst rst-role docutils literal notranslate"><span class="pre">footcite</span></code></a> citations. | ||
Advanced use cases with multiple <a class="reference internal" href="http://project.readthedocs.io/en/latest/usage.html#directive-footbibliography" | ||
title="footbibliography directive"><code | ||
class="xref rst rst-dir docutils literal notranslate"><span class="pre">footbibliography</span></code></a> | ||
directives per document are also supported. Since everything is local, | ||
there is no concern with duplicate citations when using footnotes. | ||
</p> | ||
</div> | ||
</div> |
21 changes: 21 additions & 0 deletions
21
readthedocs/embed/tests/data/sphinx/bibtex/page-installation.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<div class="section" id="installation"> | ||
<h2>Installation<a class="headerlink" href="http://project.readthedocs.io/en/latest/index.html#installation" title="Permalink to this headline">¶</a></h2> | ||
<p> | ||
Install the module with <code | ||
class="docutils literal notranslate"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">sphinxcontrib-bibtex</span></code>, | ||
or from source using <code | ||
class="docutils literal notranslate"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">install</span></code>. | ||
Then add: | ||
</p> | ||
<div class="highlight-python notranslate"> | ||
<div class="highlight"> | ||
<pre><span></span><span class="n">extensions</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'sphinxcontrib.bibtex'</span><span class="p">]</span> | ||
<span class="n">bibtex_bibfiles</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'refs.bib'</span><span class="p">]</span> | ||
</pre> | ||
</div> | ||
</div> | ||
<p> | ||
to your project’s Sphinx configuration file <code | ||
class="docutils literal notranslate"><span class="pre">conf.py</span></code>. | ||
</p> | ||
</div> |
98 changes: 98 additions & 0 deletions
98
readthedocs/embed/tests/data/sphinx/bibtex/page-minimal-example.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<div class="section" id="minimal-example"> | ||
<h2>Minimal Example<a class="headerlink" href="http://project.readthedocs.io/en/latest/index.html#minimal-example" title="Permalink to this headline">¶</a></h2> | ||
<p> | ||
In your project\u2019s documentation, you can use | ||
<code class="docutils literal notranslate"><span class="pre">:cite:t:</span></code> for textual citation | ||
references, | ||
<code class="docutils literal notranslate"><span class="pre">:cite:p:</span></code> for parenthetical citation | ||
references, and <code | ||
class="docutils literal notranslate"><span class="pre">..</span> <span class="pre">bibliography::</span></code> | ||
for inserting the bibliography. For <a class="reference external" | ||
href="https://github.com/mcmtroffaes/sphinxcontrib-bibtex/tree/develop/test/roots/test-debug_minimal_example">example</a>: | ||
</p> | ||
<div class="highlight-rest notranslate"> | ||
<div class="highlight"> | ||
<pre><span></span>See <span class="na">:cite:t:</span><span class="nv">`1987:nelson`</span> for an introduction to non-standard analysis. | ||
Non-standard analysis is fun <span class="na">:cite:p:</span><span class="nv">`1987:nelson`</span>. | ||
|
||
<span class="p">..</span> <span class="ow">bibliography</span><span class="p">::</span> | ||
</pre> | ||
</div> | ||
</div> | ||
<p> | ||
where <code class="file docutils literal notranslate"><span class="pre">refs.bib</span></code> would contain an | ||
entry: | ||
</p> | ||
<div class="highlight-default notranslate"> | ||
<div class="highlight"> | ||
<pre><span></span><span class="nd">@Book</span><span class="p">{</span><span class="mi">1987</span><span class="p">:</span><span class="n">nelson</span><span class="p">,</span> | ||
<span class="n">author</span> <span class="o">=</span> <span class="p">{</span><span class="n">Edward</span> <span class="n">Nelson</span><span class="p">},</span> | ||
<span class="n">title</span> <span class="o">=</span> <span class="p">{</span><span class="n">Radically</span> <span class="n">Elementary</span> <span class="n">Probability</span> <span class="n">Theory</span><span class="p">},</span> | ||
<span class="n">publisher</span> <span class="o">=</span> <span class="p">{</span><span class="n">Princeton</span> <span class="n">University</span> <span class="n">Press</span><span class="p">},</span> | ||
<span class="n">year</span> <span class="o">=</span> <span class="p">{</span><span class="mi">1987</span><span class="p">}</span> | ||
<span class="p">}</span> | ||
</pre> | ||
</div> | ||
</div> | ||
<p>In the default style, this will get rendered as:</p> | ||
<p> | ||
See Nelson <a class="reference internal" href="http://project.readthedocs.io/en/latest/index.html#nel87a" id="id1"><span>[Nel87a]</span></a> for an introduction to | ||
non-standard analysis. | ||
Non-standard analysis is fun <a class="reference internal" href="http://project.readthedocs.io/en/latest/index.html#nel87a" id="id2"><span>[Nel87a]</span></a>.</p> | ||
<dl class="citation"> | ||
<dt class="label" id="nel87a"><span class="brackets">Nel87a</span><span class="fn-backref">(<a | ||
href="http://project.readthedocs.io/en/latest/index.html#id1">1</a>,<a href="http://project.readthedocs.io/en/latest/index.html#id2">2</a>)</span></dt> | ||
<dd> | ||
<p>Edward Nelson. <em>Radically Elementary Probability Theory</em>. Princeton University Press, 1987.</p> | ||
</dd> | ||
</dl> | ||
<p> | ||
Citations in sphinx are resolved globally across all documents. | ||
Typically, you have a single <a class="reference internal" href="http://project.readthedocs.io/en/latest/usage.html#directive-bibliography" | ||
title="bibliography directive"><code | ||
class="xref rst rst-dir docutils literal notranslate"><span class="pre">bibliography</span></code></a> | ||
directive across | ||
your entire project which collects all citations. | ||
Advanced use cases with multiple <a class="reference internal" href="http://project.readthedocs.io/en/latest/usage.html#directive-bibliography" | ||
title="bibliography directive"><code | ||
class="xref rst rst-dir docutils literal notranslate"><span class="pre">bibliography</span></code></a> | ||
directives | ||
across your project are also supported, but some care | ||
needs to be taken from your end to avoid duplicate citations. | ||
</p> | ||
<p> | ||
In contrast, footnotes in sphinx are resolved locally per document. | ||
To achieve local bibliographies per document, you can use citations | ||
represented by footnotes as follows: | ||
</p> | ||
<div class="highlight-rest notranslate"> | ||
<div class="highlight"> | ||
<pre><span></span>Non-standard analysis is lovely. <span class="na">:footcite:</span><span class="nv">`1987:nelson`</span> | ||
|
||
<span class="p">..</span> <span class="ow">footbibliography</span><span class="p">::</span> | ||
</pre> | ||
</div> | ||
</div> | ||
<p>which will get rendered as:</p> | ||
<p>Non-standard analysis is lovely. <a class="footnote-reference brackets" href="http://project.readthedocs.io/en/latest/index.html#nel87b" id="id3">1</a></p> | ||
<dl class="footnote brackets"> | ||
<dt class="label" id="nel87b"><span class="brackets"><a class="fn-backref" href="http://project.readthedocs.io/en/latest/index.html#id3">1</a></span></dt> | ||
<dd> | ||
<p>Edward Nelson. <em>Radically Elementary Probability Theory</em>. Princeton University Press, 1987.</p> | ||
</dd> | ||
</dl> | ||
<p> | ||
Typically, you have a single <a class="reference internal" href="http://project.readthedocs.io/en/latest/usage.html#directive-footbibliography" | ||
title="footbibliography directive"><code | ||
class="xref rst rst-dir docutils literal notranslate"><span class="pre">footbibliography</span></code></a> | ||
directive | ||
at the bottom of each document that has <a class="reference internal" href="http://project.readthedocs.io/en/latest/usage.html#role-footcite" | ||
title="footcite role"><code | ||
class="xref rst rst-role docutils literal notranslate"><span class="pre">footcite</span></code></a> citations. | ||
Advanced use cases with multiple <a class="reference internal" href="http://project.readthedocs.io/en/latest/usage.html#directive-footbibliography" | ||
title="footbibliography directive"><code | ||
class="xref rst rst-dir docutils literal notranslate"><span class="pre">footbibliography</span></code></a> | ||
directives per document are also supported. Since everything is local, | ||
there is no concern with duplicate citations when using footnotes. | ||
</p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<dd> | ||
<p>Edward Nelson. <em>Radically Elementary Probability Theory</em>. Princeton University Press, 1987.</p> | ||
</dd> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<dl class="footnote brackets"> | ||
<dt class="label" id="nel87b"><span class="brackets"><a class="fn-backref" href="http://project.readthedocs.io/en/latest/index.html#id3">1</a></span></dt> | ||
<dd> | ||
<p>Edward Nelson. <em>Radically Elementary Probability Theory</em>. Princeton University Press, 1987.</p> | ||
</dd> | ||
</dl> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 needs to match the name from the "normal" api. I can rename the other one instead if we want.