Wikifi your Mux's Help & News Files like a Fucking Pro


  • Coder

    ("Pro" status not guaranteed.)

    Finally! @Chime started it, because she is the most tits-up awesome coder Mu*ing's had since Myrddin. She didn't let me break it, but she did say, "If you want to work on it, eh, whatever," which I took as extreme excitement that someone is going to package her hard work.

    And so here it is.

    This is designed for a straight-up copy into Muxify then drop the results onto your game.

    However, your game probably doesn't have In-line SQL enabled. It might not even have Myrd's Mushcron. If it doesn't have these things it will install, but trying to use it will fail.

    This does not have a tutorial on how to get these things going, but if you post here someone may be able to solve your dilemma. I will try to help.

    If you have these two things, though, you're still not done. You want to read the Setup Help at the end and make sure that's done, as well. It involves access to your wiki's files directly, which you probably have if you have a wiki.

    Questions or comments welcome and expected.


  • Coder

    Current bug:

    ==== Basic Commands ==== has turned into:

     Basic Commands3020 
    

    Formatting is correct, but "3020" is the namespace of our help files. Interesting. Will update when fixed.


  • Coder

    Issue found and fixed. If you used this code already, copy the following to your newshelp object:

    &CMD.WIKI.NEWSHELP Wiki News and Help <wnh>=$^(\+?news|\+help)( ([- !(),./;?_A-Za-z0-9]+))?$:@break eq( strlen( %3 ), 0 )={ @pemit %#=u( display.index, trim( %1, l, + ))}; think strcat( qn:%b, setr( n, v( namespace.[trim( %1, l, + )] )), %r, q1:%b, setr( 1, u( f.clean.query, %qn, edit( %3, %b, _ ))), %r, qt:%b, setr( t, edit( first( %q1, ^ ), _, %b )), %r, qm:%b, setr( m, elements( %q1, 2, ^ )), %r, qc:%b, setr( c, elements( %q1, 3, ^ )), %r, wdivider(), %r, ); @assert t( %q1 )={ @pemit %#=u( .msg, lcstr( %1 ), Unknown page. ) }; @pemit %#=[u( .wheader, cat( capstr( lcstr( trim( %1, l, + ))), for %qt ))]%r; @pemit %#=s( iter( trim( translate( s( %qc ), p ), b, lit( %r )), [setq( z, regmatchi( %i0, (.)(.*), z a b ))][setq( b, s( %qb ))][case( %qa, :, translate( u( wiki.block-quote, %qb ), p ), %b, translate( u( wiki.block-quote, trim( %qb )), p ), %;, translate( u( wiki.definition-block, %qb ), p ), *, translate( u( wiki.bullet-point, %qb ), p ), -, if( strmatch( %i0, ---- ), u( wiki.horizontal-rule ), %i0 ), =, if( regmatch( %i0, (=+)(.*?)(=+), z y x w ), strcat( translate( udefault( wiki.h[strlen( %qy )], u( wiki.h5, trim( %qx )), trim( %qx )), p ), %xn )), ', if( regmatch( %i0, (''+)(.*?)(\\1)(.*), z y x w v ), switch( strlen( %qy ), <3, [translate( u( wiki.italics, %qx ), p )]%xn%qv, <5, [translate( u( wiki.bold, %qx ), p )]%xn%qv, <6, [translate( u( wiki.bold-italics, %qx ), p )]%xn%qv, %i0 ), %i0 ), , %%b, %i0 )]%%xn, lit( %r ), lit( %r ))); @pemit %#={%r[u( .wfooter, u( display.footer, %qm ))]}; 
    

    Sorry for the oversight.


  • Coder

    % and similar was evaluating on the game. This was giving amusing results for %L in a help file, that's for damned sure. It has been fixed. Proper code follows:

    &f.clean.query Wiki News and Help <wnh>=
      edit( 
    		sql( u( query.newshelp, %0, %1 ), %r, ^ ), 
    		\%, \\\%, 
    		[[News:, \%xhnews%b, 
    		[[Help:, \%xh+help%b, 
    		[[Category:, Category:%b,
    		]], \%xn, 
    		[, \\[, 
    		], \\] 
    	)
    

    Sorry about that. Thanks.


  • Coder

    Updated this for two reasons.

    1. Different wiki installs have different prefixes. Allowed easily changing the prefix from 'wiki_' to whatever.

    2. The latest versions of MediaWiki messed up the ability to do case-insensitive page_title searches from the Mu*. Fixed that.

    Enjoy.