Skip to content

Commit 1032a74

Browse files
committed
fixed js highlighting on tutorials
- updated tuts to js highlighting - fixed CSV tutorial to use upcoming CSV functions - fixed image size on adding pictures - replaced PDF tutorial with something fancier
1 parent 9f23559 commit 1032a74

File tree

10 files changed

+81
-81
lines changed

10 files changed

+81
-81
lines changed

_source/tutorials/03-hello-world/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Create a new file and save it to helloworld.jsx within your user folder. Copy an
1212

1313
## Simple Hello World example
1414

15-
```
15+
```js
1616
// @includepath "~/Documents/;%USERPROFILE%Documents";
1717
// @include "basiljs/basil.js";
1818

@@ -29,7 +29,7 @@ Now run the script... either by pressing the play button from within the ExtendS
2929

3030
No wonder, the statement
3131

32-
```
32+
```js
3333
println( "Hello World!" );
3434
```
3535

@@ -41,7 +41,7 @@ Printing to the console is nice, but actually far from what basil.js is designed
4141

4242
## Hello World example using a textbox
4343

44-
```
44+
```js
4545
// @includepath "~/Documents/;%USERPROFILE%Documents";
4646
// @include "basiljs/basil.js";
4747

_source/tutorials/05-drawing-color/index.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ description: "Adding new shapes and color swatches."
1515

1616

1717
### 1. Filling the paper with a rect() by reading its size
18-
```
18+
```js
1919
// @includepath "~/Documents/;%USERPROFILE%Documents";
2020
// @include "basiljs/basil.js";
2121

@@ -30,12 +30,11 @@ function draw() {
3030

3131
### How to account for margins or bleed settings
3232

33-
```
33+
```js
3434
// @includepath "~/Documents/;%USERPROFILE%Documents";
3535
// @include "basiljs/basil.js";
3636

3737
function draw() {
38-
3938
noFill();
4039
stroke(0, 255, 0);
4140

@@ -49,7 +48,6 @@ function draw() {
4948
rect(0, 0, width, height);
5049

5150
// the following examples only work for documents with facing pages
52-
5351
canvasMode(FACING_MARGINS);
5452
rect(0, 0, width, height);
5553

@@ -67,12 +65,11 @@ function draw() {
6765
- You can still use other spots of the canvas with extreme coordinates as the canvas modes are not limiting you down to them.
6866

6967
### 2. Generate several swatches with color() and paint with rect()
70-
```
68+
```js
7169
// @includepath "~/Documents/;%USERPROFILE%Documents";
7270
// @include "basiljs/basil.js";
7371

7472
function draw() {
75-
7673
colorMode(RGB); // this is the default anyways
7774

7875
// create new RGB color
@@ -114,7 +111,7 @@ function draw() {
114111
<!-- Exercise: Create a horizontal rainbow -->
115112

116113
### 3. Using random() to pick a color and fill the background
117-
```
114+
```js
118115
// @includepath "~/Documents/;%USERPROFILE%Documents";
119116
// @include "basiljs/basil.js";
120117

@@ -130,7 +127,7 @@ function draw() {
130127

131128

132129
### 4. Using line() to create a cross
133-
```
130+
```js
134131
// @includepath "~/Documents/;%USERPROFILE%Documents";
135132
// @include "basiljs/basil.js";
136133

@@ -146,7 +143,7 @@ function draw() {
146143
<!-- Exercise: Create a Haus of Nikolaus -->
147144

148145
### 5. Using random() and ellipse() to fill the page with circles
149-
```
146+
```js
150147
// @includepath "~/Documents/;%USERPROFILE%Documents";
151148
// @include "basiljs/basil.js";
152149

@@ -169,7 +166,7 @@ function draw() {
169166

170167

171168
### 6. Using a for-loop and map() to create a gradient
172-
```
169+
```js
173170
// @includepath "~/Documents/;%USERPROFILE%Documents";
174171
// @include "basiljs/basil.js";
175172

@@ -190,7 +187,7 @@ function draw() {
190187

191188

192189
### 8. Using random() and nested for loops to create a matrix of lines
193-
```
190+
```js
194191
// @includepath "~/Documents/;%USERPROFILE%Documents";
195192
// @include "basiljs/basil.js";
196193

_source/tutorials/06-page-management/index.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: "How to add, remove, count and manage the pages of your document."
66
---
77

88
## Adding pages
9-
```
9+
```js
1010
// @includepath "~/Documents/;%USERPROFILE%Documents";
1111
// @include "basiljs/basil.js";
1212

@@ -18,19 +18,19 @@ function draw() {
1818
```
1919

2020
## Removing pages
21-
```
22-
// removes current page
23-
removePage();
21+
```js
22+
// removes current page
23+
removePage();
2424

25-
// fill up again...
26-
addPage();
25+
// fill up again...
26+
addPage();
2727

28-
// removes page 1
29-
removePage(1);
28+
// removes page 1
29+
removePage(1);
3030
```
3131

3232
## Using references to pages
33-
```
33+
```js
3434
// @includepath "~/Documents/;%USERPROFILE%Documents";
3535
// @include "basiljs/basil.js";
3636

@@ -49,7 +49,7 @@ function draw() {
4949
- You can pass a PageItem such as a TextFrame to `page()` in order to jump to the page that contains the given PageItem
5050

5151
## Populating larger documents and adding between pages
52-
```
52+
```js
5353
// @includepath "~/Documents/;%USERPROFILE%Documents";
5454
// @include "basiljs/basil.js";
5555

_source/tutorials/07-selection-and-navigation/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: "How to stroll around in the InDesign object model."
77

88
## Get the mouse selection
99

10-
```
10+
```js
1111
// @includepath "~/Documents/;%USERPROFILE%Documents";
1212
// @include "basiljs/basil.js";
1313

@@ -37,7 +37,7 @@ function draw() {
3737
- Also good for changing certain items only that you select by e.g. aesthetical criteria
3838

3939
## Add, get and set a layer
40-
```
40+
```js
4141
// @includepath "~/Documents/;%USERPROFILE%Documents";
4242
// @include "basiljs/basil.js";
4343

@@ -62,7 +62,7 @@ function draw() {
6262
- You can also use layers to select and alter the new items easily or set them to invisible
6363

6464
##Process all objects from a layer, page or document
65-
```
65+
```js
6666
// @includepath "~/Documents/;%USERPROFILE%Documents";
6767
// @include "basiljs/basil.js";
6868

@@ -91,7 +91,7 @@ function draw() {
9191

9292
<!--
9393
## Changing strokeColor, strokeWeight and fillColor on existing items
94-
```
94+
```js
9595
// @includepath "~/Documents/;%USERPROFILE%Documents";
9696
// @include "basiljs/basil.js";
9797
@@ -110,7 +110,7 @@ function draw() {
110110
-->
111111

112112
## Attaching labels to created items
113-
```
113+
```js
114114
// @includepath "~/Documents/;%USERPROFILE%Documents";
115115
// @include "basiljs/basil.js";
116116

@@ -150,7 +150,7 @@ select() is cancelling selection on previously selected things...
150150
<!-- ## How to use the Adobe Object Model and work with collections -->
151151

152152
## Cleaning up and removing stuff
153-
```
153+
```js
154154
// @includepath "~/Documents/;%USERPROFILE%Documents";
155155
// @include "basiljs/basil.js";
156156

_source/tutorials/08-transform-pageitems/index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: "Transform PageItems"
55
description: "Moving things around (i.e. PageItem) that you have created in code or by mouse."
66
---
77

8-
```
8+
```js
99
// @includepath "~/Documents/;%USERPROFILE%Documents";
1010
// @include "basiljs/basil.js";
1111

@@ -52,6 +52,5 @@ function draw() {
5252
}
5353

5454
r.remove();
55-
5655
}
5756
```

_source/tutorials/09-modifying-typography/index.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: "Changing InDesign text programatically."
88
## 1. Getting started with type
99

1010
### Add basic text box
11-
```
11+
```js
1212
// @includepath "~/Documents/;%USERPROFILE%Documents";
1313
// @include "basiljs/basil.js";
1414

@@ -24,7 +24,7 @@ Visit our reference section on [`text()`](/reference/#text) for additional typog
2424

2525
### Change type attributes
2626
Add these one at a time *before* your text frame, as they only effect proceeding `text()`.
27-
```
27+
```js
2828
textFont("Helvetica", "Regular");
2929
// copy name exactly as found when selecting fonts by pull-down menu
3030
// optional 2nd param to specify font-weight
@@ -36,22 +36,22 @@ textTracking(500);
3636
### Overflowing text
3737
If the font gets too big, you'll see that the type is now flowing past the bounds of the box, so let's resize it. In order to change the TextFrame we just built, we need to create it as a variable so that we can easily refer to it later. To do this, simply changing the following:
3838

39-
```
39+
```js
4040
// text("hello world", 0, 0, 350, 50);
4141
var myFrame = text("hello world", 0, 0, 350, 50);
4242
```
4343

4444
Note the 'var myFrame = ' placed in front of our text() code.<br>
4545
We can now refer to it and resize it, by writing the following after our manipulations:
46-
```
46+
```js
4747
transform(myFrame, "size", [width, height]);
4848
```
4949

5050
The bounding box is now as big as our page's width + height.
5151
### Styling those contents
5252

5353
Now that you can refer to your text frame, let's change further attributes inside using the all encompassing `typo()` function:
54-
```
54+
```js
5555
typo(myFrame, 'pointSize', 100);
5656
typo(myFrame, 'strikeThru', true); // add strike through
5757
typo(myFrame, 'characterRotation', -45); // add strike through
@@ -71,7 +71,7 @@ If creating a generative book across multiple pages, you'll surely want to know
7171

7272
Start with a new document and let's build two very generative text frames
7373

74-
```
74+
```js
7575
// @includepath "~/Documents/;%USERPROFILE%Documents";
7676
// @include "basiljs/basil.js";
7777

@@ -86,14 +86,14 @@ function draw() {
8686

8787
To link these text boxes, you simply write the following after they have been created:
8888

89-
```
89+
```js
9090
linkTextFrames(myFrame1, myFrame2);
9191
```
9292

9393
If you saw the type leave myFrame2 and join myFrame1, then they have been properly linked.<br>
9494
Just to test out that it's working, try flowing some placeholder text through the two text frames:
9595

96-
```
96+
```js
9797
typo(myFrame1, "contents", ""); // clear the current text
9898
myFrame1.contents = TextFrameContents.placeholderText;
9999
```
@@ -106,14 +106,14 @@ Each can be set in the following way:
106106

107107
Before you generate the text frame
108108

109-
```
109+
```js
110110
textAlign(CENTER_ALIGN);
111111
// var myFrame1 = text("this is frame 1", 30, 30, 300, 300);
112112
```
113113

114114
After you've generated the text frame
115115

116-
```
116+
```js
117117
// var myFrame1 = text("this is frame 1", 30, 30, 300, 300);
118118
typo(myFrame1, "justification", Justification.CENTER_ALIGN);
119119
```
@@ -136,7 +136,7 @@ Refer to the following list for setting various justifications:
136136

137137
Note: vertical justification of a text frame should be done before generating it, also using the [`textAlign()`](/reference/#textAlign) function.
138138

139-
```
139+
```js
140140
textAlign(Justification.FULLY_JUSTIFIED, VerticalJustification.CENTER_ALIGN);
141141
```
142142

@@ -157,7 +157,7 @@ Incase you are not opening an old project, create a new document and place a new
157157

158158
To begin let's get our selected text frame or text into something that we can refer to by code, a variable:
159159

160-
```
160+
```js
161161
// @includepath "~/Documents/;%USERPROFILE%Documents";
162162
// @include "basiljs/basil.js";
163163

@@ -170,7 +170,7 @@ This code is looking for an object or text that is selected and grabs the very f
170170

171171
Next let's break the selection down and isolate every single word within the text. Todo this, we have two ways to walk forward. Both accomplish the exact same task, but approach it quite differently.
172172

173-
```
173+
```js
174174
words(selItems, function(w, n){
175175
typo(w, "pointSize", n+1);
176176
});
@@ -180,7 +180,7 @@ The snippet above is the most efficient way to cycle through all of the words, o
180180

181181
Think about how long that would take you with the mouse...!
182182

183-
```
183+
```js
184184
var myWords = words(selItems);
185185

186186
for (var i = 0; i < myWords.length; i++) {
@@ -208,7 +208,7 @@ and test different combinations of modifying the content based on typo() or othe
208208
## 4. Example - Website typo
209209
Here is a quick script demonstrating how to recreate the headlines as seen on this website:
210210

211-
```
211+
```js
212212
// @includepath "~/Documents/;%USERPROFILE%Documents";
213213
// @include "basiljs/basil.js";
214214

0 commit comments

Comments
 (0)