makeStaticLoader: Incorporate hardcoded changes and re-sync

Follows-up 2e76271 and 231a50f which made manual changes to
the static-loading files without updating makeStaticLoader
(thus causing the load order and if-statement to be out of
sync between different index.php files).

Updating makeStaticLoader to include those changes and applying
it to the other index.php file.

Change-Id: I9bbe97d85f663b1cffeb384d52b5cc54e2f6601b
This commit is contained in:
Timo Tijhof 2013-05-31 01:10:43 +01:00
parent 3dfc960576
commit 1b9637123f
3 changed files with 55 additions and 18 deletions

View file

@ -280,7 +280,6 @@ $html = file_get_contents( $page );
<script src="../../modules/ve/ui/dialogs/ve.ui.ContentDialog.js"></script>
<script src="../../modules/ve/ui/dialogs/ve.ui.MediaDialog.js"></script>
<script src="../../modules/ve/ui/dialogs/ve.ui.PagedDialog.js"></script>
<script src="../../modules/ve/ui/dialogs/ve.ui.MWMetaDialog.js"></script>
<script src="../../modules/ve/ui/tools/ve.ui.ButtonTool.js"></script>
<script src="../../modules/ve/ui/tools/ve.ui.AnnotationButtonTool.js"></script>
<script src="../../modules/ve/ui/tools/ve.ui.DialogButtonTool.js"></script>
@ -317,6 +316,7 @@ $html = file_get_contents( $page );
<script src="../../modules/ve/ce/nodes/ve.ce.MWTemplateNode.js"></script>
<script src="../../modules/ve/ce/nodes/ve.ce.MWReferenceListNode.js"></script>
<script src="../../modules/ve/ce/nodes/ve.ce.MWReferenceNode.js"></script>
<script src="../../modules/ve/ui/dialogs/ve.ui.MWMetaDialog.js"></script>
<script src="../../modules/ve/ui/tools/buttons/ve.ui.MWMetaButtonTool.js"></script>
<script src="../../modules/ve/ui/tools/buttons/ve.ui.MWReferenceButtonTool.js"></script>
<script src="../../modules/ve/ui/tools/buttons/ve.ui.MWTemplateButtonTool.js"></script>

View file

