Page 3 of 3 FirstFirst 123
Results 31 to 34 of 34

Thread: Javascript to format Arduino code

  1. #31
    Thanks for sharing javascript to format arduino code.

  2. #32
    Join Date
    Jul 2014
    Canberra Australia
    deathshadow - I have been having a good play around with your code. Boy am I glad that you replied to my initial question here because this code is so good and can be tailored to style the arduino code exactly as it appears in the Arduino IDE and that is just the tip of the iceberg no doubt Thank you so much Pedro

  3. #33
    Oh, one little side note -- in production this is NOT something I'd be doing client-side. I may enhance it client-side with the scripting to turn off highlighting and select the element, but the processing of the file I'd be handling server-side in a language like PHP.

    In fact, having a PHP parser could be handier since you could then be sure all the specialchars are escaped properly, and you could just point at the actual file and read it in with something like file_get_contents.

    The calling convention for that could turn out quite nice, something like:

    echoCodeFile($fileName, 'arduinoCode');

    Where $fileName would be the file of the source code -- thich could then read in the file and spit it out all nice and well formatted.

    I might take a stab at implementing that later today.

  4. #34
    Join Date
    Jul 2014
    Canberra Australia
    As I am sure you are now aware, I am very much a rank beginner with all this deathshadow .. hey we all have to start somewhere but pity i didn't start until age 59 So I assume that if the script is to be run server side, the arduinoCode script and "some" other associated coding is stored on the server and a "call" is made to the server when the arduinoCode section in the html of the webpage is to be displayed in the browser. I tailored you script to format some Arduino code and I put it up at my test site at http://www.pedrosdigitalsolutions.com/code_1.html Just as a side not if you did happen to use the page nav on that page it would take to some rather old and very ugly early examples of my initial coding forays - not pretty. I also realise that you are not a fan of my scroll boxes but these are all just different techniques that I am trying out at this stage in my "quest to code" I know you optimised one piece of my Arduino code but at this stage I am concentrating on the website displaying of it so I am still using examples of my dinosaur Arduino code in these pages, plus I haven't touched any Arduino code or hardware ever since I typed my first <html> I would be really interested in seeing how you script could be implemented server side with php

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center