Extension:Proofread Page

From MediaWiki.org
(Redirected from Extension:ProofreadPage)
Jump to navigation Jump to search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.svg
Proofread Page

Release status:Extension status stable

Proofread Page editor.png
ImplementationTemplate:Extension#type Page action, ContentHandler, Tag, API, Database
DescriptionTemplate:Extension#description The Proofread Page extension can render a book either as a column of OCR text beside a column of scanned images, or broken into its logical organization (such as chapters or poems) using transclusion.
Author(s)Template:Extension#username ThomasV (original author)
Tpt (current maintainer)
Latest versionTemplate:Extension#version continuous updates
Compatibility policyCompatibility#mediawiki_extensions release branches
MediaWikiTemplate:Extension#mediawiki current master
PHPTemplate:Extension#php 7.0+
Database changesTemplate:Extension#needs-updatephp Yes
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download
ExampleTemplate:Extension#example s:Index:Wind in the Willows (1913).djvu
NamespaceTemplate:Extension#namespace

Page, Index

ParametersTemplate:Extension#parameters
*$wgProofreadPageNamespaceIds
  • $wgProofreadPagePageSeparator
  • $wgProofreadPagePageJoiner
  • $wgProofreadPagePageSeparatorPlaceholder
Added rightsTemplate:Extension#rights
pagequality
Hooks usedTemplate:Extension#hook
SetupAfterCacheManual:Hooks/SetupAfterCache
ParserFirstCallInitManual:Hooks/ParserFirstCallInit
BeforePageDisplayManual:Hooks/BeforePageDisplay
GetLinkColoursManual:Hooks/GetLinkColours
ImageOpenShowImageInlineBeforeManual:Hooks/ImageOpenShowImageInlineBefore
ArticleSaveCompleteManual:Hooks/ArticleSaveComplete
ArticleDeleteManual:Hooks/ArticleDelete
ArticleUndeleteManual:Hooks/ArticleUndelete
ArticlePurgeManual:Hooks/ArticlePurge
SpecialMovepageAfterMoveManual:Hooks/SpecialMovepageAfterMove
LoadExtensionSchemaUpdatesManual:Hooks/LoadExtensionSchemaUpdates
OutputPageParserOutputManual:Hooks/OutputPageParserOutput
wgQueryPagesManual:Hooks/wgQueryPages
GetPreferencesManual:Hooks/GetPreferences
CustomEditorManual:Hooks/CustomEditor
CanonicalNamespacesManual:Hooks/CanonicalNamespaces
SkinTemplateNavigationManual:Hooks/SkinTemplateNavigation
ContentHandlerDefaultModelForManual:Hooks/ContentHandlerDefaultModelFor
APIEditBeforeSaveManual:Hooks/APIEditBeforeSave
UnitTestsListManual:Hooks/UnitTestsList
InfoActionManual:Hooks/InfoAction

Translate the Proofread Page extension if it is available at translatewiki.net

Check usage and version matrix.

IssuesPhabricator

Open tasks · Report a bug

The Proofread Page extension creates a book either:

1) as a column of OCR text beside a column of scanned images, or
2) broken into chapters or poems. The content of a document appears in the mediawiki page. (transclusion).

The extension is intended to allow easy comparison of text to the original digitization.

This extension shows the text in several ways without actually duplicating the original text.[1]

Use[edit]

The extension is installed on all Wikisource wikis. For the syntax, see s:mul:Wikisource:ProofreadPage. It is also used on Wikilivres.

Requirements and recommendations[edit]

Installation[edit]

Extension[edit]

  • Download and place the file(s) in a directory called ProofreadPage in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'ProofreadPage' );
    
  • Run the update script which will automatically create the necessary database tables that this extension needs.
  • YesY Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

To users running MediaWiki 1.24 or earlier:

The instructions above describe the new way of installing this extension using wfLoadExtension() If you need to install this extension on these earlier versions (MediaWiki 1.24 and earlier), instead of wfLoadExtension( 'ProofreadPage' );, you need to use:

require_once "$IP/extensions/ProofreadPage/ProofreadPage.php";

Thumbnailing[edit]

The extension links directly to image thumbnails which often don't exist. You must catch 404 errors and generate the missing thumbnails. You can do this with any one of these solutions:

  • Set an Apache RewriteRule in .htaccess to thumb.php for missing thumbnails:
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^/w/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/page([0-9]+)-?([0-9]+)px-.*$ /w/thumb.php?f=$1&p=$2&w=$3 [L,QSA]
    
  • or set the Apache 404 handler to Wikimedia's thumb-handler. This is a general-purpose 404 handler with Wikimedia-specific code, not simply a thumbnail generator.
        ErrorDocument 404 /w/extensions/upload-scripts/404.php
    
  • For MediaWiki >= 1.20, you can simply redirect to thumb_handler.php:
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^/w/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/page([0-9]+)-?([0-9]+)px-.*$ /w/thumb_handler.php [L,QSA]
    
  • Or in apache2.conf :
        ErrorDocument 404 /w/thumb_handler.php
    

