|
|
(未显示同一用户的13个中间版本) |
第1行: |
第1行: |
| __TOC__ | | __TOC__ |
|
| |
|
| == Parsoid == | | == Language Convert Sync == |
| | [[Help:繁简转换]] |
|
| |
|
| === Parsoid Setup ===
| | <pre> |
| | Mediawiki:Conversiontable/zh-hans |
| | Mediawiki:Conversiontable/zh-hant |
| | Mediawiki:Conversiontable/zh-cn |
| | Mediawiki:Conversiontable/zh-tw |
| | Mediawiki:Conversiontable/zh-sg |
| | Mediawiki:Conversiontable/zh-hk |
| | </pre> |
|
| |
|
| See https://www.mediawiki.org/wiki/Parsoid/Setup | | == Styles Sync == |
| | * Edit [[MediaWiki:Common.css]] |
| | * Edit [[MediaWiki:Mobile.css]] |
| | * See [https://en.wikipedia.org/wiki/MediaWiki:Common.css MediaWiki:Common.css @ Wikipedia] |
|
| |
|
| === Parsoid Init Script === | | == Template Sync == |
| | | * [[Special: 前缀索引]] |
| In <code>/etc/init.d/parsoid</code>:
| | * [[Special: 导入页面]] |
| | | * [https://en.wikipedia.org/wiki/Special:Export Special:Export @ Wikipedia] |
| <syntaxhighlight lang="bash">
| |
| #!/bin/sh
| |
|
| |
| #
| |
| # chkconfig: 35 99 99
| |
| # description: Node.js /home/nodejs/sample/app.js
| |
| # http://drrr.wiki/User:Admin/Wiki_Setup
| |
| #
| |
|
| |
| . /etc/rc.d/init.d/functions
| |
|
| |
| USER="root"
| |
|
| |
| DAEMON="/usr/bin/node"
| |
| ROOT_DIR="/srv/www/drrr.wiki/parsoid"
| |
|
| |
| SERVER="$ROOT_DIR/api/server.js"
| |
| LOG_FILE="$ROOT_DIR/server.log"
| |
|
| |
| LOCK_FILE="/var/lock/subsys/node-server"
| |
|
| |
| do_start() {
| |
| if [ ! -f "$LOCK_FILE" ] ; then
| |
| echo -n $"Starting $SERVER: "
| |
| runuser -l "$USER" -c "$DAEMON $SERVER >> $LOG_FILE &" && echo_success || echo_failure
| |
| RETVAL=$?
| |
| echo
| |
| [ $RETVAL -eq 0 ] && touch $LOCK_FILE
| |
| else
| |
| echo "$SERVER is locked."
| |
| RETVAL=1
| |
| fi
| |
| }
| |
| | |
| do_stop() {
| |
| echo -n $"Stopping $SERVER: "
| |
| pid=`ps -aefw | grep "$DAEMON $SERVER" | grep -v " grep " | awk '{print $2}'`
| |
| kill -9 $pid > /dev/null 2>&1 && echo_success || echo_failure
| |
| RETVAL=$?
| |
| echo
| |
| [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
| |
| }
| |
|
| |
| case "$1" in
| |
| start)
| |
| do_start
| |
| ;;
| |
| stop)
| |
| do_stop
| |
| ;;
| |
| restart)
| |
| do_stop
| |
| do_start
| |
| ;;
| |
| *)
| |
| echo "Usage: $0 {start|stop|restart}"
| |
| RETVAL=1
| |
| esac
| |
|
| |
| exit $RETVAL
| |
| </syntaxhighlight>
| |
| | |
| === Parsoid Configurations ===
| |
| | |
| In <code>./parsoid/api/localsettings.js</code>:
| |
| | |
| <syntaxhighlight lang="javascript">
| |
| /*
| |
| * This is a sample configuration file.
| |
| *
| |
| * Copy this file to localsettings.js and edit that file to fit your needs.
| |
| *
| |
| * Also see the file ParserService.js for more information.
| |
| */
| |
| | |
| exports.setup = function( parsoidConfig ) {
| |
| // The URL of your MediaWiki API endpoint
| |
| //
| |
| // We pre-define wikipedias as 'enwiki', 'dewiki' etc. Similarly for
| |
| // other projects: 'enwiktionary', 'enwikiquote', 'enwikibooks',
| |
| // 'enwikivoyage' etc.
| |
| //
| |
| // Optionally, you can also pass in a proxy specific to this prefix
| |
| // (overrides defaultAPIProxyURI), or null to disable proxying for
| |
| // this end point.
| |
| parsoidConfig.setInterwiki( 'localhost', 'http://localhost:8020/api.php' );
| |
| | |
| // A default proxy to connect to the API endpoints. Default: undefined
| |
| // (no proxying). Overridden by per-wiki proxy config in setInterwiki.
| |
| // parsoidConfig.defaultAPIProxyURI = 'http://proxy.example.org:8080';
| |
| | |
| // Enable debug mode (prints extra debugging messages)
| |
| parsoidConfig.debug = false;
| |
| | |
| // Use the PHP preprocessor to expand templates via the MW API (default true)
| |
| //parsoidConfig.usePHPPreProcessor = false;
| |
| | |
| // Use selective serialization (default false)
| |
| parsoidConfig.useSelser = true;
| |
| | |
| // Allow cross-domain requests to the API (default '*')
| |
| // Sets Access-Control-Allow-Origin header
| |
| // disable:
| |
| //parsoidConfig.allowCORS = false;
| |
| // restrict:
| |
| parsoidConfig.allowCORS = 'drrr.wiki';
| |
| | |
| // Allow override of port/interface:
| |
| //parsoidConfig.serverPort = 8000;
| |
| //parsoidConfig.serverInterface = '127.0.0.1';
| |
| | |
| // The URL of your LintBridge API endpoint
| |
| //parsoidConfig.linterAPI = 'http://lintbridge.wmflabs.org/add';
| |
| };
| |
| </syntaxhighlight>
| |