How should I extend a WikiText MarkupLanguage? [message #60491] |
Tue, 21 October 2008 12:57  |
Eclipse User |
|
|
|
Greetings.
I'm trying to extend the MediaWikiLanguage to incorporate a few custom
tags of my own. I have sorted out that I need to add a
PatternBasedElement to the private static tokenSyntax field.
However, there is only one way to do this as I see it. In my subclass'
constructor, I add my new element to using the non-static
getReplacementTokenSyntax() method. In order to ensure that my element
isn't included multiple times to the static field (once for each time my
constructor is invoked), I have to first check that it isn't already
there. This seems a little excessive to me.
As a work around, I've changed the field from private to protected. I
figure that I'll change this to instead do the check and add approach.
I'd like for there to be an easier mechanism for extending this
MarkupLanguage subclass and, more generally, others. I realise that the
order in which these elements are added is significant which adds to the
challenge. I wonder if it might be a good idea to refactor the
initialization code out of the static block and into non-static methods
that can be overridden by subclasses. Ideally, the methods could factor
the elements into different groups (something like "specific elements"
and "more general elements").
Is there any particular reason why the tokenSyntax and
phraseModifierSyntax fields need to be static? Making them non-static
would permit greater flexibility with the instances (e.g. you could more
easily customize an instance).
Thoughts?
Thanks,
Wayne
|
|
|
|
|
|
Re: How should I extend a WikiText MarkupLanguage? [message #61163 is a reply to message #60867] |
Fri, 31 October 2008 13:29  |
Eclipse User |
|
|
|
That's done it.
Thanks,
Wayne
David Green wrote:
> Wayne,
>
> I was in there today and did the refactoring to make MediaWikiLanguage
> extensible. See
> org.eclipse.mylyn.wikitext.textile.core.BugzillaTextileLangu age for an
> example of how to extend a language. Extending MediaWikiLanguage should
> be very similar.
>
> Regards,
>
> David
>
> Wayne Beaton wrote:
>> Will do.
>>
>> Thanks,
>>
>> Wayne
>>
>> David Green wrote:
>>> Wayne,
>>>
>>>> I'm trying to extend the MediaWikiLanguage to incorporate a few
>>>> custom tags of my own.
>>>
>>> I'm glad to hear that you're interested in extending WikiText. As
>>> you've discovered MediaWikiLanguage is not designed for
>>> extensibility. We had the same problem before with TextileLanguage,
>>> which was refactored to better support extensibility as a result of
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=237120
>>>
>>> If you create an enhancement request at https://bugs.eclipse.org/bugs
>>> for MediaWikiLanguage supporting extensibility I'll refactor its
>>> initialization to make it possible to subclass.
>>>
>>> Best regards,
>>>
>>> David
>>>
|
|
|
|
Re: How should I extend a WikiText MarkupLanguage? [message #594470 is a reply to message #60516] |
Wed, 22 October 2008 09:23  |
Eclipse User |
|
|
|
Will do.
Thanks,
Wayne
David Green wrote:
> Wayne,
>
>> I'm trying to extend the MediaWikiLanguage to incorporate a few custom
>> tags of my own.
>
> I'm glad to hear that you're interested in extending WikiText. As
> you've discovered MediaWikiLanguage is not designed for extensibility.
> We had the same problem before with TextileLanguage, which was
> refactored to better support extensibility as a result of
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=237120
>
> If you create an enhancement request at https://bugs.eclipse.org/bugs
> for MediaWikiLanguage supporting extensibility I'll refactor its
> initialization to make it possible to subclass.
>
> Best regards,
>
> David
>
|
|
|
Re: How should I extend a WikiText MarkupLanguage? [message #594512 is a reply to message #60840] |
Mon, 27 October 2008 12:07  |
Eclipse User |
|
|
|
Wayne,
I was in there today and did the refactoring to make MediaWikiLanguage
extensible. See
org.eclipse.mylyn.wikitext.textile.core.BugzillaTextileLangu age for an
example of how to extend a language. Extending MediaWikiLanguage should
be very similar.
Regards,
David
Wayne Beaton wrote:
> Will do.
>
> Thanks,
>
> Wayne
>
> David Green wrote:
>> Wayne,
>>
>>> I'm trying to extend the MediaWikiLanguage to incorporate a few
>>> custom tags of my own.
>>
>> I'm glad to hear that you're interested in extending WikiText. As
>> you've discovered MediaWikiLanguage is not designed for
>> extensibility. We had the same problem before with TextileLanguage,
>> which was refactored to better support extensibility as a result of
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=237120
>>
>> If you create an enhancement request at https://bugs.eclipse.org/bugs
>> for MediaWikiLanguage supporting extensibility I'll refactor its
>> initialization to make it possible to subclass.
>>
>> Best regards,
>>
>> David
>>
|
|
|
Re: How should I extend a WikiText MarkupLanguage? [message #594599 is a reply to message #60867] |
Fri, 31 October 2008 13:29  |
Eclipse User |
|
|
|
That's done it.
Thanks,
Wayne
David Green wrote:
> Wayne,
>
> I was in there today and did the refactoring to make MediaWikiLanguage
> extensible. See
> org.eclipse.mylyn.wikitext.textile.core.BugzillaTextileLangu age for an
> example of how to extend a language. Extending MediaWikiLanguage should
> be very similar.
>
> Regards,
>
> David
>
> Wayne Beaton wrote:
>> Will do.
>>
>> Thanks,
>>
>> Wayne
>>
>> David Green wrote:
>>> Wayne,
>>>
>>>> I'm trying to extend the MediaWikiLanguage to incorporate a few
>>>> custom tags of my own.
>>>
>>> I'm glad to hear that you're interested in extending WikiText. As
>>> you've discovered MediaWikiLanguage is not designed for
>>> extensibility. We had the same problem before with TextileLanguage,
>>> which was refactored to better support extensibility as a result of
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=237120
>>>
>>> If you create an enhancement request at https://bugs.eclipse.org/bugs
>>> for MediaWikiLanguage supporting extensibility I'll refactor its
>>> initialization to make it possible to subclass.
>>>
>>> Best regards,
>>>
>>> David
>>>
|
|
|
Powered by
FUDForum. Page generated in 0.07746 seconds