Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Commit 06163ce

Browse files
committed
update with spec
1 parent ff855ce commit 06163ce

File tree

1 file changed

+255
-3
lines changed

1 file changed

+255
-3
lines changed

README.md

Lines changed: 255 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,256 @@
1-
guideguide-notation-spec
2-
========================
1+
---
2+
layout: default
3+
permalink: /guideguide-notation/
4+
title: GuideGuide Notation
5+
description: Give GuideGuide instructions for detailed grids.
6+
---
37

4-
Spec for GuideGuide Notation
8+
# Think Beyond The Form
9+
10+
GuideGuide’s grid form is a great tool, but it is somewhat limited in what it can do. To give you more flexibility with your grids, GuideGuide includes a feature called GuideGuide Notation, a special language that allows you to give instructions to GuideGuide, telling it where you would like to put guides within your document or selection.
11+
12+
## Grids
13+
14+
> <guides and gaps> ( <options>, <grid width>, <grid offset> )
15+
16+
A grid is a collection of guides and gaps across a single dimentional plane. GuideGuide will split the string into an array of guides and gaps and iterate through them, following them like instructions. Starting at 0, for each gap, GuideGuide will advance its insertion point by the value of the gap. When GuideGuide encounters a guide, it will place a guide at the current location of the insertion point. This will continue until all guides and gaps have been parsed.
17+
18+
GuideGuide takes into acount the size of the document or selection when calculating percentages, wildcards, and fills.
19+
20+
Each guide or gap must be separated by a space character. Newlines are used to define multiple grids in one string.
21+
22+
It is possible to change the way GuideGuide renders the grid by specifiying options at the end of the grid, within parentheses. A width for the grid can be specified, as well as an offset to start rendering the grid. Whitespace in the options are is ignored.
23+
e.
24+
25+
#### Examples
26+
27+
- a guide at the top, right, bottom, and left of the document.
28+
29+
| ~ | (v)
30+
| ~ | (h)
31+
32+
33+
- a three row vertical grid
34+
35+
| ~ | ~ | ~ | ( v )
36+
37+
38+
- a one hundred pixel horizontal grid with a ten pixel left margin, ten pixel right margin, and a twenty pixel column centered in the middle
39+
40+
| 10px | ~ | 20px | ~ | 10px| ( h, 100px )
41+
42+
43+
- a grid with a left side bar with 10px on either side, and a five columns filling the gap.
44+
45+
| 10px | 200px | 10px | ~ | ~ | ~ |
46+
47+
## Unit objects
48+
49+
> <value><unit>
50+
51+
Unit objects are value-unit pairs that indicate a measurement.
52+
53+
#### Examples
54+
55+
- `72px`
56+
- `1in`
57+
- `2.54cm`
58+
- `25.4mm`
59+
- `72pts`
60+
- `6pica`
61+
- `100%`
62+
63+
## Guides
64+
65+
Guides are represented by a pipe `|`. These tell GuideGuide to place a guide at the current insertion point.
66+
67+
## Gaps
68+
69+
Gaps are unit objects or variables combined with multipliers to define spaces between gaps.
70+
71+
### Arbitrary gaps
72+
73+
> <value><unit>*<multiplier>
74+
75+
An arbitrary gap is represented by a Unit Object and an optional multiplier. Arbitrary gaps are the width of the unit specified. Arbitrary can be positive or negative. Due to this, it is possible to traverse backwards and forwards.
76+
77+
#### Examples
78+
79+
- `| 10px | 10px | 10px|`
80+
three ten pixel columns
81+
82+
- `| .5in | 1in | .5in |`
83+
one half inch column, one inch column, one half inch column
84+
85+
### Wildcard gaps
86+
87+
A wildcard hunk is represented by a tilde `~`. Any area within a grid that remains after all of the arbitrary hunks have been calculated will be evenly distributed amongst the wildcards present in a grid.
88+
89+
Due to their flexible nature, wildcards can be used to position a grid. When a single wildcard is placed to the left of a GGN string, it will force the grid to render on the right side. Similarly, a GGN string with wildcards on either end will be centered.
90+
91+
#### Examples
92+
93+
- `| ~ |`
94+
A guide on the left and right side of the document or selection.
95+
96+
- `| ~ | ~ | ~ |`
97+
A three column grid
98+
99+
### Variables
100+
101+
Variables allow you to define and reuse collections of hunks within a grid. Variables are composed of a definition and a call.
102+
103+
#### Define
104+
105+
> $<id> = <hunks>
106+
107+
A variable definition is represented by a dollar sign `$`, an optional id, an equals sign, and then a collection of gaps and guides separated by spaces.
108+
109+
While it is possible to define a variable that contains no guides, this won't often be useful as the results of the variable will not be visible (since it contains no guides).
110+
111+
#### Call
112+
113+
> $<id>*<multiplier>
114+
115+
A variable call is represented by a dollar sign `$`, an optional id, and an optional multiplier. Anywhere a variable call occurs GuideGuide will replace its contents with the contents of its variable definition. A variable must be defined before it is called.
116+
117+
#### Example
118+
119+
```
120+
$ = ~ |
121+
| $*2
122+
```
123+
124+
expands to:
125+
126+
```
127+
| ~ | ~ | ~ |
128+
```
129+
130+
a three column grid
131+
132+
133+
### Multiples and fills
134+
135+
Arbitray, wildcard, and variable gaps can accept a final modifier that will duplicate that gap the number of times specified. These are most helpful when used with variables, as it is possible to specify both gaps and guide together. Multiples and fills can be specified on gaps, but since the result of the mutiplied gap is not visible, their usefulness is rare.
136+
137+
#### Multiple
138+
139+
A multiple is represented by an asterisk `*` followed by a number. The hunk will be recreated sequentially the number of times specified by the multiple
140+
141+
#### Examples
142+
143+
- `| ~*2 | ~ |`
144+
Two thirds column, one third column
145+
146+
- ```
147+
$ = ~ | 10px |
148+
| $*2 ~ |
149+
```
150+
A three column grid with ten pixel gutters
151+
152+
#### Fill
153+
154+
A fill is represented by a asterisk `*` folowed by nothing and is a gap that will be recreated squentially until it fills the remaining space in the grid. This is useful for cases such as creating a baseline grid, or filling a space with as many columns and gutters of a certain width as will fit.
155+
156+
- ```
157+
$ = 16px |
158+
| $* ( v )
159+
```
160+
A sixteen pixel baseline grid
161+
162+
163+
## Grid Options
164+
165+
Optional values to modify how the grid is created.
166+
167+
### Orientation
168+
169+
Determines the direction the grid will be rendered, whether horizontal or vertical. Orientation options are *not* case sensitve.
170+
171+
#### Values:
172+
173+
- `h` *(default)*
174+
horizontal
175+
176+
- `v`
177+
vertical
178+
179+
### Position
180+
181+
Determines the position where GuideGuide renders the grid in cases where the grid specified is not as wide as the document or selection. Note the capital letters.
182+
183+
#### Values:
184+
185+
- `F`*(default)*
186+
first (left/top)
187+
188+
- `C`
189+
center
190+
191+
- `L`
192+
last (right/bottom)
193+
194+
### Remainder pixel distribution
195+
196+
Determines to which wildcards GuideGuide adds remainder pixels when the columns do not divide equally into the total width of the grid area. Note the lowercase letters.
197+
198+
#### Values:
199+
200+
- `f`*(default)*
201+
first (left/top)
202+
203+
- `c`
204+
center
205+
206+
- `l`
207+
last (right/bottom)
208+
209+
### Calculation
210+
211+
Determines whether GuideGuide is strict about integers when calculating pixels
212+
213+
#### Values:
214+
215+
- `n` *(default)*
216+
normal
217+
218+
- `p`
219+
pixel specific
220+
221+
### Grid width
222+
223+
Optional unit object that specifies the width of the grid area to be used for the calculation. Must be a positive value. The width option can be left blank.
224+
225+
#### Examples:
226+
227+
- `| ~ | ~ | ~ | ( h, 100px )`
228+
A three column grid that is one hundred pixels wide.
229+
230+
### Grid offset
231+
232+
Optional unit object that specifies how far from the origin the grid will be offset. When the position of a grid is set to `center` the offset property will be ignored.
233+
234+
#### Examples
235+
236+
- `| 10px | ( hF, , 50px )`
237+
A ten pixel column that sits 50px from the left side of the document/selection
238+
239+
- `| 10px | ( hL, , 50px )`
240+
A ten pixel column that sits 50px from the right site of the doucment/selection
241+
242+
- `| 10px | ( hL, 100px, 30px)`
243+
A ten pixel wide column that sits 30px from the right side of a 100px selection.
244+
245+
## Errors
246+
247+
GuideGuide String Notation errors will be denoted in curly brackets. Directly following a bracketed error will be a set of brackets containing a comma separated list of error IDs. Explanation of the errors will be printed below the grid.
248+
249+
250+
### Hunk errors
251+
252+
```
253+
| 10px | { 10foo [1]} | 10px|
254+
255+
# 1. Unrecognized unit type
256+
```

0 commit comments

Comments
 (0)