Author Topic: AutoLISP Syntax Highlighter on the forums  (Read 14116 times)

BazzaCAD

  • OpenDCL Webmaster
  • Administrator
  • Hero Member
  • *****
  • Posts: 853
  • Cylons will kill you
    • OpenDCL
AutoLISP Syntax Highlighter on the forums
« on: March 18, 2009, 04:44:50 PM »
With some hard work from Owen (and myself), we now have a CODE tag that will automatically highlight your AutoLISP & OpenDCL code.
Here's a small example.

Code: (autolisp) [Select]
;;This is a comment
(setq a 5)
(setq b (1+ a))
(setq c "this is a string")
(vl-load-com)
(OR (dcl_PROJECT_LOAD "Proj1" T) (EXIT))
(dcl_Form_Show Proj1_Form1)

Try not to paste super huge of code blocks. About 200 lines is the max. without bogging down the page load.

All you have to do is hit the CODE button, now renames to "Insert AutoLISP code" (see image below), then paste your code in between the CODE tags.
If you still need the old generic code block without the Highlighting, just remove the =autolisp from the tag.

You'll notice some of the special operators "+ 1+ * - 1- / = < > <= >=" etc.. & ;| multi-line comments |; don't highlight.


a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

Kerry

  • Mesozoic Relic
  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 433
  • class keyThumper<T>
Re: AutoLISP Syntax Highlighter on the forums
« Reply #1 on: March 18, 2009, 05:43:23 PM »

Excellent Result Barry abd Owen.

Did you get the MultiLine comment sorted ?? or is it too process intensive ?
Perfection is not optional.
My other home is TheSwamp

owenwengerd

  • Administrator
  • Hero Member
  • *****
  • Posts: 3048
    • Outside The Box
Re: AutoLISP Syntax Highlighter on the forums
« Reply #2 on: March 18, 2009, 05:59:32 PM »
I had it in there, but it bogged things down too much, so I removed it again.

xshrimp

  • Member
  • *
  • Posts: 1
Re: AutoLISP Syntax Highlighter on the forums
« Reply #3 on: May 26, 2011, 07:07:11 AM »
bug?? &#59
how to fix?


Code: (autolisp) [Select]
(setq a (strcat ";" a));add a ";" in front of the string if not already present  
(not (wcmatch a (strcat "*;" b ";*"))) ;is 'dir' already present in search path?  

« Last Edit: May 26, 2011, 07:08:54 AM by xshrimp »

owenwengerd

  • Administrator
  • Hero Member
  • *****
  • Posts: 3048
    • Outside The Box
Re: AutoLISP Syntax Highlighter on the forums
« Reply #4 on: May 28, 2011, 08:06:41 AM »
It should be fixed now.

qjchen

  • Member
  • *
  • Posts: 1
Re: AutoLISP Syntax Highlighter on the forums
« Reply #5 on: October 06, 2011, 06:38:15 AM »
~~ Thank you, great.
Let me test
Code: (autolisp) [Select]
;;; and lwpolyline
if (> a b )
(defun objectpoint_text (obj);;;;test
  (if (= (cdr (assoc 0 obj)) "TEXT")
    (tbox-cab obj)
  )
)
 (setq textHeight (vlax-get (vlax-ename->vla-object x) 'Height))


I am also learning how to use SyntaxHighlighter 3.0.83 in my pages
but I find that when I use this
this.regexList = [
            { regex:  /;.*$/gm,                   css: 'comments'  },
then, in the highlight, all < is convert into <;   and > into >;    vlax-ename->vla-object x   into vlax-ename->;vla-object x

but in your great site, there is no problem exist, great~
« Last Edit: October 06, 2011, 06:42:49 AM by qjchen »

owenwengerd

  • Administrator
  • Hero Member
  • *****
  • Posts: 3048
    • Outside The Box
Re: AutoLISP Syntax Highlighter on the forums
« Reply #6 on: October 06, 2011, 03:45:48 PM »
It gets complicated because special characters will be represented as HTML codes (i.e. &lt;) in the raw HTML.