RTFM

From Request Tracker Wiki
Revision as of 03:54, 15 August 2012 by 222.127.254.113 (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

More About RTFM

http://www.bestpractical.com/rtfm/

RTFM Installation

Installation is a fairly straightforward process (this process assumes that you already have a fully functional instance of RT3 installed and that you are not upgrading a previous installation of RTFM) :

cd /usr/local/src
wget http://download.bestpractical.com/pub/rt/release/rtfm.tar.gz
tar zxf rtfm.tar.gz
cd RTFM-X.X.X
read the README
perl Makefile.PL
make install
make initdb (only for clean installs)

Then edit your RT_SiteConfig (or RT_Config) to include this line:

Set(@Plugins,qw(RT::FM));

Finally, restart your web server:

/etc/init.d/httpd stop
/etc/init.d/httpd start

WikiText Custom Field for RTFM

The following is my observation based on RTFM 2.0.4 and RT 3.4.0 - I posted this on the forum and received no responses so I am unsure if this is indeed a global issue or not. Please feel free to correct any of the below if you find your situation different. Hopefully this will reduce the amount of time for someone trying to format articles in RTFM. /

Included in the custom fields is a type = wikitext that generally uses standard wiki formatting with some exceptions.

Note that formatting rules in this full Wiki are NOT the same as the wikitext custom field in RTFM.

If you paste text into the RTFM wikitext field it will be autoformatted with internal wikilinks on any word with multiple capital letters. There are many cases where you will want to disable this on a word by word or block basis.

To disable creation of auto links enclose the word or section in <nowiki> </nowiki> tags. Simply putting an exclamation point in front of the word will not work here as in Kwiki.

ThisWordShouldBeWikified

<nowiki>ThisWordWillNotBeWikified</nowiki>

One other non-standard behavior is with hyperlinks. The wiki formatter does not automatically recognize links like http://www.bestpractical.com/ or email addresses such as name@domain.com. You will have to enclose any external links in square brackets or enclose in the normal HTML anchor tags <a href=></a> or they will be treated as regular text.

  • I Think 'The enclose brackets for external links' is Ok. If someone adding an external link here - he MUST know how to work on this wiki. We don't want anyone just visit this page and add his 'Blog' here to get a link. Someone have 'Admin' Status on this Wiki, Please format and my text here or somewhere in this wiki you think perfect. *

Most other formatting conventions work as expected. (I have not found this to be the case, only the small subset listed in man Text::WikiFormat actually work. SG.)

See http://en.wikipedia.org/wiki/Help:Wikitext_examples for those conventions.

[=man Text::WikiFormat] for a partial spec (on Debian Sarge at least).


Some RT idiosyncrasies (rt 3.4.1, rtfm 2.0.4). http://en.wikipedia.org/wiki/Help:Wikitext_examples is useful as a starting point but there are some differences.

bold

'''bold'''
 
 
 

/italic/

''italic''
 
 

/bold and italic/

'''''bold and italic'''''
 
 

Those are single quotes.

Other ones I have been able to get to work, hopefully this will save some frustration. SG.

Heading

= Heading =
 

Sub Heading

== Sub Heading ==
 
Sub-sub Heading
===== Sub-sub Heading =====
 
 
 

Unnumbered Lists - Need to be spaced in 4 or more spaces (more than shown here)

* List
 * Here
 * How about here
 
 

Numbered Lists - I haven't gotten these to work exactly right, the Subitems both show as 1 in my RTFM but hopefully this will get others a little closer to the right answer. SG.

1.     Item 1
2.     Item 2
     a.     Subitem 1
     b.     Subitem 2
3.     Item 3

HTML tags also work like the font tag (allows only size and face attibutes), the paragraph tag and the line break tag. If the nesting of the list doesn't really suit your taste, you can use the line break tag instead. Also putting up a line by typing in four or more hyphens (----) to segment the articles work.

Entering a URL use the [ ]

http://wiki.bestpractical.com

If you need [ or ] use html entities i.e. &# 91; and &# 93; — & nbsp; could also be useful.

NB: these entities are purposely broken so that this wiki won't mess with them, remove the space after the & or the # to use.

Custom Wiki Tags Kludge:

Editing the %tags and format_line definitions in WikiFormat.pm allows for custom wiki tags. Some knowledge of perl regular expressions is necessary. I would much rather see this done within the RT source but hey it works.

Here is an example for adding warning text with style:

Add the following to the %tags declaration.

warn            => sub { "<big><u><font color=#ff0000>$_[0]</font></u></big>" },
warn_tag        => qr/!(.+?)!/,

Add the following to the format_line definition.

$text =~ s!$tags->{warn_tag}!$tags->{warn}->($1, $opts)!eg;

Cory Oldford

Add a Format Toolbar to the Wikitext Custom Field

(RT-2.65, RTFM-2.21) Wanted to integrate a toolbar to facilitate the wiki formatting to our users.

EditCustomFieldWikitext

Copy: /opt/rt3/share/html/Elements/EditCustomFieldWikitext to /opt/rt3/local/html/Elements/EditCustomFieldWikitext

Edit: /opt/rt3/local/html/Elements/EditCustomFieldWikitext

Add before "% while":
% my $wiki_textarea_value = $NamePrefix .$CustomField->id .'-Values';
% my $wiki_format_toolbar = qq(
% <div>
% <input type="button" onclick="javascript:lbc(event,'$wiki_textarea_value','bold');" style="font-weight: bold;" value="B">
% <input type="button" onclick="javascript:lbc(event,'$wiki_textarea_value','italic');" style="font-style: italic;" value="I">
% <input type="button" onclick="javascript:lbc(event,'$wiki_textarea_value','bold_italic');" style="font-weight: bold;font-style: italic;" value="BI">
% <input type="button" onclick="javascript:lbc(event,'$wiki_textarea_value','heading');" value="H1">
% <input type="button" onclick="javascript:lbc(event,'$wiki_textarea_value','subheading');" value="H2">
% <input type="button" onclick="javascript:lbc(event,'$wiki_textarea_value','subsubheading');" value="H3">
% <input type="button" onclick="javascript:lbc(event,'$wiki_textarea_value','list');" value="List">
% <input type="button" onclick="javascript:lbc(event,'$wiki_textarea_value','link');" value="Link">
% <input type="button" onclick="javascript:lbc(event,'$wiki_textarea_value','highlight');" style="font-weight: bold;color: red;" value="!">
% <input type=button onclick="javascript:lbc(event,'$wiki_textarea_value','code');" value="Code">
% <input type=button onclick="javascript:lbc(event,'$wiki_textarea_value','image');" value="Image">
% </div>
% );
% print $wiki_format_toolbar;
Add in both "textarea" tags:

<textarea ... id="<%$NamePrefix%><%$CustomField->Id%>-Values"...</textarea>

Edit.html

Copy: /opt/rt3/share/html/RTFM/Article/Edit.html to /opt/rt3/local/html/RTFM/Article/Edit.html

Edit: /opt/rt3/local/html/RTFM/Article/Edit.html

Add before "form":
<script type="text/javascript">
 
 function lbc(e, objname, theTag) {
 var el = document.getElementById(objname);
 var enclosingTag;
 var spaceTag = '\ ';
 
 if(theTag == 'bold'){
         startTag = '\'\'\'';
         endTag = '\'\'\'';
         spaceTag = '';
 }
 if(theTag == 'italic'){
         startTag = '\'\'';
         endTag = '\'\'';
         spaceTag = '';
 }
 if(theTag == 'bold_italic'){
         startTag = '\'\'\'\'\'';
         endTag = '\'\'\'\'\'';
         spaceTag = '';
 }
 if(theTag == 'heading'){
         startTag = '=';
         endTag = '=';
 }
 if(theTag == 'subheading'){
         startTag = '==';
         endTag = '==';
 }
 if(theTag == 'subsubheading'){
         startTag = '=====';
         endTag = '=====';
 }
 if(theTag == 'link'){
         startTag = '[';
         endTag = ']';
 }
 if(theTag == 'list'){
         startTag = '\ \ \ \ *\ ';
         endTag = '';
 }
 if(theTag == 'highlight'){
         startTag = '!';
         endTag = '!';
         spaceTag = '';
 }
 if(theTag == 'code'){
         startTag = '%code%';
         endTag = '%/code%';
 }
 if(theTag == 'image'){
         startTag = '%image%';
         endTag = '%/image%';
 }
 
 if (el.setSelectionRange) {
 
 //Mozilla or FireFox Code
 
         var st = el.scrollTop;
         var ss = el.selectionStart;
         var se = e.selectionEnd;
         el.value = el.value.substring(0,el.selectionStart) + startTag + spaceTag + el.value.substring(el.selectionStart,el.selectionEnd) + spaceTag + endTag + el.value.substring(el.selectionEnd,el.value.length);
         el.selectionStart = ss;
         el.selectionEnd = ss;
         el.scrollTop = st;
 }
 else if (document.selection && document.selection.createRange) {
 
         //Internet Explorer Code
 
         el.focus(); //Makes sure tags are being added to the textarea
         var range = document.selection.createRange();
         range.text = startTag + spaceTag + range.text + spaceTag + endTag; //Adds beginning and end tags.
 }
 el.focus();


}

 </script>
  

Edit: /path/to/perl/libraries/WikiFormat.pm

Add the following to the %tags declaration:

code_html_start	=> sub { "<table width=\"90%\" cellspacing=\"1\" cellpadding=\"3\" border=\"0\" align=\"center\"><tr><td><span style=\"font-size : 11px;\"><b>Code:</b></span></td></tr><tr><td style=\"font-family: Courier, \'Courier New\', sans-serif; font-size: 11px; color: #006600;background-color: #FAFAFA; border: #D1D7DC; border-style: solid;border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px;\"><code>$_[0]" },

code_html_end	=> sub { "$_[0]</code></td></tr></table>" },

code_tag_start        => qr/\%code\%(.*?)/,
code_tag_end        => qr/(.*?)\%\/code\%/,

image_html_start	=> sub { "<img src=\"$_[0]" },
image_html_end	=> sub { "$_[0]\" alt=\"Uploaded Image\" border=\"0\" />" },

image_tag_start        => qr/\%image\%(.*?)/,
image_tag_end        => qr/(.*?)\%\/image\%/,


Add the following to the format_line definition:

$text =~ s!$tags->{code_tag_start}!$tags->{code_html_start}->($1, $opts)!eg;
$text =~ s!$tags->{code_tag_end}!$tags->{code_html_end}->($1, $opts)!eg;

$text =~ s!$tags->{image_tag_start}!$tags->{image_html_start}->($1, $opts)!eg;
$text =~ s!$tags->{image_tag_end}!$tags->{image_html_end}->($1, $opts)!eg;

Miguel A. Rivera

RT 3.8.2 and RT-FM 2.4.1
  • Use /opt/rt3/local/plugins/RT-FM/html/Elements/EditCustomFieldWikitext instead of /opt/rt3/local/html/Elements/EditCustomFieldWikitext
  • Edit /opt/rt3/local/plugins/RT-FM/html/RTFM/Article/Edit.html instead of /opt/rt3/local/html/RTFM/Article/Edit.html

reaktor

Enable Inline images and HTML in RTFM Articles

Ubuntu 9.10 RT 3.8.4 / RTFM 2.4.2

  • Edit this file:

/usr/share/request-tracker3.8/html/Elements/ShowCustomFieldWikitext

And comment out this line:

% $content = $m->comp('/Elements/ScrubHTML', Content => $content);

so now it looks like this:

%# $content = $m->comp('/Elements/ScrubHTML', Content => $content);

  • Save that file, and then restart apache with sudo /etc/init.d/apache2 restart

Rename RTFM keyword on all pages

If you doesn't like the RTFM acronym, you can change it by something else rather quickly RenameRTFM


DanFarst