Module:Layout

Uit Wikibooks
Naar navigatie springen Naar zoeken springen
 Deze module is nog in ontwikkeling en wordt getest.

De Module:Layout is bedoeld om snel, consistent en uitgebreid een pagina op te maken.
Er is een op de module afgestemde handleiding over LUA Scribunto beschikbaar.

De module wordt geïnitialiseerd met de configuratie in Module:Layout/Configuration.

Experimenteren kan in de zandbak of check op scriptfouten in modules.

De module Layout werkt nauw samen met het sjabloon Opmaak. Directe benadering door gebruikers van deze module wordt dan ook ontraden en ook tegengehouden waar mogelijk. Voor het gebruik van de module verwijzen we daarom naar de sjabloonbeschrijving van het sjabloon Opmaak.

Opbouw

Deze module is gebouwd om via een interface de aanroeper door te sturen naar specifieke functionaliteit behorende bij het type Opmaak gegroepeerd onder Module:Layout/System. Onder Module:Layout/Test zijn alle testfuncties gebundeld. De library Module:Layout/Library heeft verzameld alle functies die door meerdere modules worden gebruikt en niet het frame object als input hebben. Alle instellingen zoals de berichten en de structuur van deze module zijn ondergebracht bij Module:Layout/Configuration. Ook is er een ontwikkelomgeving ingericht onder Module:Layout/Sandbox. Samengevat:

Aanroep

