r96772 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96771‎ | r96772 | r96773 >
Date:06:16, 11 September 2011
Author:cogden
Status:deferred (Comments)
Tags:
Comment:
Minor formatting and documentation revisions.
Modified paths:
  • /trunk/extensions/WikiCitation/WikiCitation.i18n.magic.php (modified) (history)
  • /trunk/extensions/WikiCitation/WikiCitation.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiCitation/WikiCitation.i18n.magic.php
@@ -132,7 +132,6 @@
133133 'wc_pamphlet' => array( 0, 'pamphlet' ),
134134 'wc_conference_paper' => array( 0, 'conference-paper' ),
135135 'wc_thesis' => array( 0, 'thesis' ),
136 - 'wc_dissertation' => array( 0, 'PhD-dissertation' ),
137136 'wc_report' => array( 0, 'report' ),
138137 'wc_poem' => array( 0, 'poem' ),
139138 'wc_song' => array( 0, 'song' ),
Index: trunk/extensions/WikiCitation/WikiCitation.php
@@ -15,9 +15,14 @@
1616 * <parameters> ::= <parameter>
1717 * | <parameter> "|" <parameters>
1818 * @endcode
 19+ *
 20+ * By default, the first citation to any reference is cited in "long" form, while
 21+ * any subsequent citations are in "short" form. However, "long" and "short" citations
 22+ * can be forced by the use of "long" and "short" as flags.
 23+ *
1924 * The extension also implements the following tag extension (in English):
2025 * @code
21 - * <biblio style="..." type="..."></biblio>
 26+ * <biblio style="..." type="...">...</biblio>
2227 * @endcode
2328 * where the style and type attributes define the citation style (e.g.
2429 * Chicago Manual of style) and type (e.g., author-date). Citations within
@@ -25,6 +30,13 @@
2631 * For more detailed documentation, see the extension's MediaWiki entry at
2732 * http://www.mediawiki.org/wiki/Extension:WikiCitation
2833 *
 34+ * The extension also implements the following tag extension for endnotes:
 35+ * @code
 36+ * <note style="..." type="...">...</note>
 37+ * @endcode
 38+ * where the style and type attributes define the style of citaitons within
 39+ * the endnote. By default, citations within notes follow the "note" style.
 40+ *
2941 * @defgroup WikiCitation
3042 * @author 'COGDEN' and others
3143 * @copyright Copyright (c) 2011 by authors
@@ -57,115 +69,129 @@
5870
5971
6072 $wgExtensionCredits[ 'parserhook' ][] = array(
61 - 'path' => __FILE__,
62 - 'name' => 'WikiCitation',
63 - 'author' => array( 'COGDEN' ),
64 - 'url' => 'http://www.mediawiki.org/wiki/Extension:WikiCitation',
65 - 'descriptionmsg' => 'wc-description',
66 - 'version' => '0.8.1'
 73+ 'path' => __FILE__,
 74+ 'name' => 'WikiCitation',
 75+ 'author' => array( 'COGDEN' ),
 76+ 'url' => 'http://www.mediawiki.org/wiki/Extension:WikiCitation',
 77+ 'descriptionmsg' => 'wc-description',
 78+ 'version' => '0.8.1'
6779 );
6880
6981
7082 /**
7183 * Global settings
7284 */
 85+
 86+/**
 87+ * This variable determines whether citation parameters are validated ( = True )
 88+ * or simply ignored ( = False ).
 89+ * @var boolean
 90+ */
