Automatic URL linking to MediaWiki and ViewVC from Mantis
The ASCEND project uses Mantis for our bug tracker combined with Mediawiki (for our wiki) and ViewVC for our subversion code browser. We have but in place a few of the integration tweaks listed on the mantis blog and also by Winfred Lu. However one that seemed to be missing was the ability to convert wiki links (eg '[[PageName]]') and 'changeset XXX' links into clickable URLs. This page gives info on how ViewVC can be tweaked to give that ability.
Plugin for Mantis 1.2.x
Download Media:LinkText.tar.bz2 and unzip it into your Mantis 'plugins' directory. Then in the 'Manage' section of Mantis, turn on the plugin. You will need to edit LinkText.php because it contains specific strings for ASCEND, we haven't generalised this thing up to now.
The code is based on the BBCode plugin for Mantis 1.2.x by Kirill Krasnov.
Usage
The following text will trigger conversion to appropriate URLs:
bug 111 changeset 2222 page on wiki page on wiki#section name code/trunk/path/to/file.xxx code/branches/name/path/to/file.xxx
Configuration
There are some settings that turn on/off this special formatting in emails, RSS and HTML. We need to add extra settings to allow the URLs produced to be customised. Future work.
Patch file for Mantis 1.1.x
The following old patch worked with Mantis versions 1.1.x. It was last tested with Mantis 1.1.6.
Invalid language.
You need to specify a language like this: <source lang="html">...</source>
Supported languages for syntax highlighting:
a4c, abap, abc, abnf, actionscript, ada, agda, alan, algol, ampl, amtrix, applescript, arc, arm, as400cl, ascend, asciidoc, asp, aspect, assembler, ats, autohotkey, autoit, avenue, awk, ballerina, bat, bbcode, bcpl, bibtex, biferno, bison, blitzbasic, bms, bnf, boo, c, carbon, ceylon, charmm, chill, chpl, clean, clearbasic, clipper, clojure, clp, cmake, cobol, coffeescript, coldfusion, conf, cpp2, critic, crk, crystal, cs_block_regex, csharp, css, d, dart, delphi, diff, dockerfile, dts, dylan, ebnf, ebnf2, eiffel, elixir, elm, email, erb, erlang, euphoria, exapunks, excel, express, factor, fame, fasm, felix, fish, fortran77, fortran90, frink, fsharp, fstab, fx, gambas, gdb, gdscript, go, graphviz, haml, hare, haskell, haxe, hcl, html, httpd, hugo, icon, idl, idlang, inc_luatex, informix, ini, innosetup, interlis, io, jam, jasmin, java, javascript, js_regex, json, jsp, jsx, julia, kotlin, ldif, less, lhs, lilypond, limbo, lindenscript, lisp, logtalk, lotos, lotus, lua, luban, makefile, maple, markdown, matlab, maya, mercury, meson, miranda, mod2, mod3, modelica, moon, ms, msl, mssql, mxml, n3, nasal, nbc, nemerle, netrexx, nginx, nice, nim, nix, nsis, nxc, oberon, objc, ocaml, octave, oorexx, org, os, oz, paradox, pas, pdf, perl, php, pike, pl1, plperl, plpython, pltcl, po, polygen, pony, pov, powershell, pro, progress, ps, psl, pure, purebasic, purescript, pyrex, python, q, qmake, qml, qu, r, rebol, rego, rexx, rnc, rpg, rpl, rst, ruby, rust, s, sam, sas, scad, scala, scilab, scss, shellscript, slim, small, smalltalk, sml, snmp, snobol, solidity, spec, spn, sql, squirrel, styl, svg, swift, sybase, tcl, tcsh, terraform, tex, toml, tsql, tsx, ttcn3, txt, typescript, upc, vala, vb, verilog, vhd, vimscript, vue, wat, whiley, wren, xml, xpp, yaiff, yaml, yaml_ansible, yang, zig, znn
Configuration settings
To make use of the above patch, you also need to edit your configuration file, config_inc.php and add the following lines:
$g_wiki_link_url = 'http://ascendwiki.cheme.cmu.edu/'; $g_changeset_link_url = 'http://ascendcode.cheme.cmu.edu/viewvc.cgi?view=rev&rev=';
Obviously you will need to modify the values to suite your particular site.
Usage
Once this patch and settings changes are applied, you can make links from Mantis to Mediawiki and ViewVC as follows:
These changes discussed at [[WikiPageName]] and implemented in changeset 245
The [[WikiPageName]] link will be wikified, and the 'changeset 245' text will be converted to a link to your ViewVC site.
For an example of this on our Mantis site, see bug 297 and bug 288.