@ -3,7 +3,7 @@ $IP = getenv( 'MW_INSTALL_PATH' );
if ( $IP === false ) {
$IP = __DIR__ . '/../../..';
}
require_once( $IP . '/maintenance/Maintenance.php' );
require_once $IP . '/maintenance/Maintenance.php';
/**
* A generator for creating a static HTML loading sequence
@ -22,12 +22,37 @@ class MakeStaticLoader extends Maintenance {
public function __construct() {
parent::__construct();
$this->addOption( 'target', 'Which target to use ("demo" or "test"). Default: demo', false, true );
$this->addOption( 'indent', 'Indentation prefix to use (number of tabs or a string)', false, true );
$this->addOption( 've-path', 'Override path to "VisualEditor/modules" (no trailing slash). Default by --target', false, true );
$this->addOption( 'write-file', 'Automatically replace the "Generated by" sections in this file. Default: false', false, true );
$this->addOption( 'fixdir', 'Embed the absolute path in require() statements. Defaults to relative path. '
. '(use this if you evaluate the resulting script in php-STDIN instead of from a file)', false, true );
$this->addOption(
'target',
'Which target to use ("demo" or "test"). Default: demo',
false,
true
);
$this->addOption(
'indent',
'Indentation prefix to use (number of tabs or a string)',
false,
true
);
$this->addOption(
've-path',
'Override path to "VisualEditor/modules" (no trailing slash). Default by --target',
false,
true
);
$this->addOption(
'write-file',
'Automatically replace the "Generated by" sections in this file. Default: false',
false,
true
);
$this->addOption(
'fixdir',
'Embed the absolute path in require() statements. Defaults to relative path. '
. '(use this if you evaluate the resulting script in php-STDIN instead of from a file)',
false,
true
);
$this->addOption( 'section', 'head, body or both', false, true );
}
@ -80,16 +105,25 @@ class MakeStaticLoader extends Maintenance {
've/init/sa/styles/ve.init.sa.css',
),
'headAdd' => '<script>
if ( document.createElementNS && document.createElementNS( \'http://www.w3.org/2000/svg\', \'svg\' ).createSVGRect ) {
document.write( \'<link rel="stylesheet" href="' . $vePath . '/ve/ui/styles/ve.ui.Icons-vector.css">\' );
if (
document.createElementNS &&
document.createElementNS( \'http://www.w3.org/2000/svg\', \'svg\' ).createSVGRect
) {
document.write(
\'<link rel="stylesheet" \' +
\'href="' . $vePath . '/ve/ui/styles/ve.ui.Icons-vector.css">\'
);
} else {
document.write( \'<link rel="stylesheet" href="' . $vePath . '/ve/ui/styles/ve.ui.Icons-raster.css">\' );
document.write(
\'<link rel="stylesheet" \' +
\'href="' . $vePath . '/ve/ui/styles/ve.ui.Icons-raster.css">\'
);
}
</script>',
'bodyAdd' => '<script>
<?php
require( ' . var_export( $i18nScript, true ) . ' );
echo \'ve.init.platform.addMessages( \' . json_encode( $messages[\'en\'] ) . \');\' . "\n";
require ' . var_export( $i18nScript, true ) . ';
echo \'ve.init.platform.addMessages( \' . json_encode( $messages[\'en\'] ) . " );\n";
?>
ve.init.platform.setModulesUrl( \'' . $vePath . '\' );
</script>'
@ -126,7 +160,10 @@ class MakeStaticLoader extends Maintenance {
if ( isset( $registry['styles'] ) && $target !== 'test' ){
foreach ($registry['styles'] as $style) {
$headAdd .= $indent . Html::element( 'link', array( 'rel' => 'stylesheet', 'href' => "$vePath/$style" ) ) . "\n";
$headAdd .= $indent . Html::element( 'link', array(
'rel' => 'stylesheet',
'href' => "$vePath/$style",
) ) . "\n";
}
}
if ( isset( $registry['scripts'] ) ) {
@ -237,4 +274,4 @@ class MakeStaticLoader extends Maintenance {
}
$maintClass = 'MakeStaticLoader';
require_once( RUN_MAINTENANCE_IF_MAIN );
require_once RUN_MAINTENANCE_IF_MAIN;

View file

@ -51,8 +51,8 @@
<script src="../../ve/ve.debug.js"></script>
<script>
<?php
require ( '../../../VisualEditor.i18n.php' );
echo 've.init.platform.addMessages( ' . json_encode( $messages['en'] ) . ");\n";
require '../../../VisualEditor.i18n.php';
echo 've.init.platform.addMessages( ' . json_encode( $messages['en'] ) . " );\n";
?>
ve.init.platform.setModulesUrl( '../..' );
</script>
@ -233,7 +233,6 @@
<script src="../../ve/ui/dialogs/ve.ui.ContentDialog.js"></script>
<script src="../../ve/ui/dialogs/ve.ui.MediaDialog.js"></script>
<script src="../../ve/ui/dialogs/ve.ui.PagedDialog.js"></script>
<script src="../../ve/ui/dialogs/ve.ui.MWMetaDialog.js"></script>
<script src="../../ve/ui/tools/ve.ui.ButtonTool.js"></script>
<script src="../../ve/ui/tools/ve.ui.AnnotationButtonTool.js"></script>
<script src="../../ve/ui/tools/ve.ui.DialogButtonTool.js"></script>
@ -270,6 +269,7 @@
<script src="../../ve/ce/nodes/ve.ce.MWTemplateNode.js"></script>
<script src="../../ve/ce/nodes/ve.ce.MWReferenceListNode.js"></script>
<script src="../../ve/ce/nodes/ve.ce.MWReferenceNode.js"></script>
<script src="../../ve/ui/dialogs/ve.ui.MWMetaDialog.js"></script>
<script src="../../ve/ui/tools/buttons/ve.ui.MWMetaButtonTool.js"></script>
<script src="../../ve/ui/tools/buttons/ve.ui.MWReferenceButtonTool.js"></script>
<script src="../../ve/ui/tools/buttons/ve.ui.MWTemplateButtonTool.js"></script>