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

Misplaced <div> in viewcode html output since Sphinx 1.7.0 #4701

Closed
jfbu opened this issue Mar 2, 2018 · 2 comments
Closed

Misplaced <div> in viewcode html output since Sphinx 1.7.0 #4701

jfbu opened this issue Mar 2, 2018 · 2 comments

Comments

@jfbu
Copy link
Contributor

jfbu commented Mar 2, 2018

Image shows it:

capture d ecran 2018-03-02 a 15 13 27

there is an extra line above the final one of the procedure, and the html source (in _build/html/_modules/foo.html) looks like this

<div class="viewcode-block" id="pgcd"><a class="viewcode-back" href="../index.html#foo.pgcd">[docs]</a><span class="k">def</span> <span class="nf">pgcd</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;Calcule le PGCD par l&#39;algorithme d&#39;Euclide.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="nb">abs</span><span class="p">(</span><span class="n">a</span><span class="p">),</span> <span class="nb">abs</span><span class="p">(</span><span class="n">b</span><span class="p">)</span>
    <span class="k">while</span> <span class="n">b</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
        <span class="n">a</span><span class="p">,</span> <span class="n">b</span> <span class="o">=</span> <span class="n">b</span><span class="p">,</span> <span class="n">a</span> <span class="o">%</span> <span class="n">b</span></div>
    <span class="k">return</span> <span class="n">a</span>

the closing </div> is mis-placed (not at end of last line but at end of previous one).

This does not happen with Sphinx 1.6.6 but happens with Sphinx 1.7.0 and 1.7.1

I am attaching
misplaceddiv.zip
which one needs to compile with make html.

Environment info

  • OS: Mac
  • Running Sphinx v1.8.0+
  • Sphinx version: 1.8.0+
  • Python version: 3.6.4 (CPython)
  • Docutils version: 0.14
  • Jinja2 version: 2.10

Also tested with 1.7.0 and 1.7.1. No problem with 1.6.6

@jfbu
Copy link
Contributor Author

jfbu commented Mar 2, 2018

First bad commit appears to be 8683823 (PR #3937)

tk0miya added a commit to tk0miya/sphinx that referenced this issue Mar 5, 2018
tk0miya added a commit that referenced this issue Mar 7, 2018
Fix #4701: viewcode: Misplaced ``<div>`` in viewcode html output
@tk0miya
Copy link
Member

tk0miya commented Mar 7, 2018

Fixed by #4709

@tk0miya tk0miya closed this as completed Mar 7, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants