Preserve code formatting

Hey,
This plugin seems to do exactly what I am looking for, enable users to write code in comments.
Preserve Code Formatting

Please test here and give feedback

Warning: this changed the behavior of old posts too, so I have to reformat all older posts to no longer use < in code :(

12 thoughts on “Preserve code formatting”

  1. OK – I try it:

    
    DECLARE
      vTest number;
    BEGIN
      SELECT sal INTO vTest
        FROM "SCOTT"."EMP"
        WHERE ename='King';
    EXCEPTION
      WHEN OTHERS THEN NULL ; -- ;-)
    END;
    /
    

  2. testing XML Schema stuff

    
    SQL> declare
      2    res boolean;
      3    xmlSchema xmlType := xmlType(
      4  '<?xml version="1.0" encoding="UTF-8" ?>
      5  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
      6             xmlns:xdb="http://xmlns.oracle.com/xdb"
      7             elementFormDefault="qualified"
      8             attributeFormDefault="unqualified"
      9             xdb:storeVarrayAsTable="true">
     10    <xs:element name="ROOT" xdb:defaultTable="ROOT_TBL" xdb:maintainDOM="false">
     11       <xs:annotation>
     12           <xs:documentation>Example XML Schema</xs:documentation>
     13       </xs:annotation>
     14       <xs:complexType>
     15          <xs:sequence>
     16              <xs:element name="ID" type="xs:integer" />
     17              <xs:element ref="INFO" />
     18          </xs:sequence>
     19       </xs:complexType>
     20    </xs:element>
     21    <xs:element name="INFO">
     22       <xs:complexType>
     23           <xs:sequence>
     24             <xs:element name="INFO_ID" type="xs:integer" />
     25             <xs:element name="INFO_CONTENT" />
     26           </xs:sequence>
     27       </xs:complexType>
     28    </xs:element>
     29  </xs:schema>'
     30  );
     31  begin
     32    if (dbms_xdb.existsResource(:schemaPath)) then
     33        dbms_xdb.deleteResource(:schemaPath);
     34    end if;
     35    res := dbms_xdb.createResource(:schemaPath,xmlSchema);
     36  end;  
     37  / 
    
    


  3. SELECT
    CASE WHEN Type = ‘C’ THEN ‘Child’ ELSE ‘Parent’ END “End”,
    CASE WHEN Type = ‘C’ THEN Child_Column ELSE Parent_Column END “Column”,
    SubStr(Position, 1, 1) “#”,
    CASE WHEN Type = ‘C’ THEN Parent_Table ELSE Child_Table END “Other Table”,
    CASE WHEN Type = ‘C’ THEN Parent_Column ELSE Child_Column END “Other Column”,
    Constraint_Name “Constraint”
    FROM
    (
    SELECT
    (
    CASE
    WHEN Child_Columns.Table_Name = UPPER(‘&1′) THEN ‘C’
    ELSE ‘P’
    END
    ) Type,
    Constraints.Constraint_Name Constraint_Name,
    Constraints.R_Constraint_Name R_Constraint_Name,
    Parent_Columns.Position Position,
    Substr(Parent_Columns.Table_Name, 1, 30) Parent_Table,
    Substr(Parent_Columns.Column_Name, 1, 30) Parent_Column,
    Substr(Child_Columns.Table_Name, 1, 30) Child_Table,
    Substr(Child_Columns.Column_Name, 1, 30) Child_Column
    FROM
    All_Constraints Constraints,
    All_Cons_Columns Parent_Columns,
    All_Cons_Columns Child_Columns
    WHERE
    UPPER(‘&1′) IN (Parent_Columns.Table_Name, Child_Columns.Table_Name)
    – Join Parent_Columns to get the COLUMN names.
    AND Parent_Columns.Owner = Constraints.R_Owner
    AND Parent_Columns.Constraint_Name = Constraints.R_Constraint_Name
    – Join Child_Columns to get the COLUMN names.
    AND Child_Columns.Owner = Constraints.Owner
    AND Child_Columns.Constraint_Name = Constraints.Constraint_Name
    AND Child_Columns.Position = Parent_Columns.Position
    )
    ORDER BY
    Type,
    Constraint_Name;

  4. Copy&paste, silly. :)

    For example, i just pressed in “a” then pressed tab then pressed “b”. I copied that from Notepad and pasted it here. There is clearly a tab there. In the edit box right now, it shows only one character.

    Without code tags:
    a b
    With code tags:
    [code]
    a b
    [/code]

Leave a Reply

Your email address will not be published.


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>