7391 $wikiCitationValidateArguments = False;
7492
75 -$mDir = dirname(__FILE__);
76 -
7793 /**
78 - * Array for defining allowable referencing styles, and setting a default.
 94+ * Setting to define allowable referencing styles, and to set the default style.
7995 *
8096 * Array of recognized children of WCCitation, keyed to magic words used to
81 - * invoke that style. For example, the magic word 'wcChicago'
82 - * ('Chicago' in English) is keyed to the class 'WCChicagoCitation'
 97+ * invoke that style. For example, the magic word 'wc_Chicago'
 98+ * ('Chicago' in English) is keyed to the class 'WCChicagoStyle'
8399 *
84100 * To disallow particular styles, comment them out or remove them from this
85 - * list.
 101+ * list. The magic word 'wc_default' is keyed to the default style.
86102 * @var
87103 */
88104 $wgWCCitationStyles = array(
89 - 'wc_default' => 'WCChicagoStyle', # default style is defined here
90 - 'wc_Chicago' => 'WCChicagoStyle',
91 - 'wc_Bluebook' => 'WCBluebookStyle',
 105+ 'wc_default' => 'WCChicagoStyle', # default style is defined here
 106+ 'wc_Chicago' => 'WCChicagoStyle',
 107+ 'wc_Bluebook' => 'WCBluebookStyle',
92108 );
93109
94 -# Styles
95 -$wgAutoloadClasses['WCChicagoStyle'] = $mDir . '/styles/WCChicagoStyle.php';
96 -$wgAutoloadClasses['WCBluebookStyle'] = $mDir . '/styles/WCBluebookStyle.php';
 110+# Location of the CSS style sheet for this extension
 111+$wgWCStyleSheet = $wgScriptPath . '/extensions/WikiCitation/WikiCitation.css';
97112
98113
99114 /**
100 - * Localization files
 115+ * Autoload classes
101116 */
102 -$wgExtensionMessagesFiles['WikiCitation'] = $mDir . '/WikiCitation.i18n.php';
103 -$wgExtensionMessagesFiles['WikiCitationMagic'] = $mDir . '/WikiCitation.i18n.magic.php';
 117+$mDir = dirname(__FILE__);
104118
105 -/**
106 - * Autoload classes
107 - */
108119 # main directory
109 -$wgAutoloadClasses['WikiCitation'] = $mDir . '/WikiCitation.body.php';
 120+$wgAutoloadClasses['WikiCitation'] = $mDir . '/WikiCitation.body.php';
110121
 122+# Styles
 123+$wgAutoloadClasses['WCChicagoStyle'] = $mDir . '/styles/WCChicagoStyle.php';
 124+$wgAutoloadClasses['WCBluebookStyle'] = $mDir . '/styles/WCBluebookStyle.php';
 125+
111126 # includes
112 -$wgAutoloadClasses['WCArgumentReader'] = $mDir . '/includes/WCArgumentReader.php';
113 -$wgAutoloadClasses['WCArticle'] = $mDir . '/includes/WCArticle.php';
114 -$wgAutoloadClasses['WCBibliography'] = $mDir . '/includes/WCBibliography.php';
115 -$wgAutoloadClasses['WCCitation'] = $mDir . '/includes/WCCitation.php';
116 - $wgAutoloadClasses['WCCitationPosition'] = $mDir . '/includes/WCCitation.php';
117 -$wgAutoloadClasses['WCEnum'] = $mDir . '/includes/WCEnum.php';
118 -$wgAutoloadClasses['WCException'] = $mDir . '/includes/WCException.php';
119 -$wgAutoloadClasses['WCNote'] = $mDir . '/includes/WCNote.php';
120 -$wgAutoloadClasses['WCReference'] = $mDir . '/includes/WCReference.php';
121 -$wgAutoloadClasses['WCReferenceStore'] = $mDir . '/includes/WCReferenceStore.php';
122 -$wgAutoloadClasses['WCSection'] = $mDir . '/includes/WCSection.php';
123 -$wgAutoloadClasses['WCStyle'] = $mDir . '/includes/WCStyle.php';
 127+$wgAutoloadClasses['WCArgumentReader'] = $mDir . '/includes/WCArgumentReader.php';
 128+$wgAutoloadClasses['WCArticle'] = $mDir . '/includes/WCArticle.php';
 129+$wgAutoloadClasses['WCBibliography'] = $mDir . '/includes/WCBibliography.php';
 130+$wgAutoloadClasses['WCCitation'] = $mDir . '/includes/WCCitation.php';
 131+ $wgAutoloadClasses['WCCitationPosition'] = $mDir . '/includes/WCCitation.php';
 132+$wgAutoloadClasses['WCEnum'] = $mDir . '/includes/WCEnum.php';
 133+$wgAutoloadClasses['WCException'] = $mDir . '/includes/WCException.php';
 134+$wgAutoloadClasses['WCNote'] = $mDir . '/includes/WCNote.php';
 135+$wgAutoloadClasses['WCReference'] = $mDir . '/includes/WCReference.php';
 136+$wgAutoloadClasses['WCReferenceStore'] = $mDir . '/includes/WCReferenceStore.php';
 137+$wgAutoloadClasses['WCSection'] = $mDir . '/includes/WCSection.php';
 138+$wgAutoloadClasses['WCStyle'] = $mDir . '/includes/WCStyle.php';
124139
125140 # data
126 -$wgAutoloadClasses['WCData'] = $mDir . '/includes/data/WCData.php';
127 -$wgAutoloadClasses['WCDate'] = $mDir . '/includes/data/WCDate.php';
128 -$wgAutoloadClasses['WCLocator'] = $mDir . '/includes/data/WCLocator.php';
129 -$wgAutoloadClasses['WCName'] = $mDir . '/includes/data/WCName.php';
130 -$wgAutoloadClasses['WCNames'] = $mDir . '/includes/data/WCNames.php';
131 -$wgAutoloadClasses['WCTypeData'] = $mDir . '/includes/data/WCTypeData.php';
132 -$wgAutoloadClasses['WCText'] = $mDir . '/includes/data/WCText.php';
133 -$wgAutoloadClasses['WCTitle'] = $mDir . '/includes/data/WCTitle.php';
134 -$wgAutoloadClasses['WCTitleFormat'] = $mDir . '/includes/data/WCTitle.php';
 141+$wgAutoloadClasses['WCData'] = $mDir . '/includes/data/WCData.php';
 142+$wgAutoloadClasses['WCDate'] = $mDir . '/includes/data/WCDate.php';
 143+$wgAutoloadClasses['WCLocator'] = $mDir . '/includes/data/WCLocator.php';
 144+$wgAutoloadClasses['WCName'] = $mDir . '/includes/data/WCName.php';
 145+$wgAutoloadClasses['WCNames'] = $mDir . '/includes/data/WCNames.php';
 146+$wgAutoloadClasses['WCTypeData'] = $mDir . '/includes/data/WCTypeData.php';
 147+$wgAutoloadClasses['WCText'] = $mDir . '/includes/data/WCText.php';
 148+$wgAutoloadClasses['WCTitle'] = $mDir . '/includes/data/WCTitle.php';
 149+$wgAutoloadClasses['WCTitleFormat'] = $mDir . '/includes/data/WCTitle.php';