De interface van de module vindt men onderin de code en gebeurt via de aanroep {{#invoke:Layout|main|...}} en dan kiest of de gebruiker of het systeem zelf op grond van pagina-eigenschappen welke type pagina het is.

Subpagina's


Tests

OOjs_UI_icon_chem In Module:Layout/Test worden de tests gespecificeerd die hieronder zijn uitgevoerd.

System

N 2 tests mislukt.

Naam Verwacht Werkelijk
N test_System_Book Testing <div>__NOTOC__</div><div style="border-bottom:1px solid grey">Dit boek is in ontwikkeling. Volg de wijzingen door bij elk hoofdstuk op de ster te klikken of gebruik de toetscombinatie [alt+shift+w]</div><div class="noprint"><span><br>Er bestaat nog geen infobox voor dit boek. Klik [[Wikibooks:Infobox/Layout|hier]] om die aan te maken.<br></span></div>FOUT: De waarde <leeg> van de <b>Bron</b> parameter is niet geldig!<div style="-webkit-border-radius:0% 0% 100% 100% / 0% 0% 8px 8px;text-align:center;-webkit-box-shadow:rgba(0, 0, 0,.30) 0 2px 3px"><div style="border-radius:3px/6px;box-shadow:1px 1px 2px #fff inset, -1px -1px 2px #fff inset;border:1px solid #ccc;margin-top:32px;height:auto;margin-bottom:32px;margin:0 auto;background:#cdd9ee"><b>&nbsp;</b></div></div><div style="margin-bottom:32px;text-align:center;margin-top:16px"><i></i></div><div style="width:100%;border-top:20px solid;border-bottom:20px solid;border-image:linear-gradient(to bottom, transparent, #0645ad, transparent) 20"><div style="text-align:center;color:#0645ad;border-top:20px solid linear-gradient(to bottom, transparent, #0645ad);list-style-type:none;border-bottom:20px solid linear-gradient(to top, transparent, #0645ad)">{{Boekenplank/Onderwijs}}</div></div><div style="margin:0 auto;text-align:center"><div>cSFJSHFJSHKJH</div></div><div style="width:100%;border-top:20px solid;border-bottom:20px solid;border-image:linear-gradient(to bottom, transparent, #0645ad, transparent) 20"><div style="text-align:center;color:#0645ad;border-top:20px solid linear-gradient(to bottom, transparent, #0645ad);list-style-type:none;border-bottom:20px solid linear-gradient(to top, transparent, #0645ad)">{{Opmaak/PrefixIndex|title=Vrij leren}}</div></div>FOUT: De waarde <leeg> van de <b>Definitie</b> parameter is niet geldig!FOUT: De waarde <leeg> van de <b>Definitie</b> parameter is niet geldig!
N test_System_Template_usage Lua error -- Module:Layout/Test/System:19: attempt to call field 'book' (a nil value)

Library

Box

N 4 tests mislukt.

Naam Verwacht Werkelijk
N test_Box_Logo Lua error -- Module:Layout/Test/Box:16: attempt to call field 'logo' (a nil value)
N test_Box_Progress Lua error -- Module:Layout/Test/Box:27: attempt to call field 'progress' (a nil value)
N test_Box_Wikijunior Lua error -- Module:Layout/Test/Box:34: attempt to call field 'wikijunior' (a nil value)
N test_Box_Wikipedia Lua error -- Module:Layout/Test/Box:41: attempt to call field 'wikipedia' (a nil value)
Yes test_Box_Wikiproject

Chess

Yes Alle tests zijn ok.

Naam Verwacht Werkelijk
Yes test_Library_Chess_rank
Yes test_Library_Chess_square
Yes test_Library_Chess_square_color

Convert

Yes Alle tests zijn ok.

Naam Verwacht Werkelijk
Yes test_Library_Convert_date_to_age
Yes test_Library_Convert_template_to_table

Mediawiki

Yes Alle tests zijn ok.

Naam Verwacht Werkelijk

Pattern

Yes Alle tests zijn ok.

Naam Verwacht Werkelijk
Yes test_Library_Pattern_content_after_starting_equal_sign
Yes test_Library_Pattern_last_segment_of_url
Yes test_Library_Pattern_paramname
Yes test_Library_Pattern_paramname_and_paramvalue
Yes test_Library_Pattern_paramvalue
Yes test_Library_Pattern_remove_last_segment_from_url
Yes test_Library_Pattern_remove_template_definition
Yes test_Library_Pattern_replace_in_lines_that_start_with_a_character
Yes test_Library_Pattern_replace_inner_pipes
Yes test_Library_Pattern_split_paramname_from_the_rest
Yes test_Library_Pattern_template_definition_at_start_and_end

Extract

Yes Alle tests zijn ok.

Naam Verwacht Werkelijk
Yes test_Library_Extract_content
Yes test_Library_Extract_heading
Yes test_Library_Extract_parameter
Yes test_Library_Extract_template

Validation

Yes Alle tests zijn ok.

Naam Verwacht Werkelijk
Yes test_Library_Validation_mediafile
Yes test_Library_Validation_text


Zie ook

Code



-- All Scribunto libraries are located in the global table mw.
-- All variables of this module should be explicitly scoped as a local variable.
require( "strict" );

-- The configuration data is stored in the CFG variable
local CFG = require( 'Module:Layout/Configuration' );

-- A call to a module uses the parserfunction {{#invoke:...}} where ... is the modulename. In this case Layout.
-- The return value stores the functions which are given as a first argument ... when using {{#invoke:Layout|...}}
-- The variable layout collects these functions.
local layout = {};

-- Functions called by {{#invoke:}} will be passed a frame object as single parameter.
-- In this module only the main function exists and so this module can only be called by {{{{#invoke:Layout|main|...}}.
-- This Frame-object contains the parameters passed to {{#invoke:}}, and can be used to access context-specific features of the wikitext parser.
-- The interface of the Module:Layout validates the call and redirects it to the correct system for further actions.
local interface = CFG.LOAD.INTERFACE();

-- The {{#invoke:Layout|main|...}} call is checked on errors and if so the errors are returned to inform the user if the user has not turned off showing errors.
-- When no errors are found or the user has set to ignore errors, the corresponding system to the call is invoked.
function layout.main( frame )
	local call = interface.call( frame );
	local response = interface.no_response();
	if ( #call.errors == 0 or call.errorhandling == "ignore" ) then response = interface.system( call ); end
	if ( #call.errors > 0 and call.errorhandling == "show"   ) then response = interface.help( call )  ; end
    return response;
end

-- The module returns a Lua table containing the functions that may be called by {{#invoke:}} stored in the variable layout.
return layout;
Informatie afkomstig van https://nl.wikibooks.org Wikibooks NL.
Wikibooks NL is onderdeel van de wikimediafoundation.