Changeset 53934 in vbox for trunk/src/VBox/Main/glue
- Timestamp:
- Jan 22, 2015 8:18:04 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/glue/glue-java.xsl
r53922 r53934 132 132 </xsl:template> 133 133 134 135 <xsl:template name="string-replace"> 136 <xsl:param name="haystack"/> 137 <xsl:param name="needle"/> 138 <xsl:param name="replacement"/> 139 <xsl:param name="onlyfirst" select="false"/> 134 <!-- strip-and-normalize-desc 135 Removes leading and trailing white space on each line in the given text. 136 --> 137 <xsl:template name="strip-and-normalize-desc"> 138 <xsl:param name="text"/> 139 140 <!-- Strip the whole string first so we won't leave trailing new line chars behind. --> 141 <xsl:variable name="sStrippedText"> 142 <xsl:call-template name="strip-string"> 143 <xsl:with-param name="text" select="$text"/> 144 </xsl:call-template> 145 </xsl:variable> 146 140 147 <xsl:choose> 141 <xsl:when test="contains($haystack, $needle)"> 142 <xsl:value-of select="substring-before($haystack, $needle)"/> 143 <xsl:value-of select="$replacement"/> 144 <xsl:choose> 145 <xsl:when test="$onlyfirst = 'true'"> 146 <xsl:value-of select="substring-after($haystack, $needle)"/> 147 </xsl:when> 148 <xsl:otherwise> 149 <xsl:call-template name="string-replace"> 150 <xsl:with-param name="haystack" select="substring-after($haystack, $needle)"/> 151 <xsl:with-param name="needle" select="$needle"/> 152 <xsl:with-param name="replacement" select="$replacement"/> 153 </xsl:call-template> 154 </xsl:otherwise> 155 </xsl:choose> 156 </xsl:when> 148 <!-- If there are multiple lines, strip them one by one on a recursive fasion. --> 149 <xsl:when test="contains($sStrippedText, ' ')"> 150 <xsl:call-template name="strip-string-right"> 151 <xsl:with-param name="text" select="substring-before($sStrippedText, ' ')"/> 152 </xsl:call-template> 153 <xsl:value-of select="' '"/> 154 <xsl:call-template name="strip-and-normalize-desc-recursive"> 155 <xsl:with-param name="text" select="substring-after($sStrippedText, ' ')"/> 156 </xsl:call-template> 157 </xsl:when> 158 159 <!-- Single line, we're done. --> 157 160 <xsl:otherwise> 158 <xsl:value-of select="$ haystack"/>161 <xsl:value-of select="$sStrippedText"/> 159 162 </xsl:otherwise> 160 163 </xsl:choose> 161 </xsl:template> 162 163 <xsl:template name="string-trim"> 164 165 </xsl:template> 166 167 <!-- Internal worker for strip-and-normalize-desc, don't use. --> 168 <xsl:template name="strip-and-normalize-desc-recursive"> 164 169 <xsl:param name="text"/> 165 170 166 <xsl:variable name="begin" select="substring($text, 1, 1)"/>167 171 <xsl:choose> 168 <xsl:when test="$begin = ' ' or $begin = ' ' or $begin = ' '"> 169 <xsl:call-template name="string-trim"> 170 <xsl:with-param name="text" select="substring($text, 2)"/> 172 <!-- If there are multiple lines, strip them one by one on a recursive fasion. --> 173 <xsl:when test="contains($text, ' ')"> 174 <xsl:call-template name="strip-string"> 175 <xsl:with-param name="text" select="substring-before($text, ' ')"/> 171 176 </xsl:call-template> 172 </xsl:when> 177 <xsl:value-of select="' '"/> 178 <xsl:call-template name="strip-and-normalize-desc-recursive"> 179 <xsl:with-param name="text" select="substring-after($text, ' ')"/> 180 </xsl:call-template> 181 </xsl:when> 182 183 <!-- Single line: Left strip it. --> 173 184 <xsl:otherwise> 174 <xsl:variable name="end" select="substring($text, string-length($text), 1)"/> 175 <xsl:choose> 176 <xsl:when test="$end = ' ' or $end = ' ' or $end = ' '"> 177 <xsl:call-template name="string-trim"> 178 <xsl:with-param name="text" select="substring($text, 1, string-length($text) - 1)"/> 179 </xsl:call-template> 180 </xsl:when> 181 <xsl:otherwise> 182 <xsl:choose> 183 <xsl:when test="contains($text, ' ')"> 184 <xsl:variable name="tmptext"> 185 <xsl:call-template name="string-replace"> 186 <xsl:with-param name="haystack" select="$text"/> 187 <xsl:with-param name="needle" select="' '"/> 188 <xsl:with-param name="replacement" select="' '"/> 189 </xsl:call-template> 190 </xsl:variable> 191 <xsl:call-template name="string-trim"> 192 <xsl:with-param name="text" select="$tmptext"/> 193 </xsl:call-template> 194 </xsl:when> 195 <xsl:otherwise> 196 <xsl:value-of select="$text"/> 197 </xsl:otherwise> 198 </xsl:choose> 199 </xsl:otherwise> 200 </xsl:choose> 185 <xsl:call-template name="strip-string-left"> 186 <xsl:with-param name="text" select="$text"/> 187 </xsl:call-template> 201 188 </xsl:otherwise> 202 189 </xsl:choose> 190 203 191 </xsl:template> 204 192 … … 256 244 257 245 <xsl:variable name="rep7"> 258 <xsl:call-template name="stri ng-trim">246 <xsl:call-template name="strip-and-normalize-desc"> 259 247 <xsl:with-param name="text" select="$rep6"/> 260 248 </xsl:call-template> … … 336 324 <xsl:template match="link" mode="middle"> 337 325 <xsl:variable name="linktext"> 338 <xsl:call-template name="string-replace ">326 <xsl:call-template name="string-replace-first"> 339 327 <xsl:with-param name="haystack" select="@to"/> 340 328 <xsl:with-param name="needle" select="'_'"/> 341 329 <xsl:with-param name="replacement" select="'#'"/> 342 <xsl:with-param name="onlyfirst" select="'true'"/>343 330 </xsl:call-template> 344 331 </xsl:variable> … … 430 417 --> 431 418 <xsl:template match="desc" mode="begin"> 419 <!-- TODO,XXX: This is a hot spot. The whole $id crap isn't working though, 420 so it's been disabled to save precious time. --> 421 <!-- 432 422 <xsl:param name="id" select="@group | preceding::descGroup[1]/@id"/> 433 423 <xsl:text> /** </xsl:text> … … 435 425 <xsl:value-of select="concat(' @ingroup ', $id, ' ')"/> 436 426 </xsl:if> 427 --> 428 <xsl:value-of select="concat($G_sNewLine, '/**', $G_sNewLine)"/> 437 429 </xsl:template> 438 430
Note:
See TracChangeset
for help on using the changeset viewer.