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

Error with simple_footnotes when footnote contains markup #1022

Closed
Naereen opened this issue Apr 30, 2018 · 12 comments
Closed

Error with simple_footnotes when footnote contains markup #1022

Naereen opened this issue Apr 30, 2018 · 12 comments

Comments

@Naereen
Copy link
Contributor

Naereen commented Apr 30, 2018

In this line, None should not be returned.

For example, this example this text[ref]with a footnote with [a link](http://example.com)[/ref]will fail fails with the following (cryptic) message:

$ make html
...
CRITICAL: TypeError: sequence item 3: expected str instance, NoneType found
...
@Naereen
Copy link
Contributor Author

Naereen commented Apr 30, 2018

In practice, I simply commented this line return None in simple_footnotes.py, and everything works fine.

Naereen added a commit to Naereen/Objectif-Zero-Dechet-2018 that referenced this issue Apr 30, 2018
Naereen added a commit to Naereen/Objectif-Zero-Dechet-2018 that referenced this issue Apr 30, 2018
@Naereen
Copy link
Contributor Author

Naereen commented Jun 6, 2018

Nobody? @justinmayer?

@justinmayer
Copy link
Member

@Naereen: I've never used this plugin. Perhaps consider looking at its modification history and reaching out to folks who have contributed to it.

@Naereen
Copy link
Contributor Author

Naereen commented Jun 6, 2018

@justinmayer OK, sorry.

@linevych, @stuartlangridge, @mattvonrocketstein, @lindzey and @johnmarkschofield: could one of you please check this issue and the proposed changed (in my fork, but I can do the same change here).
Thanks in advance.

@johnmarkschofield
Copy link
Contributor

Can you fork the main repo and make a pull request with this change? Happy to look at it then, when the fix would help everyone.

Naereen added a commit to Naereen/pelican-plugins that referenced this issue Jun 11, 2018
@Naereen
Copy link
Contributor Author

Naereen commented Jun 11, 2018

Hi @johnmarkschofield, thanks for the reply. See #1036.
I don't know if there is automated tests for this extension or this repo.
But I tested the plugin on two blogs, and this tiny change never broke any of my [ref]...[/ref] footnote, while letting them use markup.

@kdeldycke
Copy link
Contributor

simple-footnotes plugin has been moved to its own repository at: https://github.com/pelican-plugins/simple-footnotes .

If the problem persist with the last version of this plugin, I propose to report it over there. Else, I guess we can close this issue.

@justinmayer
Copy link
Member

Hi @Naereen! Very sorry for the long delay in reviewing this. You wrote:

For example, this example this text[ref]with a footnote with [a link](http://example.com)[/ref]will fail fails with the following (cryptic) message […]

I added that text to a page and tested with Pelican 4.5.4 and Simple Footnotes 1.0.2, and I couldn't reproduce that error. If you can reproduce the problem reliably, please submit a PR to the Simple Footnotes repo with a test that fails on the current code, followed by a commit that makes that test pass. Thanks for understanding that we can't just merge changes without understanding how, where, and why the problem occurs! 😅

@Naereen
Copy link
Contributor Author

Naereen commented Jan 4, 2021

@kdeldycke @justinmayer hi, and thanks for your replies.
I'll try to reproduce my bug using the latest versions of Pelican and Simple Footnotes.
But it's likely still present, as the same line from the code I was using two years ago is still there:
https://github.com/pelican-plugins/simple-footnotes/blob/4bf0005eb7e1c3e887eb25e1c5b5f51722c05d3b/pelican/plugins/simple_footnotes/simple_footnotes.py#L20
I will let you know when I tried. (I have two tiny blogs using Pelican but I'm ashamed as I haven't updated either of them in the last months...)

@Naereen
Copy link
Contributor Author

Naereen commented Jan 4, 2021

Capture du 2021-01-04 19-38-28
Well I just tried, and now it works! See https://perso.crans.org/besson/cuisine/test-de-pelican.html#footnote on my blog.

Thanks!

@Naereen
Copy link
Contributor Author

Naereen commented Jan 4, 2021

Oh drat, I still have issues with my other blog... I'm trying to find the Markdown code that gives the issue, but the issue is the same as two years ago:

USING THIS return None
CRITICAL: sequence item 22: expected str instance, NoneType found

@Naereen
Copy link
Contributor Author

Naereen commented Jan 4, 2021

I haven't found any special Markdown markup that makes the simple-footnotes plugin fails, any foonote with a link inside made my blog failing (with most recent version of the plugin).
I changed the code of simple-footnotes.py like this:

-      L.append(getText(n))
+      L.append(getText(n, recursive=recursive))
 diff --git a/plugins/simple_footnotes/simple_footnotes.py b/plugins/simple_footnotes/simple_footnotes.py
 index dc3894f..40a5edc 100644
 --- a/plugins/simple_footnotes/simple_footnotes.py
 +++ b/plugins/simple_footnotes/simple_footnotes.py
 @@ -19,7 +19,7 @@ def getText(node, recursive=False):
          else:
              if not recursive:
                  return None
 -        L.append(getText(n))
 +        L.append(getText(n, recursive=recursive))
      return u"".join(L)

Naereen pushed a commit to Naereen/Objectif-Zero-Dechet-2018 that referenced this issue Jan 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants