Difference between revisions of "User:Paxed/src geshi test"

From NetHackWiki
Jump to navigation Jump to search
m (test)
m (test)
Line 22: Line 22:
 
         dropy(obj);
 
         dropy(obj);
 
}
 
}
 +
</syntaxhighlight>
 +
 +
And another test:
 +
<syntaxhighlight code="php" line lineid="line" start="43">
 +
                $lang = strtolower( $lang );
 +
                if( !preg_match( '/^[a-z_0-9-]*$/', $lang ) ) {
 +
                        $error = self::formatError( htmlspecialchars( wfMsgForContent( 'syntaxhighlight-err-language' ) ) );
 +
                        wfProfileOut( __METHOD__ );
 +
                        return $error;
 +
                }                               
 +
                $geshi = self::prepare( $text, $lang );
 +
                if( !$geshi instanceof GeSHi ) {
 +
                        $error = self::formatError( htmlspecialchars( wfMsgForContent( 'syntaxhighlight-err-language' ) ) );
 +
                        wfProfileOut( __METHOD__ );
 +
                        return $error;
 +
                }
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 11:00, 14 November 2010

This is a test of tiny highlight-extension modification:

/* Called in several places - may produce output */
/* eg ship_object() and dropy() -> sellobj() both produce output */
void
dropx(obj)
register struct obj *obj;
{
#ifndef GOLDOBJ
        if (obj->oclass != COIN_CLASS || obj == invent) freeinv(obj);
#else
        /* Ensure update when we drop gold objects */
        if (obj->oclass == COIN_CLASS) flags.botl = 1;
        freeinv(obj);
#endif
        if (!u.uswallow) {
            if (ship_object(obj, u.ux, u.uy, FALSE)) return;
            if (IS_ALTAR(levl[u.ux][u.uy].typ))
                doaltarobj(obj); /* set bknown */
        }
        dropy(obj);
}

And another test:

                $lang = strtolower( $lang );
                if( !preg_match( '/^[a-z_0-9-]*$/', $lang ) ) {
                        $error = self::formatError( htmlspecialchars( wfMsgForContent( 'syntaxhighlight-err-language' ) ) );
                        wfProfileOut( __METHOD__ );
                        return $error;
                }                                 
                $geshi = self::prepare( $text, $lang );
                if( !$geshi instanceof GeSHi ) {
                        $error = self::formatError( htmlspecialchars( wfMsgForContent( 'syntaxhighlight-err-language' ) ) );
                        wfProfileOut( __METHOD__ );
                        return $error;
                }