2
2
3
3
# Copyright (c) 2022 Manuel Schneider
4
4
5
- import os
6
5
import re
7
6
import unicodedata
7
+ from pathlib import Path
8
+ from pylatexenc .latex2text import LatexNodes2Text
8
9
9
10
from albert import *
10
- from pylatexenc .latex2text import LatexNodes2Text
11
11
12
- md_iid = '1 .0'
13
- md_version = "1.1 "
12
+ md_iid = '2 .0'
13
+ md_version = "1.2 "
14
14
md_name = "TeX to Unicode"
15
15
md_description = "Convert TeX mathmode commands to unicode characters"
16
16
md_license = "GPL-3.0"
19
19
md_maintainers = "@DenverCoder1"
20
20
21
21
22
- class Plugin (TriggerQueryHandler ):
23
- def id (self ) -> str :
24
- return md_id
25
-
26
- def name (self ) -> str :
27
- return md_name
28
-
29
- def description (self ) -> str :
30
- return md_description
31
-
32
- def defaultTrigger (self ) -> str :
33
- return "tex "
34
-
35
- def synopsis (self ) -> str :
36
- return "<tex input>"
22
+ class Plugin (PluginInstance , TriggerQueryHandler ):
37
23
38
- def initialize (self ) -> None :
24
+ def __init__ (self ):
25
+ TriggerQueryHandler .__init__ (self ,
26
+ id = md_id ,
27
+ name = md_name ,
28
+ description = md_description ,
29
+ synopsis = '<tex input>' ,
30
+ defaultTrigger = 'tex ' )
31
+ PluginInstance .__init__ (self , extensions = [self ])
39
32
self .COMBINING_LONG_SOLIDUS_OVERLAY = "\u0338 "
40
- self .icon = [os . path . dirname (__file__ ) + " /tex.png" ]
33
+ self .iconUrls = [f"file: { Path (__file__ ). parent } /tex.png" ]
41
34
42
35
def _create_item (self , text : str , subtext : str , can_copy : bool ) -> Item :
43
36
actions = []
@@ -49,11 +42,11 @@ def _create_item(self, text: str, subtext: str, can_copy: bool) -> Item:
49
42
lambda t = text : setClipboardText (t ),
50
43
)
51
44
)
52
- return Item (
45
+ return StandardItem (
53
46
id = md_id ,
54
- icon = self .icon ,
55
47
text = text ,
56
48
subtext = subtext ,
49
+ iconUrls = self .iconUrls ,
57
50
actions = actions ,
58
51
)
59
52
0 commit comments