Return a 2-tuple of (`prefix`, `expression_text`) built from `text` where the `expression_text` is prepared to be suitable for SPDX license identifier detection stripped from leading and trailing punctuations, normalized for spaces and separateed from an SPDX-License-Identifier `pre
(text)
| 341 | |
| 342 | |
| 343 | def prepare_text(text): |
| 344 | """ |
| 345 | Return a 2-tuple of (`prefix`, `expression_text`) built from `text` where |
| 346 | the `expression_text` is prepared to be suitable for SPDX license identifier |
| 347 | detection stripped from leading and trailing punctuations, normalized for |
| 348 | spaces and separateed from an SPDX-License-Identifier `prefix`. |
| 349 | """ |
| 350 | if is_markup_text(text): |
| 351 | text = demarkup_text(text) |
| 352 | |
| 353 | prefix, expression = split_spdx_lid(text) |
| 354 | prefix = prefix.strip() if prefix is not None else prefix |
| 355 | return prefix, clean_text(expression) |
| 356 | |
| 357 | |
| 358 | def clean_text(text): |