GithubHelp home page GithubHelp logo

wsviktors / autocreatepage Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mkroetzsch/autocreatepage

0.0 0.0 0.0 16 KB

MediaWiki extension to create pages with a parser function

Home Page: http://www.mediawiki.org/wiki/Extension:AutoCreatePage

License: GNU General Public License v2.0

PHP 100.00%

autocreatepage's Introduction

AutoCreatePage

MediaWiki extension to automatically create pages with a parser function.

The purpose of this is that wiki pages, especially pages that use templates, can trigger the creation of auxiliary pages. This makes most sense when using an extension like Semantic MediaWiki, which can create rich content pages automatically without much user input.

For example, imagine a wiki that has pages about people and pages about projects, where many people can be involved in one project. Then it makes sense to have pages that list all the projects of one person. This can be done automatically with Semantic MediaWiki, but you would still need to create the page first. With this extension, the template that is used for person pages can make sure that also a page with projects of that person is created.

Another example are bi-lingual wikis that use a lot of templates and forms (so many pages consist mainly of data, not of text). Then one can enter data in one language (e.g., create a page in German using a Semantic Form), and the templates used can make sure that the page also exists in another language (e.g., create a page named "{{PAGENAME}}/en" that contains a Semantic MediaWiki template that queries and displays all relevant data, but this time with English labels).

Both of these uses were pioneered by the AIFB Portal Wiki.

Usage

The extension provides one parser function, createpageifnotex that takes a page title and a text to use when creating the page. Example:

{{#createpageifnotex:Test page 1|The content of test page 1}}

Pages are only created if they don't exist yet. The author of the new page is the user who saved the edit to the page that contained the parser function call. Pages are only created when saving an edit, never when viewing a page.

Pages are only created if the parser function is used on a page in one of MediaWiki's content namespaces. Nothing will happen if the parser function is called on, e.g., template pages.

Installation

Download the repository (including the top directory AutoCreatePage) to the extension directory of your MediaWiki installation. You can do this with git by calling:

git clone https://github.com/mkroetzsch/AutoCreatePage.git

from your extension directory. Then add to your LocalSettings.php:

include_once "$IP/extensions/AutoCreatePage/AutoCreatePage.php";

The code requires MediaWiki 1.21 to work. It has been tested on MediaWiki 1.23. Future versions might also work.

Configuration

The extension supports two configuration variables, that can be set in LocalSettings.php.

$egAutoCreatePageMaxRecursion: The maximum recursion depth to which calls of createpageifnotex are executed on created pages. Default: 1.

$egAutoCreatePageIgnoreEmptyTitle: If invocations of createpageifnotex should be silently ignored. Default: false (will put an error message on the wiki page).

Status

This code is experimental. Use with care. Internationalization is largely missing.

As of MediaWiki 1.23, the code avoids deprecated functions or hooks. However, it accesses the parser's mStripState member (intended private?) to process nowiki tags. This might have to be replaced by some other approach in the future.

Credits

The original idea and first implementation was done by Daniel Herzig (AIFB). The code was modernized to work with MediaWiki 1.23 by Markus Kroetzsch.

The code is licensed under GPLv2.

autocreatepage's People

Contributors

mkroetzsch avatar jeroendedauw avatar s7eph4n avatar oetterer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.