![]() Release status: unmaintained |
|
---|---|
Implementation | Tag |
Description | Imports pieces of SVN files. |
Author(s) | Alejandro Darío Simi (Daemonracotalk) |
Latest version | 0.2 (2014-01-27) |
MediaWiki | 1.22+ |
License | GNU General Public License 2.0 or later |
Download | GitHub: Note: http://wiki.daemonraco.com/wiki/PieceOfCode-dr |
Example | DAEMonRaco's Wiki |
Parameters
|
|
Tags
|
|
The PieceOfCode extension allows to import SVN file from several repositories and show them completely inside articles or just some lines.
Usage
This extension implements the parser tag <pieceofcode>
.
Here's a sample invocation that imports a piece of code:
<pieceofcode title="true"> file = /trunk/PieceOfCode-dr.php revision = 5 connection = PieceOfCode-dr lines = 2-13 </pieceofcode>
To see the result visit: http://wiki.daemonraco.com/wiki/PieceOfCode-dr#Usage
Parameters
Option | Description |
---|---|
title | This parameter allows to show a title over the piece of code with a sort of path representing the source. When it's present it needs the value true. |
Options
Option | Description |
---|---|
connection | This is a key for a repository configured by a web administrator.more |
file | This is the path to be added to the connection's url in order to create a full path. For example, if the connection's url is http://pieceofcode-dr.googlecode.com/svn, path may be /trunk/PieceOfCode-dr.php. |
lines | This parameter specifies a range of lines to be shown. For example: 20-30 (both, line 20 and line 30 will be shown). |
revision | This is the SVN number of revision. |
Connections
A connection is a piece of configuration used to identify a repository and specify its connection data. For this purpose, PieceOfCode uses the configuration variable $wgPieceOfCodeSVNConnections, this variable is an array where each element is an array itself with at least one value called url. This is the list of values that can be stored inside these items:
Option | Description |
---|---|
url | URL of a SVN repository. |
username | Username with rights to perform a checkout. |
password | Password for user previously specified. |
An example of its use may be something like this:
$wgPieceOfCodeSVNConnections['MyProject'] = array(
'url' => 'https://myproject.googlecode.com/svn',
'username' => 'myusername',
'password' => 'mypassword',
);
In this case, MyProject is the key that identifies this connection.
Configuration
This is the set of variables users can modify to change PieceOfCode behavior:
General | |||
---|---|---|---|
Type | Name | Default | Description |
string
|
$wgPieceOfCodeConfig["svn-binary"]
|
"/usr/bin/svn"
|
Specifies SVN command full-path. |
string
|
$wgPieceOfCodeConfig["enableuploads"]
|
$wgEnableUploads
|
This parameter enables/disables imports. Bay default takes the same configuration for uploads. |
string
|
$wgPieceOfCodeConfig["uploaddirectory"]
|
$wgUploadDirectory.DIRECTORY_SEPARATOR."PieceOfCode"
|
This is a full path to the directory to be use for uploads. |
Tables | |||
Type | Name | Default | Description |
string
|
$wgPieceOfCodeConfig["db-tablename"]
|
"poc_codes"
|
This is the table name used to store imports information. |
string
|
$wgPieceOfCodeConfig["db-tablename-text"]
|
"poc_codes_pages"
|
Name of table that holds a list of pages using the extension. |
string
|
$wgPieceOfCodeConfig["db-tablename-ccounts"]
|
"poc_codes_counts"
|
Name of table that keep counts of uses by font-code. |
string
|
$wgPieceOfCodeConfig["db-tablename-history"]
|
"poc_codes_history"
|
Name of table where history of modifications per font-code is stored. |
string
|
$wgPieceOfCodeConfig["db-tablename-flags"]
|
"poc_flags"
|
Name of table to hold several values used by the extension. |
Font-codes Configuration | |||
Type | Name | Default | Description |
array
|
$wgPieceOfCodeConfig["fontcodes"]["bash"]
$wgPieceOfCodeConfig["fontcodes"]["make"]
$wgPieceOfCodeConfig["fontcodes"]["cpp"]
$wgPieceOfCodeConfig["fontcodes"]["php"]
$wgPieceOfCodeConfig["fontcodes"]["text"]
$wgPieceOfCodeConfig["fontcodes"]["sql"]
$wgPieceOfCodeConfig["fontcodes"]["xml"]
$wgPieceOfCodeConfig["fontcodes"]["java"]
$wgPieceOfCodeConfig["fontcodes"]["dos"]
$wgPieceOfCodeConfig["fontcodes"]["asm"]
$wgPieceOfCodeConfig["fontcodes"]["html4strict"]
$wgPieceOfCodeConfig["fontcodes"]["python"]
$wgPieceOfCodeConfig["fontcodes"]["css"]
$wgPieceOfCodeConfig["fontcodes"]["javascript"]
|
array('sh')
array('mk', 'mak')
array('cpp', 'h', 'hpp', 'c')
array('php', 'inc', 'php3')
array('txt', 'log')
array('sql')
array('xml', 'xsl', 'xslt', 'mxml')
array('java')
array('bat')
array('asm')
array('html', 'htm')
array('py')
array('css')
array('js')
|
These lists configures how to map file-extensions and their types. Values like bash , cpp , etc. are those accepted by paramenter lang of SyntaxHighlight extension. |
array
|
$wgPieceOfCodeConfig["fontcodes-forbidden"]
|
array("exe", "so", "zip", "rar", "7z",
"gz", "jar", "class", "a", "o",
"tar", "bz2", "jpg", "jpeg", "png",
"gif", "xcf", "svg")
|
This is the list of extensions forbidden by the extension. When one of these is about to be imported, PieceOfCode shows an error message. |
boolean
|
$wgPieceOfCodeConfig["fontcodes-allowempty"]
|
false
|
This option allows to import files without extensions. |
int
|
$wgPieceOfCodeConfig["maxsize"]["highlighting"]
|
30720
|
Maximum size in bytes before highlighting is disabled. By default is 30KB. |
int
|
$wgPieceOfCodeConfig["maxsize"]["showing"]
|
51200
|
Maximum size in bytes before font-code is truncated. By default is 50KB. This parameter has two diferent behaviors:
|
Statistics | |||
Type | Name | Default | Description |
boolean
|
$wgPieceOfCodeConfig["stats"]
|
true
|
Enables/Disables statistics recollection. |
boolean
|
$wgPieceOfCodeConfig["db-stats-limited"]
|
false
|
Allows to limit pages analized on each wiki request. This is a way to improve performace. |
integer
|
$wgPieceOfCodeConfig["db-stats-per-try"]
|
2
|
This statistics limitations are enabled, this is the maximum of pages to be analized on each wiki request. |
integer
|
$wgPieceOfCodeConfig["db-stats-timelimit"]
|
2592000
|
Time-limit for stored statistics. By deafult it is 30 days. |
History | |||
Type | Name | Default | Description |
boolean
|
$wgPieceOfCodeConfig["history"]
|
true
|
Enables/Disables font-codes history storage. |
Miscellaneous | |||
Type | Name | Default | Description |
boolean
|
$wgPieceOfCodeConfig["autocss"]
|
true
|
Allows to enable/disable internal CSS-file inclution. |
boolean
|
$wgPieceOfCodeConfig["show"]["installdir"]
|
true
|
Shows system path to PieceOfCode installation directory at Special:PieceOfCode. |
boolean
|
$wgPieceOfCodeConfig["show"]["tablenames"]
|
true
|
Shows table names at Special:PieceOfCode. |
boolean
|
$wgPieceOfCodeConfig["show"]["binarypaths"]
|
true
|
Shows system path to the SVN application at Special:PieceOfCode. |
boolean
|
$wgPieceOfCodeConfig["show"]["updaloaddirs"]
|
true
|
Shows system path to the uploads directory at Special:PieceOfCode. |
boolean
|
$wgPieceOfCodeConfig["show"]["svnusernames"]
|
true
|
Shows username for each SVN connextion at Special:PieceOfCode. |
boolean
|
$wgPieceOfCodeConfig["show"]["svnpasswords"]
|
false
|
Shows password for each SVN connextion at Special:PieceOfCode. |
integer
|
$wgPieceOfCodeConfig["show"]["stored-limit"]
|
20
|
Maximum of entries show on section Stored Codes at Special:PieceOfCode. |
integer
|
$wgPieceOfCodeConfig["show"]["history-limit"]
|
50
|
Maximum of entries shown at Special:PieceOfCode when a font-code specific information is shown. |
boolean
|
$wgPieceOfCodeConfig["show"]["authorslogo"]
|
true
|
Allows to disable DAEMonRaco's logotype at Special:PieceOfCode. |
Installation
If you want to install this extension, follow these steps:
- First, download the extension from https://github.com/mediawiki-extensions/pieceofcode-dr/archive/master.zip. This will give you a zip file.
- Second, extract the tar.gz file inside you mediawiki extensions directory. This will create a folder called PieceOfCode-dr.
- Third, add these lines at the end of your LocalSettings.php file:
require_once("extensions/PieceOfCode-dr/PieceOfCode-dr.php");
//$wgPieceOfCodeSVNConnections['MyProject'] = array(
// 'url' => 'https://myproject.googlecode.com/svn',
// 'username' => 'myusername',
// 'password' => 'mypassword',
//);
- Then, enjoy!.
Version history
- Version 0.2
- Highlight Specified lines.
- Adding multirange of lines support.
- Adding param 'separator' in order to separate ranges of lines.
- Adding POCStats: a new class to keep statistics.
- Adding configuration to manage this new feature.
- Adding class POCFlags in order to manage PieceOfCode flags.
- Adding class POCVersionManager in order to manage version upgrades of PieceOfCode.
- Almost all Specia:PieceOfCode works with wiki text.
- MediaWiki 1.22 compatibility fixes.
- Version 0.1
- Extension presentation.
@TODO
- Register what article includes what font-code.
- SpecialPage: separate REQUEST actions.
- others...
- Pre-recursive parse inside tags.
See also
- Official Site: http://wiki.daemonraco.com/wiki/PieceOfCode-dr
- Required extensions:
References
- ↑ You may visit Special:PieceOfCode to see an example
![]() | This extension was migrated from Google code and checked into a GitHub software repository. |