LowHangingFruit: Difference between revisions

From Request Tracker Wiki
Jump to navigation Jump to search
(Created page with "== Low Hanging Fruit == Code block cleanup The previous version of the rt-wiki used a single space indent, sometimes surrounded by <code><nowiki></code> tags to delimi...")
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 5: Line 5:
The previous version of the rt-wiki used a single space indent, sometimes surrounded by <code>&lt;nowiki&gt;</code> tags to delimit code blocks. Media-wiki uses a four space indent to delimit code. The old style does not correctly format the first line of the code block.
The previous version of the rt-wiki used a single space indent, sometimes surrounded by <code>&lt;nowiki&gt;</code> tags to delimit code blocks. Media-wiki uses a four space indent to delimit code. The old style does not correctly format the first line of the code block.


The for space indent also makes the code literal, so you don't have to add html entities for greather than and less than.
The four space indent also makes the code literal, so you don't have to add html entities for greather than and less than.


Old:
Old:
Line 26: Line 26:
     $skip => undef
     $skip => undef
     </%ARGS>
     </%ARGS>
=== sed script to clean up nowiki tagged code ===
Note that you will have to turn html entities back into their rendered forms. I recommend pasting the wiki text to a file (say, <code>/tmp/fix-nowiki.txt</code>) and running the folloiwing:
    sed '/^ <nowiki>/,/^ <\/nowiki>/{s/^ <nowiki>/ <nowiki>\n    /;
        s/&lt;/</g;
        s/&gt;/>/g;
        s/^ /    /;
        /nowiki>/d}' /tmp/fix-nowiki.txt

Latest revision as of 15:49, 8 January 2017

Low Hanging Fruit

Code block cleanup

The previous version of the rt-wiki used a single space indent, sometimes surrounded by <nowiki> tags to delimit code blocks. Media-wiki uses a four space indent to delimit code. The old style does not correctly format the first line of the code block.

The four space indent also makes the code literal, so you don't have to add html entities for greather than and less than.

Old:

<%INIT>
$$skip = 1 if $Transaction->Creator == $RT::SystemUser->id;
</%INIT>
<%ARGS>
$Transaction => undef
$skip => undef
</%ARGS>

New:

   <%INIT>
   $$skip = 1 if $Transaction->Creator == $RT::SystemUser->id;
   </%INIT>
   <%ARGS>
   $Transaction => undef
   $skip => undef
   </%ARGS>

sed script to clean up nowiki tagged code

Note that you will have to turn html entities back into their rendered forms. I recommend pasting the wiki text to a file (say, /tmp/fix-nowiki.txt) and running the folloiwing:

   sed '/^ <nowiki>/,/^ <\/nowiki>/{s/^ <nowiki>/ <nowiki>\n    /;
       s/</</g;
       s/>/>/g;
       s/^ /    /;
       /nowiki>/d}' /tmp/fix-nowiki.txt