135150
136151 # parameters
137 -$wgAutoloadClasses['WCAttributeEnum'] = $mDir . '/includes/parameters/WCAttributeEnum.php';
138 -$wgAutoloadClasses['WCCitationLengthEnum'] = $mDir . '/includes/parameters/WCCitationLengthEnum.php';
139 -$wgAutoloadClasses['WCCitationTypeEnum'] = $mDir . '/includes/parameters/WCCitationTypeEnum.php';
140 -$wgAutoloadClasses['WCDateTermsEnum'] = $mDir . '/includes/parameters/WCDateTermsEnum.php';
141 -$wgAutoloadClasses['WCNamePartEnum'] = $mDir . '/includes/parameters/WCNamePartEnum.php';
142 -$wgAutoloadClasses['WCNameTypeEnum'] = $mDir . '/includes/parameters/WCNameTypeEnum.php';
143 -$wgAutoloadClasses['WCParameterEnum'] = $mDir . '/includes/parameters/WCParameterEnum.php';
144 -$wgAutoloadClasses['WCPropertyEnum'] = $mDir . '/includes/parameters/WCPropertyEnum.php';
145 -$wgAutoloadClasses['WCScopeEnum'] = $mDir . '/includes/parameters/WCScopeEnum.php';
146 -$wgAutoloadClasses['WCSourceTypeEnum'] = $mDir . '/includes/parameters/WCSourceTypeEnum.php';
 152+$wgAutoloadClasses['WCAttributeEnum'] = $mDir . '/includes/parameters/WCAttributeEnum.php';
 153+$wgAutoloadClasses['WCCitationLengthEnum'] = $mDir . '/includes/parameters/WCCitationLengthEnum.php';
 154+$wgAutoloadClasses['WCCitationTypeEnum'] = $mDir . '/includes/parameters/WCCitationTypeEnum.php';
 155+$wgAutoloadClasses['WCDateTermsEnum'] = $mDir . '/includes/parameters/WCDateTermsEnum.php';
 156+$wgAutoloadClasses['WCNamePartEnum'] = $mDir . '/includes/parameters/WCNamePartEnum.php';
 157+$wgAutoloadClasses['WCNameTypeEnum'] = $mDir . '/includes/parameters/WCNameTypeEnum.php';
 158+$wgAutoloadClasses['WCParameterEnum'] = $mDir . '/includes/parameters/WCParameterEnum.php';
 159+$wgAutoloadClasses['WCPropertyEnum'] = $mDir . '/includes/parameters/WCPropertyEnum.php';
 160+$wgAutoloadClasses['WCScopeEnum'] = $mDir . '/includes/parameters/WCScopeEnum.php';
 161+$wgAutoloadClasses['WCSourceTypeEnum'] = $mDir . '/includes/parameters/WCSourceTypeEnum.php';
147162
148163 # segments
149 -$wgAutoloadClasses['WCAlternativeSegment'] = $mDir . '/includes/segments/WCAlternativeSegment.php';
150 -$wgAutoloadClasses['WCConditionalSegment'] = $mDir . '/includes/segments/WCConditionalSegment.php';
151 -$wgAutoloadClasses['WCDataSegment'] = $mDir . '/includes/segments/WCDataSegment.php';
152 -$wgAutoloadClasses['WCDateSegment'] = $mDir . '/includes/segments/WCDateSegment.php';
153 -$wgAutoloadClasses['WCGroupSegment'] = $mDir . '/includes/segments/WCGroupSegment.php';
154 -$wgAutoloadClasses['WCLabelFormEnum'] = $mDir . '/includes/segments/WCLabelSegment.php';
155 -$wgAutoloadClasses['WCLabelSegment'] = $mDir . '/includes/segments/WCLabelSegment.php';
156 -$wgAutoloadClasses['WCLiteralSegment'] = $mDir . '/includes/segments/WCLiteralSegment.php';
157 -$wgAutoloadClasses['WCLocatorSegment'] = $mDir . '/includes/segments/WCLocatorSegment.php';
158 -$wgAutoloadClasses['WCNamesSegment'] = $mDir . '/includes/segments/WCNamesSegment.php';
159 -$wgAutoloadClasses['WCSegment'] = $mDir . '/includes/segments/WCSegment.php';
160 -$wgAutoloadClasses['WCTextSegment'] = $mDir . '/includes/segments/WCTextSegment.php';
161 -$wgAutoloadClasses['WCTitleSegment'] = $mDir . '/includes/segments/WCTitleSegment.php';
162 -$wgAutoloadClasses['WCWrapperSegment'] = $mDir . '/includes/segments/WCWrapperSegment.php';
 164+$wgAutoloadClasses['WCAlternativeSegment'] = $mDir . '/includes/segments/WCAlternativeSegment.php';
 165+$wgAutoloadClasses['WCConditionalSegment'] = $mDir . '/includes/segments/WCConditionalSegment.php';
 166+$wgAutoloadClasses['WCDataSegment'] = $mDir . '/includes/segments/WCDataSegment.php';
 167+$wgAutoloadClasses['WCDateSegment'] = $mDir . '/includes/segments/WCDateSegment.php';
 168+$wgAutoloadClasses['WCGroupSegment'] = $mDir . '/includes/segments/WCGroupSegment.php';
 169+$wgAutoloadClasses['WCLabelFormEnum'] = $mDir . '/includes/segments/WCLabelSegment.php';
 170+$wgAutoloadClasses['WCLabelSegment'] = $mDir . '/includes/segments/WCLabelSegment.php';
 171+$wgAutoloadClasses['WCLiteralSegment'] = $mDir . '/includes/segments/WCLiteralSegment.php';
 172+$wgAutoloadClasses['WCLocatorSegment'] = $mDir . '/includes/segments/WCLocatorSegment.php';
 173+$wgAutoloadClasses['WCNamesSegment'] = $mDir . '/includes/segments/WCNamesSegment.php';
 174+$wgAutoloadClasses['WCSegment'] = $mDir . '/includes/segments/WCSegment.php';
 175+$wgAutoloadClasses['WCTextSegment'] = $mDir . '/includes/segments/WCTextSegment.php';
 176+$wgAutoloadClasses['WCTitleSegment'] = $mDir . '/includes/segments/WCTitleSegment.php';
 177+$wgAutoloadClasses['WCWrapperSegment'] = $mDir . '/includes/segments/WCWrapperSegment.php';
