/
plugin.py
38 lines (30 loc) · 904 Bytes
/
plugin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from ...plugin import Plugin
from ... import helpers
class BrandPlugin(Plugin):
identity = "brand"
priority = 80
validity = {
"type": "object",
"properties": {
"text": {"type": "string"},
},
}
# Context
@property
def path(self):
return helpers.get_url_relpath(".", self.document.path)
@property
def text(self):
site = self.document.get_plugin("site")
return self.config.get("text", site.title)
@property
def title_extra(self):
site = self.document.get_plugin("site")
if self.text != site.title:
return f" | {self.text}"
# Process
def process_markup(self, markup):
markup.add_style("style.css")
markup.add_markup("markup.html", target="#livemark-left")
if self.title_extra:
markup.query("title").append(self.title_extra)