WARNING: There is an .htaccess file in the images directory that may interfere with any .htaccess rules you install.

Namespaces[edit]

ProofreadPage create by default two custom namespaces named "Page" and "Index" in English with respectively ids 250 and 252.

Their names are translated if your wiki use an other language. Full list.

You can customize their name or their id: Create namespaces by hand and set their ids in LocalSettings.php using $wgProofreadPageNamespaceIds global. You will do something like:

define( 'NS_PROOFREAD_PAGE', 250);
define( 'NS_PROOFREAD_PAGE_TALK', 251);
define( 'NS_PROOFREAD_INDEX', 252);
define( 'NS_PROOFREAD_INDEX_TALK', 253);
$wgExtraNamespaces[NS_PROOFREAD_PAGE] = 'Page';
$wgExtraNamespaces[NS_PROOFREAD_PAGE_TALK] = 'Page_talk';
$wgExtraNamespaces[NS_PROOFREAD_INDEX] = 'Index';
$wgExtraNamespaces[NS_PROOFREAD_INDEX_TALK] = 'Index_talk';
$wgProofreadPageNamespaceIds = array(
    'index' => NS_PROOFREAD_INDEX,
    'page' => NS_PROOFREAD_PAGE
);

Configuration[edit]

Configuration of index namespace[edit]

The configuration is a JSON array of properties. Here is the structure of a property in the array, all the parameters are optional, the default value are set:

{
  "ID": { //id of the metadata (first parameter of proofreadpage_index_attributes)
    "type": "string", //the property type (for compatibility reasons the values have not to be of this type). Possibles values: string, number, page. If set, the newly set values should be valid according to the type (e.g. for a number a valid number, for a page an existing wiki page...)
    "size": 1, //only for the type string : number of lines of the input (third parameter of proofreadpage_index_attributes)
    "values":  {"a":"A", "b":"B","c":"C", "d":"D"}, //an array values : label that list the possible values (for compatibility reasons the stored values have not to be one of these)
    "default": "", //the default value
    "header": false, //add the property to Mediawiki:Proofreadpage_header_template template
    "label": "ID", //the label in the form (second parameter of proofreadpage_index_attributes)
    "help": "", //a short help text
    "delimiter": [], //list of delimiters between two part of values. By example ["; ", " and "] for strings like "J. M. Dent; E. P. Dutton and A. D. Robert"
    "data": "" //proofreadpage's metadata type that the property is equivalent to
  }
}

The data parameter can have for value: "type", "language", "title", "author", "translator", "illustrator", "editor", "school", "year", "publisher", "place" or "progress".

Page separator[edit]

The extension puts a separator between every transcluded page and the next, which is defined by wgProofreadPagePageSeparator. The default value is   (a whitespace). Set wgProofreadPagePageSeparator = "" to suppress the separator.

Join hyphenated words across pages[edit]

When a word is hyphenated between a page and the next, the extension joins together the two halves of the word. Example: his- and tory becomes history. The "joiner" character is defined by wgProofreadPagePageJoiner and defaults to '-' (the regular hyphen character).

Usage[edit]

Creating your first page (example with DjVu)[edit]

  • Before following these steps ensure you have followed the instructions in Using DjVu with MediaWiki.
  • (when and in which namespace is the djvu file itself uploaded?)
  • Create a page in the "Page" namespace (or the internationalized name if you use an not-English wiki). For example if your namespace is 'Page' create Page:Carroll - Alice's Adventures in Wonderland.djvu
  • Create the corresponding file for this page commons:File:Carroll - Alice's Adventures in Wonderland.djvu (or set Manual:$wgUseInstantCommons to true).
  • Create the index page Index:Carroll - Alice's Adventures in Wonderland.djvu
    • Insert the tag <pagelist/> in the Pages field to visualize the page list
  • To edit page 5 of the book navigate to 'Page:Carroll - Alice's Adventures in Wonderland/5' and click edit

Syntax[edit]

This extension introduces the following tags: <pages> and <pagelist>.


Notes[edit]

  1. Because the pages are not in the main namespace, they are not included in the statistical count of text units.

See also[edit]


Other languages:Project:Language policy English  • français