{"action":"closed","issue":{"url":"https://api.github.com/repos/getnikola/nikola/issues/2963","repository_url":"https://api.github.com/repos/getnikola/nikola","labels_url":"https://api.github.com/repos/getnikola/nikola/issues/2963/labels{/name}","comments_url":"https://api.github.com/repos/getnikola/nikola/issues/2963/comments","events_url":"https://api.github.com/repos/getnikola/nikola/issues/2963/events","html_url":"https://github.com/getnikola/nikola/issues/2963","id":297443802,"number":2963,"title":"Get current page name from path handler","user":{"login":"paternal","id":6587757,"avatar_url":"https://avatars0.githubusercontent.com/u/6587757?v=4","gravatar_id":"","url":"https://api.github.com/users/paternal","html_url":"https://github.com/paternal","followers_url":"https://api.github.com/users/paternal/followers","following_url":"https://api.github.com/users/paternal/following{/other_user}","gists_url":"https://api.github.com/users/paternal/gists{/gist_id}","starred_url":"https://api.github.com/users/paternal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paternal/subscriptions","organizations_url":"https://api.github.com/users/paternal/orgs","repos_url":"https://api.github.com/users/paternal/repos","events_url":"https://api.github.com/users/paternal/events{/privacy}","received_events_url":"https://api.github.com/users/paternal/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-02-15T13:23:03Z","updated_at":"2018-02-15T19:49:58Z","closed_at":"2018-02-15T19:49:57Z","author_association":"NONE","body":"### Environment (if reporting a bug)\r\n\r\n**Python Version:** Python 3.6.4\r\n\r\n**Nikola Version:** 7.8.11\r\n\r\n**Operating System:** Debian testing\r\n\r\n### Description:\r\n                                                                        \r\nI am trying to write a plugin implementing a new `link://` handler, and I would like it to be relative to the page it appears in (e.g. `link://foo/helloworld` in page `bar` would not return the same URL as the same link in page `baz`). But I cannot achieve to get the current page in the `foo_path` method. Is this possible?\r\n\r\n### MWE\r\n\r\nFile `foo.plugin`:\r\n\r\n~~~\r\n[Core]\r\nName = foo\r\nModule = foo\r\n~~~\r\n\r\nFile `foo.py`:\r\n\r\n~~~py\r\n#!/usr/bin/env python\r\n\r\nimport os\r\n\r\nfrom nikola.plugin_categories import Task\r\nfrom nikola import utils\r\n\r\nclass Foo(Task):\r\n\r\n    name = \"foo\"\r\n\r\n    def set_site(self, site):\r\n        \"\"\"Set Nikola site.\"\"\"\r\n        site.register_path_handler('foo', self.foo_path)\r\n        return super(Foo, self).set_site(site)\r\n\r\n    def foo_path(self, name, lang):\r\n        # Here, I would like to get the current page name/path/URL.\r\n        return [\"FOO\"]\r\n\r\n    def gen_tasks(self):\r\n        yield self.group_task()\r\n~~~\r\n\r\n-- Louis"}}
{"actor":{"display_login":"paternal"}}