Difference between revisions of "Module:User:Mr. Stradivarius/sandbox3/doc"
blackwiki>Mr. Stradivarius (update helper function docs, add quality row and importance row classes, add a couple of banner methods) |
blackwiki>Mr. Stradivarius (add some new methods and begin conversion to wikitext) |
||
| Line 1: | Line 1: | ||
== Helper functions == | == Helper functions == | ||
| − | + | ==== checkString ==== | |
| − | |||
| − | |||
| − | : | + | <code style="white-space: nowrap;">checkString( s )</code> |
| − | |||
| − | :checkObject( obj, objType ) | + | Checks to see if <code style="white-space: nowrap;">s</code> is a non-blank string. Returns <code style="white-space: nowrap;">s</code> if true, and returns <code style="white-space: nowrap;">false</code> if not. |
| − | + | :Input type: string | |
| + | |||
| + | ==== addStringToArray ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">addStringToArray( t, s )</code> | ||
| + | |||
| + | Adds the string <code style="white-space: nowrap;">s</code> to the array <code style="white-space: nowrap;">t</code>. Returns <code style="white-space: nowrap;">nil</code> on an attempt to add a non-string value or a blank string, and raises an error on an attempt to add a string to a non-table value. If the array is not present, it is created. | ||
| + | |||
| + | ==== checkObject ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">checkObject( obj, objType )</code> | ||
| + | |||
| + | Checks to see if the object <code style="white-space: nowrap;">obj</code> inherits from <code style="white-space: nowrap;">objType</code> (a string value). Returns <code style="white-space: nowrap;">obj</code> if true, and returns <code style="white-space: nowrap;">false</code> if not. | ||
== Class definitions == | == Class definitions == | ||
| Line 15: | Line 24: | ||
=== All classes === | === All classes === | ||
| − | All classes have a property _type, which | + | All classes have a property <code style="white-space: nowrap;">class._type</code>, which is a string specifying the class type. They also have a table property <code style="white-space: nowrap;">class._inherits</code>, the keys of which are the names of the classes that the class inherits from (the class itself is included). |
| − | + | ==== class:makeCheckSelfFunction ==== | |
| + | |||
| + | <code style="white-space: nowrap;">class:makeCheckSelfFunction()</code> | ||
| + | |||
| + | This method generates a function that checks for mistaken use of the dot syntax with methods. It is used like this: | ||
| + | |||
| + | <source lang="lua"> | ||
| + | local newClass = class:new() | ||
| + | local checkSelfNewClass = newClass:makeCheckSelfFunction() | ||
| + | |||
| + | function newClass:method1() | ||
| + | checkSelfNewClass( self, 'method1' ) | ||
| + | -- Method code | ||
| + | end | ||
| + | |||
| + | function newClass:method2() | ||
| + | checkSelfNewClass( self, 'method2' ) | ||
| + | -- Method code | ||
| + | end | ||
| + | </source> | ||
| + | |||
| + | This function may fail in a small subset of cases: it only checks that an object inherits from <code style="white-space: nowrap;">newClass</code>, not that it is the right object. This should account for most errors, however, and changing the code to check for 100% of cases would be non-trivial. | ||
=== banner class === | === banner class === | ||
| + | |||
The main class for WikiProject banners. Defines the wikitext for the banner box, specifies the project name, the main image, and other things relevant to the banner as a whole. | The main class for WikiProject banners. Defines the wikitext for the banner box, specifies the project name, the main image, and other things relevant to the banner as a whole. | ||
Initiated with: | Initiated with: | ||
| − | banner:new() | + | |
| + | <code style="white-space: nowrap;">banner:new()</code> | ||
Methods: | Methods: | ||
| − | :banner:setProject( s ) | + | ==== banner:setProject ==== |
| − | Sets the project name. | + | |
| − | + | <code style="white-space: nowrap;">banner:setProject( s )</code> | |
| + | |||
| + | Sets the string <code style="white-space: nowrap;">s</code> as the project value. The project value is the name of the project without any surrounding text. For example, the project value for WikiProject Tulips would be <code style="white-space: nowrap;">Tulips</code>. The project value is required for the banner to be displayed. | ||
| + | |||
| + | ==== banner:getProject ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">banner:getProject()</code> | ||
| + | |||
| + | Gets the project value. If no project value is set, raises an error. | ||
| + | |||
| + | ==== banner:setProjectLink ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">banner:setProjectLink( s )</code> | ||
| + | |||
| + | Sets the string <code style="white-space: nowrap;">s</code> as the project link. The project link is the name of the WikiProject's main page on Wikipedia. For example, the main page for WikiProject Tulips would be <code style="white-space: nowrap;">Wikipedia: WikiProject Tulips</code>. | ||
| + | |||
| + | ==== banner:getProjectLink ==== | ||
| − | :banner:getProject() | + | <code style="white-space: nowrap;">banner:getProjectLink()</code> |
| − | Gets the project name. | + | |
| + | Gets the project link. If no project link was specified with <code style="white-space: nowrap;">banner:setProjectLink</code>, then it is generated using <code style="white-space: nowrap;">banner:getProject</code>. | ||
| + | |||
| + | ==== banner:setProjectName ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">banner:setProjectName( s )</code> | ||
| + | |||
| + | Sets the string <code style="white-space: nowrap;">s</code> as the project name. The project name is the name of the WikiProject's main page on Wikipedia. For example, the main page for WikiProject Tulips would be <code style="white-space: nowrap;">Wikipedia: WikiProject Tulips</code>. | ||
| + | |||
| + | ==== banner:getProjectName ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">banner:getProjectName()</code> | ||
| + | |||
| + | Gets the project name. If no project name was specified with <code style="white-space: nowrap;">banner:setProjectName</code>, then it is generated using <code style="white-space: nowrap;">banner:getProject</code>. | ||
| + | |||
| + | ==== banner:setBannerName ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">banner:setBannerName( s )</code> | ||
| + | |||
| + | Sets the string <code style="white-space: nowrap;">s</code> as the banner name. The banner name is the name of the WikiProject's main page on Wikipedia. For example, the main page for WikiProject Tulips would be <code style="white-space: nowrap;">Wikipedia: WikiProject Tulips</code>. | ||
| + | |||
| + | ==== banner:getBannerName ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">banner:getBannerName()</code> | ||
| + | |||
| + | Gets the banner name. If no banner name was specified with <code style="white-space: nowrap;">banner:setBannerName</code>, then it is generated using <code style="white-space: nowrap;">banner:getProject</code>. | ||
| + | |||
| + | ==== banner:setAssessmentCategory ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">banner:setAssessmentCategory( s )</code> | ||
| + | |||
| + | Sets the string <code style="white-space: nowrap;">s</code> as the assessment category. The assessment category is the name of the WikiProject's main page on Wikipedia. For example, the main page for WikiProject Tulips would be <code style="white-space: nowrap;">Wikipedia: WikiProject Tulips</code>. | ||
| + | |||
| + | ==== banner:getAssessmentCategory ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">banner:getAssessmentCategory()</code> | ||
| + | |||
| + | Gets the assessment category. If no assessment category was specified with <code style="white-space: nowrap;">banner:setAssessmentCategory</code>, then it is generated using <code style="white-space: nowrap;">banner:getProject</code>. | ||
| + | |||
| + | ==== banner:setImage ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">banner:setImage( s )</code> | ||
| − | |||
Sets the main image for the banner. | Sets the main image for the banner. | ||
| − | Input type: string | + | :Input type: string |
| + | |||
| + | ==== banner:getImage ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">banner:getImage()</code> | ||
| − | |||
Gets the main image for the banner. | Gets the main image for the banner. | ||
| − | :banner:addCategory( s ) | + | ==== banner:addCategory ==== |
| + | |||
| + | <code style="white-space: nowrap;">banner:addCategory( s )</code> | ||
| + | |||
Adds one category to the banner object. | Adds one category to the banner object. | ||
| − | Input type: string (no double brackets and no "Category:" text) | + | :Input type: string (no double brackets and no "Category:" text) |
| + | |||
| + | ==== banner:addCategories ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">banner:addCategories( t )</code> | ||
| − | |||
Adds multiple categories to the banner object. | Adds multiple categories to the banner object. | ||
| − | Input type: array of strings | + | :Input type: array of strings |
| + | |||
| + | ==== banner:getCategories ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">banner:getCategories()</code> | ||
| − | |||
Gets an array containing the category names for the banner object. | Gets an array containing the category names for the banner object. | ||
| − | :banner:exportCategories() | + | ==== banner:exportCategories ==== |
| + | |||
| + | <code style="white-space: nowrap;">banner:exportCategories()</code> | ||
| + | |||
Returns a string containing all the banner's categories ready for output on a wiki page. | Returns a string containing all the banner's categories ready for output on a wiki page. | ||
| − | :banner:addRow( rowObject ) | + | ==== banner:addRow ==== |
| + | |||
| + | <code style="white-space: nowrap;">banner:addRow( rowObject )</code> | ||
| + | |||
Adds a row object to the banner. | Adds a row object to the banner. | ||
| − | Input type: Row object. | + | :Input type: Row object. |
| + | |||
| + | ==== banner:addRows ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">banner:addRows( t )</code> | ||
| − | |||
Adds an array of row objects to the banner object. | Adds an array of row objects to the banner object. | ||
| − | Input type: array of row objects. | + | :Input type: array of row objects. |
| + | |||
| + | ==== banner:export ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">banner:export()</code> | ||
| − | |||
Exports the banner to wikitext ready for display on wiki pages. | Exports the banner to wikitext ready for display on wiki pages. | ||
| Line 71: | Line 183: | ||
Initiated with: | Initiated with: | ||
| − | :row:new() | + | |
| + | <code style="white-space: nowrap;">row:new()</code> | ||
Methods: | Methods: | ||
| − | :row:addCategory( s ) | + | ==== row:addCategory ==== |
| + | |||
| + | <code style="white-space: nowrap;">row:addCategory( s )</code> | ||
| + | |||
Adds a category to the row object. | Adds a category to the row object. | ||
| − | Input type: string (no double brackets and no "Category:" text) | + | :Input type: string (no double brackets and no "Category:" text) |
| + | |||
| + | ==== row:addCategories ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">row:addCategories( t )</code> | ||
| − | |||
Adds multiple categories to the row object. | Adds multiple categories to the row object. | ||
| − | Input type: array of strings | + | :Input type: array of strings |
| + | |||
| + | ==== row:getCategories ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">row:getCategories()</code> | ||
| − | |||
Gets an array containing the category names for the row object. | Gets an array containing the category names for the row object. | ||
| − | :row:export() | + | ==== row:export ==== |
| + | |||
| + | <code style="white-space: nowrap;">row:export()</code> | ||
| + | |||
Exports the row object to wikitext to be passed to the banner object's export method. | Exports the row object to wikitext to be passed to the banner object's export method. | ||
| Line 94: | Line 219: | ||
Initiated with: | Initiated with: | ||
| − | :qualityRow:new() | + | |
| + | <code style="white-space: nowrap;">qualityRow:new()</code> | ||
Methods: | Methods: | ||
| − | :qualityRow:setQualityScale( obj ) | + | ==== qualityRow:setQualityScale ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityRow:setQualityScale( obj )</code> | ||
| + | |||
Sets the quality scale for the quality row. | Sets the quality scale for the quality row. | ||
| − | Input type: qualityScale object | + | :Input type: qualityScale object |
| + | |||
| + | ==== qualityRow:setStandardQualityScale ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">qualityRow:setStandardQualityScale()</code> | ||
| − | |||
Sets the standard quality scale with default settings. | Sets the standard quality scale with default settings. | ||
| − | :qualityRow:setExtendedQualityScale() | + | ==== qualityRow:setExtendedQualityScale ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityRow:setExtendedQualityScale()</code> | ||
| + | |||
Sets the extended quality scale with default settings. | Sets the extended quality scale with default settings. | ||
| − | :qualityRow:getQualityScale() | + | ==== qualityRow:getQualityScale ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityRow:getQualityScale()</code> | ||
| + | |||
Gets the quality scale object if it is set. | Gets the quality scale object if it is set. | ||
| Line 116: | Line 254: | ||
Initiated with: | Initiated with: | ||
| − | :importanceRow:new() | + | |
| + | <code style="white-space: nowrap;">importanceRow:new()</code> | ||
Methods: | Methods: | ||
| − | :importanceRow:setImportanceScale( obj ) | + | ==== importanceRow:setImportanceScale ==== |
| + | |||
| + | <code style="white-space: nowrap;">importanceRow:setImportanceScale( obj )</code> | ||
| + | |||
Sets the importance scale for the importance row. | Sets the importance scale for the importance row. | ||
| − | Input type: importanceScale object | + | :Input type: importanceScale object |
| + | |||
| + | ==== importanceRow:setStandardImportanceScale ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">importanceRow:setStandardImportanceScale()</code> | ||
| − | |||
Sets the standard importance scale with default settings. | Sets the standard importance scale with default settings. | ||
| − | :importanceRow:getImportanceScale() | + | ==== importanceRow:getImportanceScale ==== |
| + | |||
| + | <code style="white-space: nowrap;">importanceRow:getImportanceScale()</code> | ||
| + | |||
Gets the importance scale object if it is set. | Gets the importance scale object if it is set. | ||
| Line 135: | Line 283: | ||
Initiated with: | Initiated with: | ||
| − | :assessmentScale:new() | + | |
| + | <code style="white-space: nowrap;">assessmentScale:new()</code> | ||
Methods: | Methods: | ||
| − | :assessmentScale:setParamName( s ) | + | ==== assessmentScale:setParamName ==== |
| + | |||
| + | <code style="white-space: nowrap;">assessmentScale:setParamName( s )</code> | ||
| + | |||
Sets the name of the parameter that accepts trigger values from assessmentGrade objects. For example, if an article was rated as |class=start, the parameter name would be "class". | Sets the name of the parameter that accepts trigger values from assessmentGrade objects. For example, if an article was rated as |class=start, the parameter name would be "class". | ||
| − | Input type: string | + | :Input type: string |
| + | |||
| + | ==== assessmentScale:getParamName ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">assessmentScale:getParamName()</code> | ||
| − | |||
Gets the parameter name. | Gets the parameter name. | ||
| − | :assessmentScale:setCategoryFamily( s ) | + | ==== assessmentScale:setCategoryFamily ==== |
| − | Sets the name of the category family. For example, for a quality scale with categories such as [[Category:C-class tulips articles]] and [[Category:List-class tulips articles]] the category family name would be "tulips articles". | + | |
| − | Input type: string | + | <code style="white-space: nowrap;">assessmentScale:setCategoryFamily( s )</code> |
| + | |||
| + | Sets the name of the category family. For example, for a quality scale with categories such as <code><nowiki>[[Category:C-class tulips articles]]</nowiki></code> and <code><nowiki>[[Category:List-class tulips articles]]</nowiki></code> the category family name would be "tulips articles". | ||
| + | :Input type: string | ||
| + | |||
| + | ==== assessmentScale:getCategoryFamily ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">assessmentScale:getCategoryFamily()</code> | ||
| − | |||
Gets the category family name. | Gets the category family name. | ||
| − | :assessmentScale:addGrade( assessmentGradeObject ) | + | ==== assessmentScale:addGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">assessmentScale:addGrade( assessmentGradeObject )</code> | ||
| + | |||
Adds an assessmentGrade object to the assessment scale (usually this will be a qualityGrade or an importanceGrade object). The assessmentGrade objects added to an assessmentScale object determine the grades on its assessment scale. If the assessmentGrade object is already present in the assessment scale, an error will be raised. | Adds an assessmentGrade object to the assessment scale (usually this will be a qualityGrade or an importanceGrade object). The assessmentGrade objects added to an assessmentScale object determine the grades on its assessment scale. If the assessmentGrade object is already present in the assessment scale, an error will be raised. | ||
| − | Input type: assessmentGrade object | + | :Input type: assessmentGrade object |
| + | |||
| + | ==== assessmentScale:addGrades ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">assessmentScale:addGrades( t )</code> | ||
| − | |||
Adds an array of multiple assessmentGrade objects to the assessmentScale object. | Adds an array of multiple assessmentGrade objects to the assessmentScale object. | ||
| − | Input type: array of assessmentGrade objects | + | :Input type: array of assessmentGrade objects |
| + | |||
| + | ==== assessmentScale:removeGrade ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">assessmentScale:removeGrade( s )</code> | ||
| − | |||
Removes one grade from the assessment scale. | Removes one grade from the assessment scale. | ||
| − | Input type: string | + | :Input type: string |
| + | |||
| + | ==== assessmentScale:removeGrades ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">assessmentScale:removeGrades( t )</code> | ||
| − | |||
Removes multiple grades from the assessment scale. | Removes multiple grades from the assessment scale. | ||
| − | Input type: array of strings | + | :Input type: array of strings |
| + | |||
| + | ==== assessmentScale:getGrades ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">assessmentScale:getGrades()</code> | ||
| − | |||
Returns the table containing the assessmentGrade objects. | Returns the table containing the assessmentGrade objects. | ||
| − | :assessmentScale:getGrade( s ) | + | ==== assessmentScale:getGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">assessmentScale:getGrade( s )</code> | ||
| + | |||
Returns the specified grade object if it is set in the assessment scale. | Returns the specified grade object if it is set in the assessment scale. | ||
| − | :assessmentScale:editGrade( gradeName, method, ... ) | + | ==== assessmentScale:editGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">assessmentScale:editGrade( gradeName, method, ... )</code> | ||
| + | |||
Edits the assessment grade object named "gradeName", using the assessment grade object's method "method". The third and subsequent arguments are passed as arguments to "method". This is a convenience function, to avoid having to remove a whole assessment grade object from the assessment scale, edit it, and then add it again. | Edits the assessment grade object named "gradeName", using the assessment grade object's method "method". The third and subsequent arguments are passed as arguments to "method". This is a convenience function, to avoid having to remove a whole assessment grade object from the assessment scale, edit it, and then add it again. | ||
gradeName input type: string | gradeName input type: string | ||
method input type: string | method input type: string | ||
| − | :assessmentScale:checkForDuplicateTriggers() | + | ==== assessmentScale:checkForDuplicateTriggers ==== |
| + | |||
| + | <code style="white-space: nowrap;">assessmentScale:checkForDuplicateTriggers()</code> | ||
| + | |||
Checks for duplicate triggers in the grade objects added to the assessment scale. If any are found, displays an error. | Checks for duplicate triggers in the grade objects added to the assessment scale. If any are found, displays an error. | ||
| Line 188: | Line 373: | ||
Initiated with: | Initiated with: | ||
| − | :qualityScale:new() | + | |
| + | <code style="white-space: nowrap;">qualityScale:new()</code> | ||
Methods: | Methods: | ||
| − | :qualityScale:setFaGrade() | + | ==== qualityScale:setFaGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityScale:setFaGrade()</code> | ||
| + | |||
Sets an FA (Featured Article) grade with the default settings. The grade name is set to "fa", there is one trigger of "fa", the color is "#6699ff", and the icon is "Featured article star.svg". | Sets an FA (Featured Article) grade with the default settings. The grade name is set to "fa", there is one trigger of "fa", the color is "#6699ff", and the icon is "Featured article star.svg". | ||
| − | :qualityScale:setAGrade() | + | ==== qualityScale:setAGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityScale:setAGrade()</code> | ||
| + | |||
Sets an A grade with the default settings. The grade name is set to "a", there is one trigger of "a", the color is "#66ffff", and the icon is "Symbol a class.svg.svg". | Sets an A grade with the default settings. The grade name is set to "a", there is one trigger of "a", the color is "#66ffff", and the icon is "Symbol a class.svg.svg". | ||
| − | :qualityScale:setGaGrade() | + | ==== qualityScale:setGaGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityScale:setGaGrade()</code> | ||
| + | |||
Sets a GA (Good Article) grade with the default settings. The grade name is set to "ga", there is one trigger of "ga", the color is "#66ff66", and the icon is "Symbol support vote.svg". | Sets a GA (Good Article) grade with the default settings. The grade name is set to "ga", there is one trigger of "ga", the color is "#66ff66", and the icon is "Symbol support vote.svg". | ||
| − | :qualityScale:setBGrade() | + | ==== qualityScale:setBGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityScale:setBGrade()</code> | ||
| + | |||
Sets a B grade with the default settings. The grade name is set to "b", there is one trigger of "b", and the color is "#b2ff66". | Sets a B grade with the default settings. The grade name is set to "b", there is one trigger of "b", and the color is "#b2ff66". | ||
| − | :qualityScale:setCGrade() | + | ==== qualityScale:setCGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityScale:setCGrade()</code> | ||
| + | |||
Sets a C grade with the default settings. The grade name is set to "c", there is one trigger of "c", and the color is "#ffff66". | Sets a C grade with the default settings. The grade name is set to "c", there is one trigger of "c", and the color is "#ffff66". | ||
| − | :qualityScale:setStartGrade() | + | ==== qualityScale:setStartGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityScale:setStartGrade()</code> | ||
| + | |||
Sets a Start grade with the default settings. The grade name is set to "start", there is one trigger of "start", and the color is "#ffaa66". | Sets a Start grade with the default settings. The grade name is set to "start", there is one trigger of "start", and the color is "#ffaa66". | ||
| − | :qualityScale:setStubGrade() | + | ==== qualityScale:setStubGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityScale:setStubGrade()</code> | ||
| + | |||
Sets a Stub grade with the default settings. The grade name is set to "stub", there is one trigger of "stub", and the color is "#ff6666". | Sets a Stub grade with the default settings. The grade name is set to "stub", there is one trigger of "stub", and the color is "#ff6666". | ||
| − | :qualityScale:setFlGrade() | + | ==== qualityScale:setFlGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityScale:setFlGrade()</code> | ||
| + | |||
Sets an FL (Featured List) grade with the default settings. The grade name is set to "fl", there is one trigger of "fl", the color is "#6699ff", and the icon is "Featured article star.svg". | Sets an FL (Featured List) grade with the default settings. The grade name is set to "fl", there is one trigger of "fl", the color is "#6699ff", and the icon is "Featured article star.svg". | ||
| − | :qualityScale:setListGrade() | + | ==== qualityScale:setListGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityScale:setListGrade()</code> | ||
| + | |||
Sets a List grade with the default settings. The grade name is set to "list", there is one trigger of "list", and the color is "#aa88ff". | Sets a List grade with the default settings. The grade name is set to "list", there is one trigger of "list", and the color is "#aa88ff". | ||
| − | :qualityScale:setNaGrade() | + | ==== qualityScale:setNaGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityScale:setNaGrade()</code> | ||
| + | |||
Sets a NA (not applicable) grade with the default settings. The grade name is set to "na", there are two triggers of "na" and "n/a", and the color is "#f5f5f5". | Sets a NA (not applicable) grade with the default settings. The grade name is set to "na", there are two triggers of "na" and "n/a", and the color is "#f5f5f5". | ||
| − | :qualityScale:setCategoryGrade() | + | ==== qualityScale:setCategoryGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityScale:setCategoryGrade()</code> | ||
| + | |||
Sets a Category grade with the default settings. The grade name is set to "category", there are three triggers of "category", "cat" and "categ", and the color is "#ffdb58". | Sets a Category grade with the default settings. The grade name is set to "category", there are three triggers of "category", "cat" and "categ", and the color is "#ffdb58". | ||
| − | :qualityScale:setDisambigGrade() | + | ==== qualityScale:setDisambigGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityScale:setDisambigGrade()</code> | ||
| + | |||
Sets a Disambig (disambiguation) grade with the default settings. The grade name is set to "disambig", there are four triggers of "disambiguation", "disambig", "disamb" and "dab", and the color is "#00fa9a". | Sets a Disambig (disambiguation) grade with the default settings. The grade name is set to "disambig", there are four triggers of "disambiguation", "disambig", "disamb" and "dab", and the color is "#00fa9a". | ||
| − | :qualityScale:setFileGrade() | + | ==== qualityScale:setFileGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityScale:setFileGrade()</code> | ||
| + | |||
Sets a File grade with the default settings. The grade name is set to "file", there are three triggers of "file", "img" and "image", and the color is "#ddccff". | Sets a File grade with the default settings. The grade name is set to "file", there are three triggers of "file", "img" and "image", and the color is "#ddccff". | ||
| − | :qualityScale:setPortalGrade() | + | ==== qualityScale:setPortalGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityScale:setPortalGrade()</code> | ||
| + | |||
Sets a Portal grade with the default settings. The grade name is set to "portal", there is one trigger of "portal", and the color is "#cc8899". | Sets a Portal grade with the default settings. The grade name is set to "portal", there is one trigger of "portal", and the color is "#cc8899". | ||
| − | :qualityScale:setProjectGrade() | + | ==== qualityScale:setProjectGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityScale:setProjectGrade()</code> | ||
| + | |||
Sets a Project grade with the default settings. The grade name is set to "project", there are three triggers of "project", "proj" and "prj", and the color is "#c0c090". | Sets a Project grade with the default settings. The grade name is set to "project", there are three triggers of "project", "proj" and "prj", and the color is "#c0c090". | ||
| − | :qualityScale:setTemplateGrade() | + | ==== qualityScale:setTemplateGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityScale:setTemplateGrade()</code> | ||
| + | |||
Sets a Template grade with the default settings. The grade name is set to "template", there are five triggers of "template", "temp", "tpl", "tmp" and "templ", and the color is "#fbceb1". | Sets a Template grade with the default settings. The grade name is set to "template", there are five triggers of "template", "temp", "tpl", "tmp" and "templ", and the color is "#fbceb1". | ||
| − | :qualityScale:setRedirectGrade() | + | ==== qualityScale:setRedirectGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityScale:setRedirectGrade()</code> | ||
| + | |||
Sets a Redirect grade with the default settings. The grade name is set to "redirect", there are three triggers of "redirect", "red" and "redir", and the color is "#c0c0c0". | Sets a Redirect grade with the default settings. The grade name is set to "redirect", there are three triggers of "redirect", "red" and "redir", and the color is "#c0c0c0". | ||
| − | :qualityScale:setFmGrade() | + | ==== qualityScale:setFmGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityScale:setFmGrade()</code> | ||
| + | |||
Sets an FM (Featured Media) grade with the default settings. The grade name is set to "fm", there is one trigger of "fm", the color is "#6699ff", and the icon is "Featured article star.svg". | Sets an FM (Featured Media) grade with the default settings. The grade name is set to "fm", there is one trigger of "fm", the color is "#6699ff", and the icon is "Featured article star.svg". | ||
| − | :qualityScale:setStandardQualityScale() | + | ==== qualityScale:setStandardQualityScale ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityScale:setStandardQualityScale()</code> | ||
| + | |||
Sets the standard quality scale, with grades of FA, A, GA, B, C, Start, Stub, FL, List and NA. All the grades have the default values. | Sets the standard quality scale, with grades of FA, A, GA, B, C, Start, Stub, FL, List and NA. All the grades have the default values. | ||
| − | :qualityScale:setExtendedQualityScale() | + | ==== qualityScale:setExtendedQualityScale ==== |
| + | |||
| + | <code style="white-space: nowrap;">qualityScale:setExtendedQualityScale()</code> | ||
| + | |||
Sets the extended quality scale, with the grades in the standard quality scale plus grades of Category, Disambig, File, Portal, Project, and Template. All the grades have the default values. | Sets the extended quality scale, with the grades in the standard quality scale plus grades of Category, Disambig, File, Portal, Project, and Template. All the grades have the default values. | ||
| Line 257: | Line 503: | ||
Initiated with: | Initiated with: | ||
| − | :importanceScale:new() | + | |
| + | <code style="white-space: nowrap;">importanceScale:new()</code> | ||
Methods: | Methods: | ||
| − | :importanceScale:setTopGrade() | + | ==== importanceScale:setTopGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">importanceScale:setTopGrade()</code> | ||
| + | |||
Sets a Top importance grade with the default settings. The grade name is set to "top", there is one trigger of "top", and the color is "#ff00ff". | Sets a Top importance grade with the default settings. The grade name is set to "top", there is one trigger of "top", and the color is "#ff00ff". | ||
| − | :importanceScale:setHighGrade() | + | ==== importanceScale:setHighGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">importanceScale:setHighGrade()</code> | ||
| + | |||
Sets a High importance grade with the default settings. The grade name is set to "high", there is one trigger of "high", and the color is "#ff88ff". | Sets a High importance grade with the default settings. The grade name is set to "high", there is one trigger of "high", and the color is "#ff88ff". | ||
| − | :importanceScale:setMidGrade() | + | ==== importanceScale:setMidGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">importanceScale:setMidGrade()</code> | ||
| + | |||
Sets a Mid importance grade with the default settings. The grade name is set to "mid", there is one trigger of "mid", and the color is "#ffbbff". | Sets a Mid importance grade with the default settings. The grade name is set to "mid", there is one trigger of "mid", and the color is "#ffbbff". | ||
| − | :importanceScale:setLowGrade() | + | ==== importanceScale:setLowGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">importanceScale:setLowGrade()</code> | ||
| + | |||
Sets a Low importance grade with the default settings. The grade name is set to "low", there is one trigger of "low", and the color is "#ffddff". | Sets a Low importance grade with the default settings. The grade name is set to "low", there is one trigger of "low", and the color is "#ffddff". | ||
| − | :importanceScale:setBottomGrade() | + | ==== importanceScale:setBottomGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">importanceScale:setBottomGrade()</code> | ||
| + | |||
Sets a Bottom importance grade with the default settings. The grade name is set to "bottom", there is one trigger of "bottom", and the color is "#ffeeff". | Sets a Bottom importance grade with the default settings. The grade name is set to "bottom", there is one trigger of "bottom", and the color is "#ffeeff". | ||
| − | :importanceScale:setNoGrade() | + | ==== importanceScale:setNoGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">importanceScale:setNoGrade()</code> | ||
| + | |||
Sets a No importance grade with the default settings. The grade name is set to "no", there is one trigger of "no", and the color is "#ffffff". | Sets a No importance grade with the default settings. The grade name is set to "no", there is one trigger of "no", and the color is "#ffffff". | ||
| − | :importanceScale:setNaGrade() | + | ==== importanceScale:setNaGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">importanceScale:setNaGrade()</code> | ||
| + | |||
Sets a NA importance grade with the default settings. The grade name is set to "na", there are two triggers of "na" and "n/a", and the color is "#f5f5f5". | Sets a NA importance grade with the default settings. The grade name is set to "na", there are two triggers of "na" and "n/a", and the color is "#f5f5f5". | ||
| − | :importanceScale:setCoreGrade() | + | ==== importanceScale:setCoreGrade ==== |
| + | |||
| + | <code style="white-space: nowrap;">importanceScale:setCoreGrade()</code> | ||
| + | |||
Sets a Core importance grade with the default settings. The grade name is set to "core", there is one trigger of "core", and the color is "#ff00ff". | Sets a Core importance grade with the default settings. The grade name is set to "core", there is one trigger of "core", and the color is "#ff00ff". | ||
| − | :importanceScale:setStandardImportanceScale() | + | ==== importanceScale:setStandardImportanceScale ==== |
| + | |||
| + | <code style="white-space: nowrap;">importanceScale:setStandardImportanceScale()</code> | ||
| + | |||
Sets the standard importance scale of Top, High, Mid, Low, and NA, with the default settings. | Sets the standard importance scale of Top, High, Mid, Low, and NA, with the default settings. | ||
| Line 293: | Line 567: | ||
Initiated with: | Initiated with: | ||
| − | :assessmentGrade:new() | + | |
| + | <code style="white-space: nowrap;">assessmentGrade:new()</code> | ||
Methods: | Methods: | ||
| − | :assessmentGrade:setGradeName( s ) | + | ==== assessmentGrade:setGradeName ==== |
| + | |||
| + | <code style="white-space: nowrap;">assessmentGrade:setGradeName( s )</code> | ||
| + | |||
Sets the name of the assessment grade. For example, for a C-class quality grade, the grade name would be "c". | Sets the name of the assessment grade. For example, for a C-class quality grade, the grade name would be "c". | ||
| − | Input type: string | + | :Input type: string |
| + | |||
| + | ==== assessmentGrade:getGradeName ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">assessmentGrade:getGradeName()</code> | ||
| − | |||
Gets the name of the assessment grade. | Gets the name of the assessment grade. | ||
| − | :assessmentGrade:addTrigger( s ) | + | ==== assessmentGrade:addTrigger ==== |
| + | |||
| + | <code style="white-space: nowrap;">assessmentGrade:addTrigger( s )</code> | ||
| + | |||
Adds a trigger for the assessment grade. For example, if you want the grade to be triggered by the code "|class=foo", then the trigger would be "foo". | Adds a trigger for the assessment grade. For example, if you want the grade to be triggered by the code "|class=foo", then the trigger would be "foo". | ||
| − | Input type: string | + | :Input type: string |
| + | |||
| + | ==== assessmentGrade:addTriggers ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">assessmentGrade:addTriggers( t )</code> | ||
| − | |||
Adds multiple triggers for the assessment grade. | Adds multiple triggers for the assessment grade. | ||
| − | Input type: array of strings | + | :Input type: array of strings |
| + | |||
| + | ==== assessmentGrade:getTriggers ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">assessmentGrade:getTriggers()</code> | ||
| − | |||
Gets the array of triggers for the assessment grade. | Gets the array of triggers for the assessment grade. | ||
| − | :assessmentGrade:setCategory( s ) | + | ==== assessmentGrade:setCategory ==== |
| + | |||
| + | <code style="white-space: nowrap;">assessmentGrade:setCategory( s )</code> | ||
| + | |||
Sets the category used by the assessment grade. This should only be used if the category does not follow the default naming system. Normally categories are set by assessmentScale objects or banner objects. | Sets the category used by the assessment grade. This should only be used if the category does not follow the default naming system. Normally categories are set by assessmentScale objects or banner objects. | ||
| − | :assessmentGrade:getCategory() | + | ==== assessmentGrade:getCategory ==== |
| + | |||
| + | <code style="white-space: nowrap;">assessmentGrade:getCategory()</code> | ||
| + | |||
Gets the category for the assessment grade, if one was set with assessmentGrade:setCategory. | Gets the category for the assessment grade, if one was set with assessmentGrade:setCategory. | ||
| − | :assessmentGrade:setColor( s ) | + | ==== assessmentGrade:setColor ==== |
| + | |||
| + | <code style="white-space: nowrap;">assessmentGrade:setColor( s )</code> | ||
| + | |||
Sets the color used for icon boxes etc. used by the assessment grade. | Sets the color used for icon boxes etc. used by the assessment grade. | ||
| − | Input type: string (should be a valid css color value, e.g. '#gg99ff') | + | :Input type: string (should be a valid css color value, e.g. '#gg99ff') |
| + | |||
| + | ==== assessmentGrade:getColor ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">assessmentGrade:getColor()</code> | ||
| − | |||
Gets the assessment grade color. | Gets the assessment grade color. | ||
| − | :assessmentGrade:setIcon( s ) | + | ==== assessmentGrade:setIcon ==== |
| + | |||
| + | <code style="white-space: nowrap;">assessmentGrade:setIcon( s )</code> | ||
| + | |||
Sets the icon for the assessment grade, e.g. the featured article star for featured articles. This is optional - not every assessmentGrade object needs an icon. If specified, it should be a valid file name, without the "File:" prefix. | Sets the icon for the assessment grade, e.g. the featured article star for featured articles. This is optional - not every assessmentGrade object needs an icon. If specified, it should be a valid file name, without the "File:" prefix. | ||
| − | Input type: string | + | :Input type: string |
| + | |||
| + | ==== assessmentGrade:getIcon ==== | ||
| + | |||
| + | <code style="white-space: nowrap;">assessmentGrade:getIcon()</code> | ||
| − | |||
Gets the icon file name. | Gets the icon file name. | ||
=== qualityGrade class === | === qualityGrade class === | ||
| − | The quality grade class defines quality grades on a quality scale. It inherits methods from the assessmentGrade class. | + | The quality grade class defines quality grades on a quality scale. It inherits methods from the <code style="white-space: nowrap;">assessmentGrade</code> class. |
Methods: | Methods: | ||
| Line 345: | Line 653: | ||
=== importanceGrade class === | === importanceGrade class === | ||
| − | The | + | The <code style="white-space: nowrap;">importanceGrade</code> class defines importance grades on an importance scale. It inherits methods from the <code style="white-space: nowrap;">assessmentGrade</code> class. |
Methods: | Methods: | ||
All methods from the assessmentGrade class | All methods from the assessmentGrade class | ||
Revision as of 14:55, 7 September 2013
Contents
- 1 Helper functions
- 2 Class definitions
- 2.1 All classes
- 2.2 banner class
- 2.2.1 banner:setProject
- 2.2.2 banner:getProject
- 2.2.3 banner:setProjectLink
- 2.2.4 banner:getProjectLink
- 2.2.5 banner:setProjectName
- 2.2.6 banner:getProjectName
- 2.2.7 banner:setBannerName
- 2.2.8 banner:getBannerName
- 2.2.9 banner:setAssessmentCategory
- 2.2.10 banner:getAssessmentCategory
- 2.2.11 banner:setImage
- 2.2.12 banner:getImage
- 2.2.13 banner:addCategory
- 2.2.14 banner:addCategories
- 2.2.15 banner:getCategories
- 2.2.16 banner:exportCategories
- 2.2.17 banner:addRow
- 2.2.18 banner:addRows
- 2.2.19 banner:export
- 2.3 row class
- 2.4 qualityRow class
- 2.5 importanceRow class
- 2.6 assessmentScale class
- 2.6.1 assessmentScale:setParamName
- 2.6.2 assessmentScale:getParamName
- 2.6.3 assessmentScale:setCategoryFamily
- 2.6.4 assessmentScale:getCategoryFamily
- 2.6.5 assessmentScale:addGrade
- 2.6.6 assessmentScale:addGrades
- 2.6.7 assessmentScale:removeGrade
- 2.6.8 assessmentScale:removeGrades
- 2.6.9 assessmentScale:getGrades
- 2.6.10 assessmentScale:getGrade
- 2.6.11 assessmentScale:editGrade
- 2.6.12 assessmentScale:checkForDuplicateTriggers
- 2.7 qualityScale class
- 2.7.1 qualityScale:setFaGrade
- 2.7.2 qualityScale:setAGrade
- 2.7.3 qualityScale:setGaGrade
- 2.7.4 qualityScale:setBGrade
- 2.7.5 qualityScale:setCGrade
- 2.7.6 qualityScale:setStartGrade
- 2.7.7 qualityScale:setStubGrade
- 2.7.8 qualityScale:setFlGrade
- 2.7.9 qualityScale:setListGrade
- 2.7.10 qualityScale:setNaGrade
- 2.7.11 qualityScale:setCategoryGrade
- 2.7.12 qualityScale:setDisambigGrade
- 2.7.13 qualityScale:setFileGrade
- 2.7.14 qualityScale:setPortalGrade
- 2.7.15 qualityScale:setProjectGrade
- 2.7.16 qualityScale:setTemplateGrade
- 2.7.17 qualityScale:setRedirectGrade
- 2.7.18 qualityScale:setFmGrade
- 2.7.19 qualityScale:setStandardQualityScale
- 2.7.20 qualityScale:setExtendedQualityScale
- 2.8 importanceScale class
- 2.8.1 importanceScale:setTopGrade
- 2.8.2 importanceScale:setHighGrade
- 2.8.3 importanceScale:setMidGrade
- 2.8.4 importanceScale:setLowGrade
- 2.8.5 importanceScale:setBottomGrade
- 2.8.6 importanceScale:setNoGrade
- 2.8.7 importanceScale:setNaGrade
- 2.8.8 importanceScale:setCoreGrade
- 2.8.9 importanceScale:setStandardImportanceScale
- 2.9 assessmentGrade class
- 2.9.1 assessmentGrade:setGradeName
- 2.9.2 assessmentGrade:getGradeName
- 2.9.3 assessmentGrade:addTrigger
- 2.9.4 assessmentGrade:addTriggers
- 2.9.5 assessmentGrade:getTriggers
- 2.9.6 assessmentGrade:setCategory
- 2.9.7 assessmentGrade:getCategory
- 2.9.8 assessmentGrade:setColor
- 2.9.9 assessmentGrade:getColor
- 2.9.10 assessmentGrade:setIcon
- 2.9.11 assessmentGrade:getIcon
- 2.10 qualityGrade class
- 2.11 importanceGrade class
Helper functions
checkString
checkString( s )
Checks to see if s is a non-blank string. Returns s if true, and returns false if not.
- Input type: string
addStringToArray
addStringToArray( t, s )
Adds the string s to the array t. Returns nil on an attempt to add a non-string value or a blank string, and raises an error on an attempt to add a string to a non-table value. If the array is not present, it is created.
checkObject
checkObject( obj, objType )
Checks to see if the object obj inherits from objType (a string value). Returns obj if true, and returns false if not.
Class definitions
All classes
All classes have a property class._type, which is a string specifying the class type. They also have a table property class._inherits, the keys of which are the names of the classes that the class inherits from (the class itself is included).
class:makeCheckSelfFunction
class:makeCheckSelfFunction()
This method generates a function that checks for mistaken use of the dot syntax with methods. It is used like this:
local newClass = class:new()
local checkSelfNewClass = newClass:makeCheckSelfFunction()
function newClass:method1()
checkSelfNewClass( self, 'method1' )
-- Method code
end
function newClass:method2()
checkSelfNewClass( self, 'method2' )
-- Method code
end
This function may fail in a small subset of cases: it only checks that an object inherits from newClass, not that it is the right object. This should account for most errors, however, and changing the code to check for 100% of cases would be non-trivial.
banner class
The main class for WikiProject banners. Defines the wikitext for the banner box, specifies the project name, the main image, and other things relevant to the banner as a whole.
Initiated with:
banner:new()
Methods:
banner:setProject
banner:setProject( s )
Sets the string s as the project value. The project value is the name of the project without any surrounding text. For example, the project value for WikiProject Tulips would be Tulips. The project value is required for the banner to be displayed.
banner:getProject
banner:getProject()
Gets the project value. If no project value is set, raises an error.
banner:setProjectLink
banner:setProjectLink( s )
Sets the string s as the project link. The project link is the name of the WikiProject's main page on Wikipedia. For example, the main page for WikiProject Tulips would be Wikipedia: WikiProject Tulips.
banner:getProjectLink
banner:getProjectLink()
Gets the project link. If no project link was specified with banner:setProjectLink, then it is generated using banner:getProject.
banner:setProjectName
banner:setProjectName( s )
Sets the string s as the project name. The project name is the name of the WikiProject's main page on Wikipedia. For example, the main page for WikiProject Tulips would be Wikipedia: WikiProject Tulips.
banner:getProjectName
banner:getProjectName()
Gets the project name. If no project name was specified with banner:setProjectName, then it is generated using banner:getProject.
banner:setBannerName
banner:setBannerName( s )
Sets the string s as the banner name. The banner name is the name of the WikiProject's main page on Wikipedia. For example, the main page for WikiProject Tulips would be Wikipedia: WikiProject Tulips.
banner:getBannerName
banner:getBannerName()
Gets the banner name. If no banner name was specified with banner:setBannerName, then it is generated using banner:getProject.
banner:setAssessmentCategory
banner:setAssessmentCategory( s )
Sets the string s as the assessment category. The assessment category is the name of the WikiProject's main page on Wikipedia. For example, the main page for WikiProject Tulips would be Wikipedia: WikiProject Tulips.
banner:getAssessmentCategory
banner:getAssessmentCategory()
Gets the assessment category. If no assessment category was specified with banner:setAssessmentCategory, then it is generated using banner:getProject.
banner:setImage
banner:setImage( s )
Sets the main image for the banner.
- Input type: string
banner:getImage
banner:getImage()
Gets the main image for the banner.
banner:addCategory
banner:addCategory( s )
Adds one category to the banner object.
- Input type: string (no double brackets and no "Category:" text)
banner:addCategories
banner:addCategories( t )
Adds multiple categories to the banner object.
- Input type: array of strings
banner:getCategories
banner:getCategories()
Gets an array containing the category names for the banner object.
banner:exportCategories
banner:exportCategories()
Returns a string containing all the banner's categories ready for output on a wiki page.
banner:addRow
banner:addRow( rowObject )
Adds a row object to the banner.
- Input type: Row object.
banner:addRows
banner:addRows( t )
Adds an array of row objects to the banner object.
- Input type: array of row objects.
banner:export
banner:export()
Exports the banner to wikitext ready for display on wiki pages.
row class
The row class defines one row to add to the banner object. Rows can be things like task forces, notes, assessments, etc.
Initiated with:
row:new()
Methods:
row:addCategory
row:addCategory( s )
Adds a category to the row object.
- Input type: string (no double brackets and no "Category:" text)
row:addCategories
row:addCategories( t )
Adds multiple categories to the row object.
- Input type: array of strings
row:getCategories
row:getCategories()
Gets an array containing the category names for the row object.
row:export
row:export()
Exports the row object to wikitext to be passed to the banner object's export method.
qualityRow class
The qualityRow class defines the banner row displaying quality scale information.
Initiated with:
qualityRow:new()
Methods:
qualityRow:setQualityScale
qualityRow:setQualityScale( obj )
Sets the quality scale for the quality row.
- Input type: qualityScale object
qualityRow:setStandardQualityScale
qualityRow:setStandardQualityScale()
Sets the standard quality scale with default settings.
qualityRow:setExtendedQualityScale
qualityRow:setExtendedQualityScale()
Sets the extended quality scale with default settings.
qualityRow:getQualityScale
qualityRow:getQualityScale()
Gets the quality scale object if it is set.
importanceRow class
The importanceRow class defines the banner row displaying importance scale information.
Initiated with:
importanceRow:new()
Methods:
importanceRow:setImportanceScale
importanceRow:setImportanceScale( obj )
Sets the importance scale for the importance row.
- Input type: importanceScale object
importanceRow:setStandardImportanceScale
importanceRow:setStandardImportanceScale()
Sets the standard importance scale with default settings.
importanceRow:getImportanceScale
importanceRow:getImportanceScale()
Gets the importance scale object if it is set.
assessmentScale class
The assessmentScale class provides the infrastructure for quality scales and importance scales.
Initiated with:
assessmentScale:new()
Methods:
assessmentScale:setParamName
assessmentScale:setParamName( s )
Sets the name of the parameter that accepts trigger values from assessmentGrade objects. For example, if an article was rated as |class=start, the parameter name would be "class".
- Input type: string
assessmentScale:getParamName
assessmentScale:getParamName()
Gets the parameter name.
assessmentScale:setCategoryFamily
assessmentScale:setCategoryFamily( s )
Sets the name of the category family. For example, for a quality scale with categories such as [[Category:C-class tulips articles]] and [[Category:List-class tulips articles]] the category family name would be "tulips articles".
- Input type: string
assessmentScale:getCategoryFamily
assessmentScale:getCategoryFamily()
Gets the category family name.
assessmentScale:addGrade
assessmentScale:addGrade( assessmentGradeObject )
Adds an assessmentGrade object to the assessment scale (usually this will be a qualityGrade or an importanceGrade object). The assessmentGrade objects added to an assessmentScale object determine the grades on its assessment scale. If the assessmentGrade object is already present in the assessment scale, an error will be raised.
- Input type: assessmentGrade object
assessmentScale:addGrades
assessmentScale:addGrades( t )
Adds an array of multiple assessmentGrade objects to the assessmentScale object.
- Input type: array of assessmentGrade objects
assessmentScale:removeGrade
assessmentScale:removeGrade( s )
Removes one grade from the assessment scale.
- Input type: string
assessmentScale:removeGrades
assessmentScale:removeGrades( t )
Removes multiple grades from the assessment scale.
- Input type: array of strings
assessmentScale:getGrades
assessmentScale:getGrades()
Returns the table containing the assessmentGrade objects.
assessmentScale:getGrade
assessmentScale:getGrade( s )
Returns the specified grade object if it is set in the assessment scale.
assessmentScale:editGrade
assessmentScale:editGrade( gradeName, method, ... )
Edits the assessment grade object named "gradeName", using the assessment grade object's method "method". The third and subsequent arguments are passed as arguments to "method". This is a convenience function, to avoid having to remove a whole assessment grade object from the assessment scale, edit it, and then add it again. gradeName input type: string method input type: string
assessmentScale:checkForDuplicateTriggers
assessmentScale:checkForDuplicateTriggers()
Checks for duplicate triggers in the grade objects added to the assessment scale. If any are found, displays an error.
qualityScale class
This class defines a quality scale.
Initiated with:
qualityScale:new()
Methods:
qualityScale:setFaGrade
qualityScale:setFaGrade()
Sets an FA (Featured Article) grade with the default settings. The grade name is set to "fa", there is one trigger of "fa", the color is "#6699ff", and the icon is "Featured article star.svg".
qualityScale:setAGrade
qualityScale:setAGrade()
Sets an A grade with the default settings. The grade name is set to "a", there is one trigger of "a", the color is "#66ffff", and the icon is "Symbol a class.svg.svg".
qualityScale:setGaGrade
qualityScale:setGaGrade()
Sets a GA (Good Article) grade with the default settings. The grade name is set to "ga", there is one trigger of "ga", the color is "#66ff66", and the icon is "Symbol support vote.svg".
qualityScale:setBGrade
qualityScale:setBGrade()
Sets a B grade with the default settings. The grade name is set to "b", there is one trigger of "b", and the color is "#b2ff66".
qualityScale:setCGrade
qualityScale:setCGrade()
Sets a C grade with the default settings. The grade name is set to "c", there is one trigger of "c", and the color is "#ffff66".
qualityScale:setStartGrade
qualityScale:setStartGrade()
Sets a Start grade with the default settings. The grade name is set to "start", there is one trigger of "start", and the color is "#ffaa66".
qualityScale:setStubGrade
qualityScale:setStubGrade()
Sets a Stub grade with the default settings. The grade name is set to "stub", there is one trigger of "stub", and the color is "#ff6666".
qualityScale:setFlGrade
qualityScale:setFlGrade()
Sets an FL (Featured List) grade with the default settings. The grade name is set to "fl", there is one trigger of "fl", the color is "#6699ff", and the icon is "Featured article star.svg".
qualityScale:setListGrade
qualityScale:setListGrade()
Sets a List grade with the default settings. The grade name is set to "list", there is one trigger of "list", and the color is "#aa88ff".
qualityScale:setNaGrade
qualityScale:setNaGrade()
Sets a NA (not applicable) grade with the default settings. The grade name is set to "na", there are two triggers of "na" and "n/a", and the color is "#f5f5f5".
qualityScale:setCategoryGrade
qualityScale:setCategoryGrade()
Sets a Category grade with the default settings. The grade name is set to "category", there are three triggers of "category", "cat" and "categ", and the color is "#ffdb58".
qualityScale:setDisambigGrade
qualityScale:setDisambigGrade()
Sets a Disambig (disambiguation) grade with the default settings. The grade name is set to "disambig", there are four triggers of "disambiguation", "disambig", "disamb" and "dab", and the color is "#00fa9a".
qualityScale:setFileGrade
qualityScale:setFileGrade()
Sets a File grade with the default settings. The grade name is set to "file", there are three triggers of "file", "img" and "image", and the color is "#ddccff".
qualityScale:setPortalGrade
qualityScale:setPortalGrade()
Sets a Portal grade with the default settings. The grade name is set to "portal", there is one trigger of "portal", and the color is "#cc8899".
qualityScale:setProjectGrade
qualityScale:setProjectGrade()
Sets a Project grade with the default settings. The grade name is set to "project", there are three triggers of "project", "proj" and "prj", and the color is "#c0c090".
qualityScale:setTemplateGrade
qualityScale:setTemplateGrade()
Sets a Template grade with the default settings. The grade name is set to "template", there are five triggers of "template", "temp", "tpl", "tmp" and "templ", and the color is "#fbceb1".
qualityScale:setRedirectGrade
qualityScale:setRedirectGrade()
Sets a Redirect grade with the default settings. The grade name is set to "redirect", there are three triggers of "redirect", "red" and "redir", and the color is "#c0c0c0".
qualityScale:setFmGrade
qualityScale:setFmGrade()
Sets an FM (Featured Media) grade with the default settings. The grade name is set to "fm", there is one trigger of "fm", the color is "#6699ff", and the icon is "Featured article star.svg".
qualityScale:setStandardQualityScale
qualityScale:setStandardQualityScale()
Sets the standard quality scale, with grades of FA, A, GA, B, C, Start, Stub, FL, List and NA. All the grades have the default values.
qualityScale:setExtendedQualityScale
qualityScale:setExtendedQualityScale()
Sets the extended quality scale, with the grades in the standard quality scale plus grades of Category, Disambig, File, Portal, Project, and Template. All the grades have the default values.
importanceScale class
The importanceScale class defines an importance scale. It is populated with importanceGrade objects.
Initiated with:
importanceScale:new()
Methods:
importanceScale:setTopGrade
importanceScale:setTopGrade()
Sets a Top importance grade with the default settings. The grade name is set to "top", there is one trigger of "top", and the color is "#ff00ff".
importanceScale:setHighGrade
importanceScale:setHighGrade()
Sets a High importance grade with the default settings. The grade name is set to "high", there is one trigger of "high", and the color is "#ff88ff".
importanceScale:setMidGrade
importanceScale:setMidGrade()
Sets a Mid importance grade with the default settings. The grade name is set to "mid", there is one trigger of "mid", and the color is "#ffbbff".
importanceScale:setLowGrade
importanceScale:setLowGrade()
Sets a Low importance grade with the default settings. The grade name is set to "low", there is one trigger of "low", and the color is "#ffddff".
importanceScale:setBottomGrade
importanceScale:setBottomGrade()
Sets a Bottom importance grade with the default settings. The grade name is set to "bottom", there is one trigger of "bottom", and the color is "#ffeeff".
importanceScale:setNoGrade
importanceScale:setNoGrade()
Sets a No importance grade with the default settings. The grade name is set to "no", there is one trigger of "no", and the color is "#ffffff".
importanceScale:setNaGrade
importanceScale:setNaGrade()
Sets a NA importance grade with the default settings. The grade name is set to "na", there are two triggers of "na" and "n/a", and the color is "#f5f5f5".
importanceScale:setCoreGrade
importanceScale:setCoreGrade()
Sets a Core importance grade with the default settings. The grade name is set to "core", there is one trigger of "core", and the color is "#ff00ff".
importanceScale:setStandardImportanceScale
importanceScale:setStandardImportanceScale()
Sets the standard importance scale of Top, High, Mid, Low, and NA, with the default settings.
assessmentGrade class
The assessmentGrade class defines one grade on an assessment scale (e.g. an FA-class grade on a quality scale, or a top-importance grade on an importance scale).
Initiated with:
assessmentGrade:new()
Methods:
assessmentGrade:setGradeName
assessmentGrade:setGradeName( s )
Sets the name of the assessment grade. For example, for a C-class quality grade, the grade name would be "c".
- Input type: string
assessmentGrade:getGradeName
assessmentGrade:getGradeName()
Gets the name of the assessment grade.
assessmentGrade:addTrigger
assessmentGrade:addTrigger( s )
Adds a trigger for the assessment grade. For example, if you want the grade to be triggered by the code "|class=foo", then the trigger would be "foo".
- Input type: string
assessmentGrade:addTriggers
assessmentGrade:addTriggers( t )
Adds multiple triggers for the assessment grade.
- Input type: array of strings
assessmentGrade:getTriggers
assessmentGrade:getTriggers()
Gets the array of triggers for the assessment grade.
assessmentGrade:setCategory
assessmentGrade:setCategory( s )
Sets the category used by the assessment grade. This should only be used if the category does not follow the default naming system. Normally categories are set by assessmentScale objects or banner objects.
assessmentGrade:getCategory
assessmentGrade:getCategory()
Gets the category for the assessment grade, if one was set with assessmentGrade:setCategory.
assessmentGrade:setColor
assessmentGrade:setColor( s )
Sets the color used for icon boxes etc. used by the assessment grade.
- Input type: string (should be a valid css color value, e.g. '#gg99ff')
assessmentGrade:getColor
assessmentGrade:getColor()
Gets the assessment grade color.
assessmentGrade:setIcon
assessmentGrade:setIcon( s )
Sets the icon for the assessment grade, e.g. the featured article star for featured articles. This is optional - not every assessmentGrade object needs an icon. If specified, it should be a valid file name, without the "File:" prefix.
- Input type: string
assessmentGrade:getIcon
assessmentGrade:getIcon()
Gets the icon file name.
qualityGrade class
The quality grade class defines quality grades on a quality scale. It inherits methods from the assessmentGrade class.
Methods:
All methods from the assessmentGrade class
importanceGrade class
The importanceGrade class defines importance grades on an importance scale. It inherits methods from the assessmentGrade class.
Methods:
All methods from the assessmentGrade class