Hey everyone,
since we have introduced ourselves, we have been quite busy reading documentation and source code (of existing extensions) trying to understand the dataflow within Mediawiki.
Today we have committed our first code that demonstrates how we plan to integrate the code of our alpha version of the mooc interface to a stand alone extension.
Your early feedback is crucial for us and thus highly appreciated. Since from now on we would start to code up functionality
https://phabricator.wikimedia.org/diffusion/1892/browse/develop/
We have started with the cookiecutter template for the media wiki extensions.
In MOOC.hooks.php we first register a parser hook looking for {{#MOOC: }}. Once the registered function is called we register another HOOK id est OutputPageBeforeHTML on which we use the $text variable to modify the html. in our example case we use a DomParser to manipulate the css attribute of h2 and plan to adapt other css in this way for the future development.
We use the resource loader to include our own stylesheet.
Questions:
0.) Could anyone quickly review our code and give us feedback weather we understood the basic data flow correctly and are using the correct workflows?
1.) is there any argument against using bootstrap or less for more efficient css hacking?
2.) How stable is the HTML syntax of wikipages? Wikitext will probably not change in future mediawikiversions. can we rely on the fact that the HTML structure also won't change? If we introduce our own css classes should they also start with mw- oder should we just provide our own prefix e.g. mooc- ...
3.) is there a better Hook that OutputPageBeforeHTML that we should use for our usecase?
4.) We need meta information from other articles where is the best way to include database requests?
Thank you very much!
best regards Sebastian and Rene
Hi, you should also attend the upcoming code review hours. More info: https://phabricator.wikimedia.org/E179 ;)
On Wed, May 11, 2016 at 8:07 AM, René Pickhardt r.pickhardt@googlemail.com wrote:
Hey everyone,
since we have introduced ourselves, we have been quite busy reading documentation and source code (of existing extensions) trying to understand the dataflow within Mediawiki.
Today we have committed our first code that demonstrates how we plan to integrate the code of our alpha version of the mooc interface to a stand alone extension.
Your early feedback is crucial for us and thus highly appreciated. Since from now on we would start to code up functionality
https://phabricator.wikimedia.org/diffusion/1892/browse/develop/
We have started with the cookiecutter template for the media wiki extensions.
In MOOC.hooks.php we first register a parser hook looking for {{#MOOC: }}. Once the registered function is called we register another HOOK id est OutputPageBeforeHTML on which we use the $text variable to modify the html. in our example case we use a DomParser to manipulate the css attribute of h2 and plan to adapt other css in this way for the future development.
We use the resource loader to include our own stylesheet.
Questions:
0.) Could anyone quickly review our code and give us feedback weather we understood the basic data flow correctly and are using the correct workflows?
1.) is there any argument against using bootstrap or less for more efficient css hacking?
2.) How stable is the HTML syntax of wikipages? Wikitext will probably not change in future mediawikiversions. can we rely on the fact that the HTML structure also won't change? If we introduce our own css classes should they also start with mw- oder should we just provide our own prefix e.g. mooc- ...
3.) is there a better Hook that OutputPageBeforeHTML that we should use for our usecase?
4.) We need meta information from other articles where is the best way to include database requests?
Thank you very much!
best regards Sebastian and Rene
--
www.rene-pickhardt.de http://www.beijing-china-blog.com/
Skype: rene.pickhardt
mobile: +49 (0)176 5762 3618 office: +49 (0) 261 / 287 2765 fax: +49 (0) 261 / 287 100 2765 _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On Wednesday, May 11, 2016, René Pickhardt r.pickhardt@googlemail.com wrote:
Hey everyone,
since we have introduced ourselves, we have been quite busy reading documentation and source code (of existing extensions) trying to
understand
the dataflow within Mediawiki.
Today we have committed our first code that demonstrates how we plan to integrate the code of our alpha version of the mooc interface to a stand alone extension.
Your early feedback is crucial for us and thus highly appreciated. Since from now on we would start to code up functionality
https://phabricator.wikimedia.org/diffusion/1892/browse/develop/
We have started with the cookiecutter template for the media wiki extensions.
In MOOC.hooks.php we first register a parser hook looking for {{#MOOC: }}. Once the registered function is called we register another HOOK id est OutputPageBeforeHTML on which we use the $text variable to modify the
html.
in our example case we use a DomParser to manipulate the css attribute of h2 and plan to adapt other css in this way for the future development.
We use the resource loader to include our own stylesheet.
Questions:
0.) Could anyone quickly review our code and give us feedback weather we understood the basic data flow correctly and are using the correct workflows?
Your doing better with the data flow then a lot of people do when first introduced to mw.
I cant figure out how to review stuff on phab, so ill just comment here.
*in parseMooc() :dont register hooks during runtime. You should register hooks in extension.json unless you have very special requirements * in renderMoocPage(): Do not use wgTitle, ever - its deprecated and sometimes has incorrect value. In this case you should use $out->getTitle() * do not use string comparison to determine namespace. This will break on non english wikis. Use the title->inNamespace() or getNamespace(), and the numeric ns constants like NS_USER.
1.) is there any argument against using bootstrap or less for more efficient css hacking?
Less is commonly used in mediawiki and is directly supported by RL. Im not a frontend person and dont know enough to comment on bootstrap
2.) How stable is the HTML syntax of wikipages? Wikitext will probably not change in future mediawikiversions. can we rely on the fact that the HTML structure also won't change? If we introduce our own css classes should they also start with mw- oder should we just provide our own prefix e.g. mooc- ...
You should not rely on the html structure being the same. It probably wont change (unless parsoid reigns supreme one day) but you shouldnt rely on that as it makes for very fragile code.
For your own css classes - feel free to do either - the prefix is just to avoid clashes with user chosen classes.
Im not sure what your actually doing, but i strongly advise against modifying the html after its generated. In what you have so far, it seems very unnessary as you can just add css to only the pages you want, and its already possible to select headers without the new class, but im not sure what your long term vission is here. If you want to create a custom type of page, maybe look into content handler (see for example the campaign namespace on commoms, or the mass message extension)
3.) is there a better Hook that OutputPageBeforeHTML that we should use
for
our usecase?
4.) We need meta information from other articles where is the best way to include database requests?
I sort of need more context for where you are displaying this metadata/which metadata, but for getting it see the Revision class.
Thank you very much!
best regards Sebastian and Rene
--
www.rene-pickhardt.de http://www.beijing-china-blog.com/
Skype: rene.pickhardt
mobile: +49 (0)176 5762 3618 office: +49 (0) 261 / 287 2765 fax: +49 (0) 261 / 287 100 2765 _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
wikitech-l@lists.wikimedia.org