Code Highlighter available within our Community

Posted by Jean Richert on 14-Jan-2014 10:38

Just a short post to let all of you know that we just improved the code highlighter within the Community and added ABL.  Wondering how to use it? Follow this link for explanations and you'll be able to have ABL nicely displayed within our Community and the example bellow

 

 

DEFINE VARIABLE myObj   AS JsonObject NO-UNDO.
DEFINE VARIABLE myElem  AS JsonObject NO-UNDO.
DEFINE VARIABLE myArray AS JsonArray NO-UNDO.
DEFINE VARIABLE myLongchar AS LONGCHAR NO-UNDO.
DEFINE VARIABLE lv_Property  AS CHARACTER EXTENT no-undo.
DEFINE VARIABLE lv_Property1 AS CHARACTER EXTENT no-undo.
DEFINE VARIABLE lv_i  AS INTEGER NO-UNDO.
DEFINE VARIABLE lv_i2 AS INTEGER NO-UNDO.
DEFINE TEMP-TABLE ttCust
 FIELD CustNum     AS INTEGER
 FIELD Name        AS CHARACTER 
 FIELD CreditLimit AS DECIMAL
 FIELD someLogic   AS LOGICAL .
 
/* . . Load temp-table . */
FOR EACH Customer WHERE CustNum < 5 NO-LOCK:
  CREATE ttCust.
  BUFFER-COPY Customer to ttCust.
END.
 
/* Let's create json object.. */
myObj = NEW JsonObject().
 
/* ..and load it with ttCust data  */
myObj:Read(TEMP-TABLE ttCust:HANDLE).
 
/* we can get names of all properties within json object */
lv_Property = myObj:GetNames().
 
/* Here you get message "ttCust" as this json object contains one element */
/* and that is JsonArray with its elements being ttCust records           */
MESSAGE  "Number of elements in root json object is " EXTENT(lv_Property)
   VIEW-AS ALERT-BOX INFO BUTTONS OK.
 
/* Let's write our json to a file so that we can examine it's structure */
myObj:WRITEfile("ttCust.txt") .
 
/* so let's fetch our array from myObj's array property) */
myArray = myObj:GetJsonArray("ttCust") .
 
/* and let's report on it's length */
MESSAGE "Array's length is " myArray:Length
   VIEW-AS ALERT-BOX INFO BUTTONS OK.
 
/* Let's go through the json array elements */
DO lv_i = 1 TO myArray:Length :
  myElem = myArray:GetJsonObject(lv_i) .
  lv_Property1 = myElem:GetNames().
  DO lv_i2 = 1 TO EXTENT(lv_Property1) :
      MESSAGE "Property " lv_Property1[lv_i2] " has type : " myElem:GetType(lv_Property1[lv_i2])
           VIEW-AS ALERT-BOX INFO BUTTONS OK.
  END.
END.
 
/* For other data types please check            */
/* Progress.Json.ObjectModel.JsonDataType class */
/*    Array property                            */
/*    String property                           */
/*    Number property                           */
/*    Boolean property                          */
/*    Object property                           */
/*    Null property                             */

All Replies

Posted by Jean Richert on 14-Jan-2014 10:39

Thanks [mention:5fbb37d18a7d44c18fa358e5321c2872:e9ed411860ed4f2ba0265705b8793d05] for the code :-)

Posted by Mike Fechner on 14-Jan-2014 12:04

Cool stuff!

How much influence do you have on naming the "Progress" language. If you'd name it "ABL" or even better "4GL" it would become first entry in the list ;-)

Posted by Bill Wood on 14-Jan-2014 12:08

+1

The company is Progress --- the language is ABL (or historically 4GL).  (Changing to "OpenEdge ABL" doen't help the sort order, much).

Posted by Mike Fechner on 14-Jan-2014 12:10

Exactly - like the list also does not write "Microsoft" for C#.

Posted by Peter Judge on 14-Jan-2014 12:21

It looks (reading Jean's screenshots) that this is based on the syntax highlighter called, um, SyntaxHighlighter. That's an opensource project that doesn't look to yet have Sasha's contribution.

He should rename it before submitting it :)

-- peter

Posted by Jean Richert on 14-Jan-2014 12:26

Peter, you're correct it's that open source syntax highlighter to which we added our ABL.

The ABL code I used in this thread is coming from [mention:5fbb37d18a7d44c18fa358e5321c2872:e9ed411860ed4f2ba0265705b8793d05].

Now if we can have "Progress" being changed what would you guys like to be named?

ABL?

OpenEdge ABL?

Progress ABL?

Progress OpenEdge ABL?

Posted by Bill Wood on 14-Jan-2014 12:30

Mike’s comment about the alphabet would make me go with:
  ABL  (we don’t say “Oracle Sun Java”, after all.)
Or
  ABL for OpenEdge

Posted by Mike Fechner on 14-Jan-2014 12:33

ABL

So you guys created a brush for SyntaxHighlighter? Will you make this available for others?

Posted by Jean Richert on 14-Jan-2014 12:43

Ok... I'll see what is needed to change the name to ABL.

Yes we have a brush for Syntax Highlighter.

Posted by Phillip Molly Malone on 14-Jan-2014 20:44

Love it!

Posted by Jean Richert on 15-Jan-2014 03:34

After some discussions I had this morning with the team I worked with to build that brush, what we are planning to do is to try to make it even better by adding more words and categories so hopefully the brush will use different colors too... Once we have that completed then, at the very same time, we'll change the name from Progress to ABL... and eventually submit our brush through Github.

This thread is closed