|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2017 - 2022 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the base class for the markup providers. |
|
8 """ |
|
9 |
|
10 |
|
11 class MarkupBase: |
|
12 """ |
|
13 Class implementing the base class for the markup providers. |
|
14 |
|
15 Note: Derived classes need only implement those method they provide |
|
16 functionality for. This base class implements do nothing variants for |
|
17 all methods. |
|
18 """ |
|
19 def __init__(self): |
|
20 """ |
|
21 Constructor |
|
22 """ |
|
23 pass |
|
24 |
|
25 def kind(self): |
|
26 """ |
|
27 Public method to get the markup kind. |
|
28 |
|
29 @return markup kind all lowercased |
|
30 @rtype str |
|
31 """ |
|
32 return "none" |
|
33 |
|
34 def hasBold(self): |
|
35 """ |
|
36 Public method to indicate the availability of bold markup. |
|
37 |
|
38 @return flag indicating the availability of bold markup |
|
39 @rtype bool |
|
40 """ |
|
41 return False |
|
42 |
|
43 def bold(self, editor): |
|
44 """ |
|
45 Public method to generate bold text. |
|
46 |
|
47 @param editor reference to the editor to work on |
|
48 @type Editor |
|
49 """ |
|
50 pass |
|
51 |
|
52 def hasItalic(self): |
|
53 """ |
|
54 Public method to indicate the availability of italic markup. |
|
55 |
|
56 @return flag indicating the availability of italic markup |
|
57 @rtype bool |
|
58 """ |
|
59 return False |
|
60 |
|
61 def italic(self, editor): |
|
62 """ |
|
63 Public method to generate italic text. |
|
64 |
|
65 @param editor reference to the editor to work on |
|
66 @type Editor |
|
67 """ |
|
68 pass |
|
69 |
|
70 def hasStrikethrough(self): |
|
71 """ |
|
72 Public method to indicate the availability of strikethrough markup. |
|
73 |
|
74 @return flag indicating the availability of strikethrough markup |
|
75 @rtype bool |
|
76 """ |
|
77 return False |
|
78 |
|
79 def strikethrough(self, editor): |
|
80 """ |
|
81 Public method to generate strikethrough text. |
|
82 |
|
83 @param editor reference to the editor to work on |
|
84 @type Editor |
|
85 """ |
|
86 pass |
|
87 |
|
88 def headerLevels(self): |
|
89 """ |
|
90 Public method to determine the available header levels. |
|
91 |
|
92 @return supported header levels |
|
93 @rtype int |
|
94 """ |
|
95 return 0 |
|
96 |
|
97 def header(self, editor, level): |
|
98 """ |
|
99 Public method to generate a header. |
|
100 |
|
101 @param editor reference to the editor to work on |
|
102 @type Editor |
|
103 @param level header level |
|
104 @type int |
|
105 """ |
|
106 pass |
|
107 |
|
108 def hasCode(self): |
|
109 """ |
|
110 Public method to indicate the availability of inline code markup. |
|
111 |
|
112 @return flag indicating the availability of inline code markup |
|
113 @rtype bool |
|
114 """ |
|
115 return False |
|
116 |
|
117 def code(self, editor): |
|
118 """ |
|
119 Public method to generate inline code text. |
|
120 |
|
121 @param editor reference to the editor to work on |
|
122 @type Editor |
|
123 """ |
|
124 pass |
|
125 |
|
126 def hasCodeBlock(self): |
|
127 """ |
|
128 Public method to indicate the availability of code block markup. |
|
129 |
|
130 @return flag indicating the availability of code block markup |
|
131 @rtype bool |
|
132 """ |
|
133 return False |
|
134 |
|
135 def codeBlock(self, editor): |
|
136 """ |
|
137 Public method to generate code block text. |
|
138 |
|
139 @param editor reference to the editor to work on |
|
140 @type Editor |
|
141 """ |
|
142 pass |
|
143 |
|
144 def hasHyperlink(self): |
|
145 """ |
|
146 Public method to indicate the availability of hyperlink markup. |
|
147 |
|
148 @return flag indicating the availability of hyperlink markup |
|
149 @rtype bool |
|
150 """ |
|
151 return False |
|
152 |
|
153 def hyperlink(self, editor): |
|
154 """ |
|
155 Public method to generate hyperlink text. |
|
156 |
|
157 @param editor reference to the editor to work on |
|
158 @type Editor |
|
159 """ |
|
160 pass |
|
161 |
|
162 def hasLine(self): |
|
163 """ |
|
164 Public method to indicate the availability of a horizontal line markup. |
|
165 |
|
166 @return flag indicating the availability of a horizontal line markup |
|
167 @rtype bool |
|
168 """ |
|
169 return False |
|
170 |
|
171 def line(self, editor): |
|
172 """ |
|
173 Public method to generate a horizontal line text. |
|
174 |
|
175 @param editor reference to the editor to work on |
|
176 @type Editor |
|
177 """ |
|
178 pass |
|
179 |
|
180 def hasQuote(self): |
|
181 """ |
|
182 Public method to indicate the availability of block quote markup. |
|
183 |
|
184 @return flag indicating the availability of block quote markup |
|
185 @rtype bool |
|
186 """ |
|
187 return False |
|
188 |
|
189 def quote(self, editor): |
|
190 """ |
|
191 Public method to generate block quote text. |
|
192 |
|
193 @param editor reference to the editor to work on |
|
194 @type Editor |
|
195 """ |
|
196 pass |
|
197 |
|
198 def hasImage(self): |
|
199 """ |
|
200 Public method to indicate the availability of image markup. |
|
201 |
|
202 @return flag indicating the availability of image markup |
|
203 @rtype bool |
|
204 """ |
|
205 return False |
|
206 |
|
207 def image(self, editor): |
|
208 """ |
|
209 Public method to generate image text. |
|
210 |
|
211 @param editor reference to the editor to work on |
|
212 @type Editor |
|
213 """ |
|
214 pass |
|
215 |
|
216 def hasBulletedList(self): |
|
217 """ |
|
218 Public method to indicate the availability of bulleted list markup. |
|
219 |
|
220 @return flag indicating the availability of bulleted list markup |
|
221 @rtype bool |
|
222 """ |
|
223 return False |
|
224 |
|
225 def bulletedList(self, editor): |
|
226 """ |
|
227 Public method to generate bulleted list text. |
|
228 |
|
229 @param editor reference to the editor to work on |
|
230 @type Editor |
|
231 """ |
|
232 pass |
|
233 |
|
234 def hasNumberedList(self): |
|
235 """ |
|
236 Public method to indicate the availability of numbered list markup. |
|
237 |
|
238 @return flag indicating the availability of numbered list markup |
|
239 @rtype bool |
|
240 """ |
|
241 return False |
|
242 |
|
243 def numberedList(self, editor): |
|
244 """ |
|
245 Public method to generate numbered list text. |
|
246 |
|
247 @param editor reference to the editor to work on |
|
248 @type Editor |
|
249 """ |
|
250 pass |