163178
164 -# Set up parser hooks
165 -$wgHooks[ 'ParserFirstCallInit' ][] = 'WikiCitation::onParserFirstCallInit';
166 -$wgHooks[ 'ParserClearState' ][] = 'WikiCitation::onParserClearState';
167 -$wgHooks[ 'ParserBeforeTidy' ][] = 'WikiCitation::onParserBeforeTidy';
168179
169 -# Location of the CSS style sheet for this extension
170 -$wgWCStyleSheet = $wgScriptPath . '/extensions/WikiCitation/WikiCitation.css';
 180+/**
 181+ * Localization files
 182+ */
 183+$wgExtensionMessagesFiles['WikiCitation'] = $mDir . '/WikiCitation.i18n.php';
 184+$wgExtensionMessagesFiles['WikiCitationMagic'] = $mDir . '/WikiCitation.i18n.magic.php';
171185
 186+
 187+/**
 188+ * Set up parser hooks.
 189+ */
 190+$wgHooks[ 'ParserFirstCallInit' ][] = 'WikiCitation::onParserFirstCallInit';
 191+$wgHooks[ 'ParserClearState' ][] = 'WikiCitation::onParserClearState';
 192+$wgHooks[ 'ParserBeforeTidy' ][] = 'WikiCitation::onParserBeforeTidy';
 193+
 194+
 195+/**
 196+ * Set up parser test file.
 197+ */
172198 #$wgParserTestFiles[] = $mDir . "/WikiCitationTests.txt";

Comments

#Comment by Nikerabbit (talk | contribs)   10:15, 11 September 2011
+/**
+ * Set up parser hooks.
+ */
+$wgHooks[ 'ParserFirstCallInit' ][] = 'WikiCitation::onParserFirstCallInit';
+$wgHooks[ 'ParserClearState' ][] = 'WikiCitation::onParserClearState';
+$wgHooks[ 'ParserBeforeTidy' ][] = 'WikiCitation::onParserBeforeTidy';

If you do it like that, doxygen will display the comment only for the first line. Looks for includes/DefaultSettings.php how to document blocks of configuration code. Usually this kind of code is just hidden behind @cond file_level_code, with normal comments inside.


Was the removal of wc_dissertation intended?

#Comment by COGDEN (talk | contribs)   18:24, 14 September 2011

I appreciate your comment. I'll take another look at the documentation.

"wc_dissertation" was intentionally removed because as yet it is not used. For the time being at least, I wanted to make this file consistent with "WCChicagoStyle.php".

Status & tagging log