preprocessors
PRE-PROCESSORS.
Preprocessors work on source text before we start doing anything too complicated.
Classes
Preprocessor(markdown_instance=None)
Bases: Processor
Preprocessors are run after the text is broken into lines.
Each preprocessor implements a "run" method that takes a pointer to a list of lines of the document, modifies it as necessary and returns either the same pointer or a pointer to a new list.
Preprocessors must extend markdown.Preprocessor.
Source code in pyrevitlib/pyrevit/coreutils/markdown/util.py
Attributes
markdown = markdown_instance
instance-attribute
Functions
run(lines)
Main preprocessor task.
Each subclass of Preprocessor should override the run
method, which
takes the document as a list of strings split by newlines and returns
the (possibly modified) list of lines.
Source code in pyrevitlib/pyrevit/coreutils/markdown/preprocessors.py
NormalizeWhitespace(markdown_instance=None)
Bases: Preprocessor
Normalize whitespace for consistant parsing.
Source code in pyrevitlib/pyrevit/coreutils/markdown/util.py
Attributes
markdown = markdown_instance
instance-attribute
Functions
run(lines)
Source code in pyrevitlib/pyrevit/coreutils/markdown/preprocessors.py
HtmlBlockPreprocessor(markdown_instance=None)
Bases: Preprocessor
Remove html blocks from the text and store them for later retrieval.
Source code in pyrevitlib/pyrevit/coreutils/markdown/util.py
Attributes
markdown = markdown_instance
instance-attribute
right_tag_patterns = ['</%s>', '%s>']
class-attribute
instance-attribute
attrs_pattern = '\n \\s+(?P<attr>[^>"\'/= ]+)=(?P<q>[\'"])(?P<value>.*?)(?P=q) # attr="value"\n | # OR\n \\s+(?P<attr1>[^>"\'/= ]+)=(?P<value1>[^> ]+) # attr=value\n | # OR\n \\s+(?P<attr2>[^>"\'/= ]+) # attr\n '
class-attribute
instance-attribute
left_tag_pattern = '^\\<(?P<tag>[^> ]+)(?P<attrs>(%s)*)\\s*\\/?\\>?' % attrs_pattern
class-attribute
instance-attribute
attrs_re = re.compile(attrs_pattern, re.VERBOSE)
class-attribute
instance-attribute
left_tag_re = re.compile(left_tag_pattern, re.VERBOSE)
class-attribute
instance-attribute
markdown_in_raw = False
class-attribute
instance-attribute
Functions
run(lines)
Source code in pyrevitlib/pyrevit/coreutils/markdown/preprocessors.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
|
ReferencePreprocessor(markdown_instance=None)
Bases: Preprocessor
Remove reference definitions from text and store for later use.
Source code in pyrevitlib/pyrevit/coreutils/markdown/util.py
Attributes
markdown = markdown_instance
instance-attribute
TITLE = '[ ]*(\\"(.*)\\"|\\\'(.*)\\\'|\\((.*)\\))[ ]*'
class-attribute
instance-attribute
RE = re.compile('^[ ]{0,3}\\[([^\\]]*)\\]:\\s*([^ ]*)[ ]*(%s)?$' % TITLE, re.DOTALL)
class-attribute
instance-attribute
TITLE_RE = re.compile('^%s$' % TITLE)
class-attribute
instance-attribute
Functions
run(lines)
Source code in pyrevitlib/pyrevit/coreutils/markdown/preprocessors.py
Functions
build_preprocessors(md_instance, **kwargs)
Build the default set of preprocessors used by Markdown.