Skip to content
This repository has been archived by the owner on Jun 25, 2019. It is now read-only.

CodeSplit

Daniel Shiffman edited this page Jun 22, 2016 · 3 revisions

Changes from 1st edition to 2nd.

In the first edition, all code comments were by default paired with only the first comment below. Now all code comments are paired with all the code up until the next comment.

So previously, code written like this...

// comment for x = 10
int x = 10;

int somethingelse = 50;

// comment for y = 10;
int y = 10;

...now has to have a numeric indicator for the first comment so that it does not become paired with int somethingelse = 50;

// {!1} comment for x = 10
int x = 10;

int somethingelse = 50;

// comment for y = 10;
int y = 10;

In the 1st edition, when code comments spanned multiple lines [full] and [end] were used, i.e.

// [full] initializing x and y
int x = 10;
int y = 10;
// [end]

Now a numeric indicator is used:

// {!2} initializing x and y
int x = 10;
int y = 10;

In the first edition, lines could be made "bold" with:

// The next line is bold
int x = 10; // [bold]
int y = 10;

Now, CSS classes can be applied in the code comment. I already have one for bold, i.e.

//{.bold} The next line is bold
int x = 10;
int y = 10;

This can be combined, i.e.

//{!2 .bold} The next two lines are bold
int x = 10;
int y = 10;

I have some other CSS classes already defined here:

//{.offset} For really long lines of code that need 100% width?
if (mouseX > 10 && mouseX < 20 && mouseY > 10 && mouseY < 20 && !started) {
//{.line-through} Strike through
PVector v = a + b;

There is more information here: https://github.com/magicbookproject/magicbook-codesplit

Progress

  • intro
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Clone this wiki locally