扩展:ActiveAbstract

From mediawiki.org
This page is a translated version of the page Extension:ActiveAbstract and the translation is 27% complete.
MediaWiki扩展手册
ActiveAbstract
发行状态: 稳定版
实现 扩展语法
描述 Generate an XML feed for Yahoo's Active Abstracts project
作者 Brooke Vibber留言
兼容性政策 快照跟随MediaWiki发布。 master分支不向后兼容。
MediaWiki 1.25+
许可协议 GNU通用公眾授權條款2.0或更新版本
下載
季度下載量 9 (Ranked 140th)
前往translatewiki.net翻譯ActiveAbstract扩展
問題 开启的任务 · 报告错误

This extension is used with XML dumps to pull a formatted copy of an article's initial text and its organizational structure. It is one of the filters available for the backup system.

It will pull the first two sentences of the article along with each section heading and wrap them in XML tags and trim the entry to be no longer than 1024 characters.

安裝

  • 下载文件,并将其放置在您extensions/文件夹中的ActiveAbstract目录内。
    开发者和代码贡献人员应从Git安装扩展,输入:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/ActiveAbstract
  • 将下列代码放置在您的LocalSettings.php 的底部:
    wfLoadExtension( 'ActiveAbstract' );
    
  • Yes 完成 – 在您的wiki上导航至Special:Version,以验证已成功安装扩展。

参数

ActiveAbstract is run as a plugin for dumpBackup.php:

 php dumpBackup.php \
   --plugin=AbstractFilter:extensions/ActiveAbstract/AbstractFilter.php \
   --current \
   --output=gzip:/dumps/abstract.xml.gz \
     --filter=namespace:NS_MAIN \
     --filter=noredirect \
     --filter=abstract

位于:

  • current - pulls only the latest article revision
  • output - sets where the output stream will go
  • filters
    • namespace - only pull documents from this namespace
    • noredirect - don't show redirects
    • abstract - registers the abstracts filter and runs it from within dumpBackup.php
    • variants - if variants exist, pull all latest copies and output them to a separate abstracts file

It can optionally convert output text to a given language variant:

   --filter=abstract:variant=zh-cn

A possible way to run this in production would be

/usr/bin/php -q /apache/common/php-1.5/maintenance/dumpBackup.php   --wiki='quwiki' \
   --plugin=AbstractFilter:/apache/common/php-1.5/extensions/ActiveAbstract/AbstractFilter.php \
   --current   --report=1000   --force-normal   --server='x.x.x.x'  \
   --output=file:/mnt/dumps/public/quwiki/20090613/quwiki-20090613-abstract.xml  \
   --filter=namespace:NS_MAIN     --filter=noredirect     --filter=abstract
force-normal is added for better UTF-8 conversion.

格式化

The required tags for each entry are:

  • doc
  • title
  • url
  • abstract
  • links
  • sublink

示例表

<doc>
	<title>Wikipedia: An American in Paris</title>
	<url>http://en.wikipedia.org/wiki/An_American_in_Paris</url>
	<abstract>An American in Paris is a symphonic composition by American composer George Gershwin, composed in 1928. Inspired .. </abstract>
	<links>
		<sublink linktype="nav"><anchor>Instrumentation</anchor><link>http://en.wikipedia.org/wiki/An_American_in_Paris#Instrumentation</link></sublink>
		<sublink linktype="nav"><anchor>Recordings</anchor><link>http://en.wikipedia.org/wiki/An_American_in_Paris#Recordings</link></sublink>
		<sublink linktype="nav"><anchor>Film</anchor><link>http://en.wikipedia.org/wiki/An_American_in_Paris#Film</link></sublink>
	</links>
</doc>
The ‎<abstract> text is trimmed to not run off this wiki page.