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

Deprecation warning: Call to deprecated function (or staticmethod) meta #16

Open
franktisellano opened this issue Dec 6, 2023 · 2 comments

Comments

@franktisellano
Copy link

Getting the following warning:

lektor_markdown_header_anchors.py:22: DeprecationWarning: Call to deprecated function (or staticmethod) meta. (Use ImprovedRenderer.lektor.meta instead.)
  renderer.meta['toc'].append((level, anchor, Markup(text)))

Mostly posting this as an FYI. I'm planning on submitting a PR with a fix soon.

@dairiki
Copy link
Contributor

dairiki commented Dec 6, 2023

FWIW, I think (due to a bug in Lektor? — I don't understand why, at this point [eta: I've figured it out; see next comment]) the warning is being attributed to the wrong line. I think the warning should reference line 61, where the ImprovedRenderer.meta property is accessed:

class RendererMixin_mistune0(object):
def header(self, text, level, raw):
return render_header(text, level, self.meta)


Changing RendererMixin_mistune0 so that it accesses meta the same way as RendererMixin_mistune2 should (untested) eliminate the warning.

class RendererMixin_mistune2(object):
def heading(self, text, level):
meta = self.lektor.meta # Lektor >= 3.4
return render_header(text, level, meta)

@dairiki
Copy link
Contributor

dairiki commented Dec 6, 2023

It turns out that the reported line number issue is due to differences between the master branch and the latest release
(0.3.1...master) of lektor_markdown_header_anchors.

If possible, try running the version from git master and see if you still get the deprecation warning.

(I don't have the permissions necessary to be able to publish a new release to PyPI. I'm not completely sure who does. Maybe @nixjdm?)

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

2 participants