https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114068
Revision: 114068
Author: van-de-bugger
Date: 2012-03-17 21:03:47 +0000 (Sat, 17 Mar 2012)
Log Message:
-----------
SemanticTitle: README updated.
Modified Paths:
--------------
trunk/extensions/SemanticTitle/README
Modified: trunk/extensions/SemanticTitle/README
===================================================================
--- trunk/extensions/SemanticTitle/README 2012-03-17 20:58:46 UTC (rev
114067)
+++ trunk/extensions/SemanticTitle/README 2012-03-17 21:03:47 UTC (rev
114068)
@@ -1,39 +1,86 @@
<!-- README -->
-== Purpose ==
+== What? ==
-The `SemanticTitle' extension allows set link text and page title to a value
of a semantic property.
+The SemanticTitle extension sets visible page title to a value of semantic
property.
-The extension is useful for pages, which names are automatically generated by
a formula
-(e. g. auto-incremented numbers or ids), but human-readable title is still
desirable.
+For example, if page `Bug:32758' has semantic property `Title' with value `SMW
handles timezones
+incorrectly', and SemanticTitle is properly installed and configured, visible
page title will be
+`SMW handles timezones incorrectly', with subtitle `Bug:32758'.
-== Usage ==
+Similarly, link to the page will be `SMW handles timezones incorrectly' with
tooltip `Bug:32758'.
-Add to your `LocalSettings.php':
+{{ #semantic-title: Bug:32758 }} returns `SMW handles timezones incorrectly'
as plain text (not a
+link).
- require_once( 'SemanticTitle.php' );
- $egSemanticTitle[ NS ] = 'Property name';
- ...
+== Why? ==
+Let us assume we are creating a bug tracking system based on MediaWiki.
Semantic MediaWiki converts
+wiki into a database. Pages become objects or entities (e. g. bugs) with
properties (e. g. title,
+submitter, severity, component, etc). We want every bug is identified by its
number, assigned
+automatically. Semantic Forms allows it:
+
+ {{{info|page name=Bug:<unique number>}}}
+ {{{for template|Bug|...}}}
+ ...
+
+so every new bug receives unique identifier. Everything works, but bug page
title will be
+`Bug:32758', links to this bug will also be `Bug:32758', while we want to see
bug titles (set by
+user, not an id assigned by system) in page titles and links. This is the job
for SemanticTitle
+extension.
+
+== Installation ==
+
+To install this extension, add the following to LocalSettings.php:
+
+ require_once( "$IP/extensions/SemanticTitle/SemanticTitle.php" );
+
+Semantic MediaWiki should also be installed. Order of inclusion does not
matter.
+
+If SemanticTitle is used with HidePrefix extension, SemanticTitle should be
included before
+HidePrefix (SemanticTitle does not touch title if it was set to non-default
value, e. g. processed
+by HidePrefix extension).
+
+== Configuration ==
+
+In LocalSettings.php after including `SemanticTitle.php':
+
+$egSemanticTitle = array(
+ NS1 => 'Property name1',
+ NS2 => 'Property name2',
+ ...
+);
+
where:
-* ''NS'' is a namespace index (not namespace name!), for example, `NS_MAIN' or
`NS_USER'.
-* ''Property name'' — a name of semantic property to be used as page title.
+ * NS# — Namespace index (not a namespace name!) (usually constant, like
NS_USER). Only pages
+ in specified namespaces are affected.
+ * Property name# — Name of property to be used as title in the specified
namespace.
-If a page in the specified namespace has the specified property (which should
be of type `String'),
-the visible title of the page is changed to the value of the property.
+== Usage ==
-The actual name of page is added to the beginning of page subtitle.
+Being installed and configured, SemanticTitle handles page titles and links
with no user
+intervention.
-'''Note:''' The extension changes only ''visible'' name, it does ot change
real name of the page.
+However, category listings may look ugly, because listings show semantic
titles while pages are
+sorted in order of their actual titles. Use {{ DEFAULTSORT }} magic word to
fix it, e. g.:
+ [[Title::title]]
+ {{ DEFAULTSORT: title }}
+
+If you need semantic title of a page as plan text (not a link), use
#semantic-title parser function:
+
+ {{ #semantic-title: Bug:32758 }}
+
+Other extensions can call `SemanticTitle::getText( Title $title )' static
function to get a semantic
+title by given title.
+
+
== Caveats ==
-`SematicTitle' overrides page title set by SemanticForms (specified by `edit
title' parameter of
-`{{{info ...}}}' construct).
+ * SematicTitle overrides edit page title set by Semantic Forms
(specified by
+ `{{{info ...|edit title=...}}}' construct).
-* `Special:AllPages' shows unsorted list of pages (they are sorted in order of
they real titles).
-
== License ==
GNU Affero General Public License, version 3 or any later version. See
`AGPL-3.0.txt' file for the
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs