Re: Migration docutils 0.12 to 0.13
Guenter Milde <[email protected]>
| Newsgroups | gmane.text.docutils.user |
|---|---|
| Message-ID | <[email protected]> |
Dear David,
On 2017-01-02, David Goodger wrote:
> Patch attached.
>> You didn't do anything wrong that I can see. There was an internal
>> change to Docutils in revision 7942 that refactored some code, and a
>> side effect was to remove some attributes from the Inliner class (they
>> became locals instead). Your code depends on these class attributes.
>> Try applying the attached patch and let us know how it works. The
>> missing class attributes will be present as instance attributes, which
>> should be close enough.
>> Günter, I think the attached patch should also be rolled into a 0.13.2
>> bugfix release.
Is the patch still "on the table"?
Also with this patch, the attributes `start_string_prefix`,
`end_string_suffix`, and `parts` are only available after calling
``inliner.init_customizations(document.settings)``.
Is there a use-case for this scenario we want to support?
If not, we could define them as internal auxiliary variables after
the API change that came with implementation of [ 103 ].
That said, I am not against the patch. If including, I just propose a small
correction:
> Index: docutils/parsers/rst/states.py
>===================================================================
> --- docutils/parsers/rst/states.py (revision 8008)
> +++ docutils/parsers/rst/states.py (working copy)
> @@ -479,11 +479,13 @@
> (punctuation_chars.closing_delimiters,
> punctuation_chars.delimiters,
> punctuation_chars.closers))
> + self.start_string_prefix = start_string_prefix
> + self.end_string_suffix = end_string_suffix
> args = locals().copy()
> args.update(vars(self.__class__))
> - parts = ('initial_inline', start_string_prefix, '',
> + parts = ('initial_inline', self.start_string_prefix, '',
No need to call the instance variable here, as we set it just some lines
above (overwriting an eventually existing instance).
> [('start', '', self.non_whitespace_after, # simple start-strings
> [r'\*\*', # strong
> r'\*(?!\*)', # emphasis but not strong
> @@ -509,6 +511,7 @@
> )
> ]
> )
> + self.parts = parts
> self.patterns = Struct(
> initial=build_regexp(parts),
Thanks,
Günter
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/docutils-users
Please use "Reply All" to reply to the list.