Debian Codegraph @

extensions/Math/CONTRIBUTING.MD

raw
1 # Contributing
2
3 > READ: [Documentation](https://www.mediawiki.org/wiki/Extension:Math)
4
5 These steps outline the development process for the MediaWiki Math extension.
6
7 The Math extension manages the rendering of mathematical expressions in wikis such as Wikipedia or private MediaWiki installations.
8
9 The wikitext tag math (e.g.,
10 `<math display=block>E=mc^2</math>`) specifies mathematical expressions in the LaTeX dialect
11 [texvc.](https://github.com/wikimedia/texvcjs/blob/master/lib/parser.pegjs)
12 The most recent version of the Math extension converts these tags to mathematical expressions that can be
13 displayed by most browsers using
14 [mathoid](https://gitlab.wikimedia.org/repos/mediawiki/services/mathoid).
15
16 ## Workflow overview
17
18 The workflow for changing math-related aspects is the following.
19
20 1. Create a ticket and describe the problem.
21 (What is "broken"?
22 What should be improved?
23 Who is suffering from the current situation?
24 Who would benefit from the improvement?)
25 2. (Optional) Propose a solution. (Create a mock for a solution. Estimate the effort.)
26 3. Get Feedback from the community
27 4. Get familiar with the codebase, and the environment to plan testing and implementation
28 5. Implement changes, considering dependencies
29 6. Get code review
30 7. Wait for a merge
31 8. Enable the feature in on the [beta cluster](https://www.mediawiki.org/wiki/Beta_Cluster).
32 9. Enable the feature in production (appropriate communities)
33
34
35 Note that for rendering math the following dependent software packages are required
36 * texvcjs
37 * texvcinfo (depends on texvcjs)
38 * mathjax
39 * mathjax-node (depends on mathjax)
40 * mathoid (depends on mathjax-node, texvcinfo)
41 * restbase (depends on mathoid)
42 * Math extension (depends on either restbase, or [mathoid and a database])
43 * (MathSearch extension depends on Extension math)
44 ### Step 1 (Ticket creation)
45
46 > READ: [How to report a bug](https://www.mediawiki.org/wiki/How_to_report_a_bug)
47
48 Math specific points:
49 * If possible, please make a screenshot.
50 * Create a LaTeX/PDF file to demonstrate what you expect.
51
52 Running examples:
53 1. Have [numbered formulae](https://phabricator.wikimedia.org/T7600).
54 2. Support for [uppercase greek letters](https://phabricator.wikimedia.org/T218295).
55 3. Deprecate [non-standard texvc commands](https://phabricator.wikimedia.org/T197842).
56
57 ### Step 2 (Define success criteria)
58
59 Describe the idea of how to solve the problem.
60
61 * Are there examples / external software that has solved the problem?
62 * Consider drawing a mock (screenshot).
63 * Consider technical and security restrictions
64
65 Examples:
66 1. Numbered equations are challenging since the math extension is not aware of the context. A solution could be to use [CSS counters](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Lists_and_Counters/Using_CSS_counters).
67 2. Whitelist the appropriate LaTeX commands in the texvc grammar.
68 3. Show a warning if any of the non-standard commands are used.
69
70 ### Step 3 (Obtain commuinity consenus)
71
72 Send an email to the [math community group](https://meta.wikimedia.org/wiki/Wikimedia_Community_User_Group_Math) with your request grant at least two weeks for the community to reply.
73
74 Examples:
75 1. not yet done (Updated 2019-Nov-14) (not a good example)
76 2. See http://openmath.org/pipermail/wiki-l/2019-August/000000.html
77 3. fixed before the community wishlist was established (not a good example).
78
79 ### Step 4 (Become a developer)
80 > NOTE: You'll need [Gerrit access](https://www.mediawiki.org/wiki/Developer_access) to contribute code to this repository.
81
82 Get familiar with the code and figure out where you need to add your changes and how you could test them.
83
84 Understand the current code and see which components have to be changed in which order.
85
86 Examples:
87 1. Possible tests: PHPUnit tests that check if the CSS attribute is present. Selenium tests that check if numbers are rendered. Find the Math extension code position that outputs HTML and find the CSS styles shipped with math. Understand how the math extension handles options. Understand PHPUnit and Selenium tests.
88 2. Define test cases in MediaWiki, mathoid, and texvcjs. Implement node module texvcjs in and release to the npm bump version number of texvcinfo and implement changes in mathoid.
89 3. Set up a bot to replace the old command. Add pseudo latex package to discover formulae that contain deprecated macros. Implement changes in texvcjs, texvcinfo, mathoid, and the math extension.
90
91 ### Step 5
92
93 * Take your time implementing tests and components.
94 * Make sure to consider [best practices for MediaWiki extensions.](https://www.mediawiki.org/wiki/Best_practices_for_extensions)
95
96 Examples:
97 1. Not yet implemented
98 2. [Step 1: Grammar changes](https://github.com/wikimedia/texvcjs/commit/5b2ce833481616ffcd10502422f7b828a48043f9#diff-84bc28ec886369e8d279d3c006b1134d)
99 3. [Step 1: Remove commands from the visual editor](https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/Math/+/440737/)
100
101 ### Step 6
102 * Plan time for code review
103 * React to each point that reviewers point you to
104 * Do not self merge your changes
105 * Be prepared for multiple iterations
106
107 Examples:
108 1. Not done yet
109 2. Feedback on [Version bump](https://github.com/wikimedia/texvcjs/pull/33#issuecomment-531713364) for grammar change to allow for NPM release.
110 3. See, for example, comment on the [commit message](https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/Math/+/440737/) in
111 ### A note to the deployment workflow
112 * Even after the code review has passed, it might take some time for the changes to get merged and deployed.
113
114 Examples:
115 1. Bug filed in 2006 nothing happened so far
116 2. Bug filed in Jun 2018, mostly implemented but still not finalized.
117 3. Bug filed on 2019-Mar-14. Feature available on Wikipedia.org on 2019-11-13
118
119 ### A note on larger changes and feature additions
120 * For larger changes, submit changes to Wikimedia config to enable first in the beta cluster
121
122 1. Consider adding a feature flag to isolate your changes so they could be tested intensely before going live.
123 2. If your code includes a feature flag and is merged and deployed, you need to enable it on the beta cluster.
124 This is done by adding a change to the settings file for the cluster.
125 Find help for doing that in #wikimedia-tech
126 3. ... (to be continued)
127
128 ## Updating Translations
129 Translations are edited through translatewiki.net. To edit a translation,
130 [visit this page,](https://translatewiki.net/w/i.php?title=Special:Translate&filter=&group=ext-math&optional=1&task=custom&language=de&action=translate)
131 select the language you wish to translate to and proceed to edit a translation. The translations will be merged into the repository automatically by a bot (l10n-bot).