fix(reference:api): Revert incorrect Example formatting (#367)
This PR reverts the incorrect lint/prettier changes applied to <Example> code in the reference Core API docs l by the husky pre-commit hook, the problem mentioned in Issue #333. (These are just the changes for the Core API docs. Additional PRs will be filed for changes in the other reference, howtos, and guides documentation.) Co-authored-by: Benjamin Fan <ben-git@swinglonga.com> Reviewed-on: https://codeberg.org/freesewing/freesewing/pulls/367 Reviewed-by: Joost De Cock <joostdecock@noreply.codeberg.org> Co-authored-by: Benjamin Fan <benjamesben@noreply.codeberg.org> Co-committed-by: Benjamin Fan <benjamesben@noreply.codeberg.org>
This commit is contained in:
parent
a7eb3e0072
commit
ed8a166ea9
34 changed files with 421 additions and 471 deletions
|
@ -30,8 +30,7 @@ paths.line = new Path()
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
```
|
||||||
````
|
|
||||||
</Example>
|
</Example>
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
@ -42,4 +41,4 @@ as the two following calls yield the same result:
|
||||||
```js
|
```js
|
||||||
path.attr('class', 'fabric')
|
path.attr('class', 'fabric')
|
||||||
path.addClass('fabric')
|
path.addClass('fabric')
|
||||||
````
|
```
|
||||||
|
|
|
@ -31,8 +31,7 @@ paths.line = new Path()
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
```
|
||||||
````
|
|
||||||
</Example>
|
</Example>
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
@ -43,7 +42,7 @@ as the two following calls yield the same result:
|
||||||
```js
|
```js
|
||||||
path.attr('data-text', 'Hello')
|
path.attr('data-text', 'Hello')
|
||||||
path.addText('Hello')
|
path.addText('Hello')
|
||||||
````
|
```
|
||||||
|
|
||||||
The difference with [Path.setText()](/reference/api/path/addtext) is that this
|
The difference with [Path.setText()](/reference/api/path/addtext) is that this
|
||||||
method will add to the existing text whereas `Path.setText()` will overwrite
|
method will add to the existing text whereas `Path.setText()` will overwrite
|
||||||
|
|
|
@ -41,7 +41,6 @@ paths.example = new Path()
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
|
|
||||||
|
@ -57,4 +56,3 @@ all call this method under the hood.
|
||||||
|
|
||||||
See [Using Attributes](/howtos/code/attributes)
|
See [Using Attributes](/howtos/code/attributes)
|
||||||
for information about custom Attributes that can be used with Paths.
|
for information about custom Attributes that can be used with Paths.
|
||||||
```
|
|
||||||
|
|
|
@ -55,4 +55,3 @@ return part
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
```
|
|
||||||
|
|
|
@ -26,14 +26,12 @@ points.to = new Point(90, 20)
|
||||||
|
|
||||||
paths.line = new Path()
|
paths.line = new Path()
|
||||||
.move(points.from)
|
.move(points.from)
|
||||||
.\_curve(points.cp2, points.to)
|
._curve(points.cp2, points.to)
|
||||||
.close()
|
.close()
|
||||||
.reverse() // To keep text from being upside-down
|
.reverse() // To keep text from being upside-down
|
||||||
.setText('Path.\_close()', 'text-sm right fill-note')
|
.setText('Path._close()', 'text-sm right fill-note')
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
```
|
|
||||||
|
|
|
@ -33,7 +33,5 @@ paths.line = new Path()
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
```
|
|
||||||
|
|
|
@ -18,10 +18,12 @@ This method is chainable as it returns the `Path` object
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
|
||||||
<Example caption="Example of the Path.curve\_() method">
|
<Example caption="Example of the Path.curve\_() method">
|
||||||
|
|
||||||
```js
|
```js
|
||||||
;({ Point, points, Path, paths, part }) => {
|
({ Point, points, Path, paths, part }) => {
|
||||||
|
|
||||||
points.from = new Point(10, 20)
|
points.from = new Point(10, 20)
|
||||||
points.cp1 = new Point(40, 0)
|
points.cp1 = new Point(40, 0)
|
||||||
points.to = new Point(90, 20)
|
points.to = new Point(90, 20)
|
||||||
|
@ -29,8 +31,8 @@ This method is chainable as it returns the `Path` object
|
||||||
paths.line = new Path()
|
paths.line = new Path()
|
||||||
.move(points.from)
|
.move(points.from)
|
||||||
.curve_(points.cp1, points.to)
|
.curve_(points.cp1, points.to)
|
||||||
.setText('Path.curve_()', 'text-sm center fill-note')
|
.setText("Path.curve_()", "text-sm center fill-note")
|
||||||
.attr('data-text-dy', -1)
|
.attr("data-text-dy", -1)
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,5 @@ snippets.end = new Snippet("notch", paths.demo.end())
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
```
|
|
||||||
|
|
|
@ -30,7 +30,5 @@ paths.c = new Path().move(points.left).line(points.top).setText('c')
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
```
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ Path path.insop(string id, Path path)
|
||||||
This method is chainable as it returns the `Path` object
|
This method is chainable as it returns the `Path` object
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
|
||||||
<Example caption="Example of the Path.insop() method">
|
<Example caption="Example of the Path.insop() method">
|
||||||
```js
|
```js
|
||||||
({ Point, points, Path, paths, part }) => {
|
({ Point, points, Path, paths, part }) => {
|
||||||
|
@ -43,11 +44,9 @@ new Path()
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
This is often used to insert darts into a path.
|
This is often used to insert darts into a path.
|
||||||
```
|
|
||||||
|
|
|
@ -31,7 +31,5 @@ paths.line = new Path()
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
```
|
|
||||||
|
|
|
@ -46,7 +46,5 @@ new Path()
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
```
|
|
||||||
|
|
|
@ -30,8 +30,7 @@ paths.line = new Path()
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
```
|
||||||
````
|
|
||||||
</Example>
|
</Example>
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
@ -42,4 +41,4 @@ as the two following calls yield the same result:
|
||||||
```js
|
```js
|
||||||
path.attr('class', 'fabric', true)
|
path.attr('class', 'fabric', true)
|
||||||
path.setClass('fabric')
|
path.setClass('fabric')
|
||||||
````
|
```
|
||||||
|
|
|
@ -31,7 +31,5 @@ paths.c = new Path().move(points.left).line(points.top).setText('c')
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
```
|
|
||||||
|
|
|
@ -31,8 +31,7 @@ paths.line = new Path()
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
```
|
||||||
````
|
|
||||||
</Example>
|
</Example>
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
@ -43,7 +42,7 @@ as the two following calls yield the same result:
|
||||||
```js
|
```js
|
||||||
path.attr('data-text', 'Hello')
|
path.attr('data-text', 'Hello')
|
||||||
path.setText('Hello')
|
path.setText('Hello')
|
||||||
````
|
```
|
||||||
|
|
||||||
The difference with [Path.addText()](/reference/api/path/addtext) is that this
|
The difference with [Path.addText()](/reference/api/path/addtext) is that this
|
||||||
method will overwrite existing text on the path, whereas `Path.addText()` will
|
method will overwrite existing text on the path, whereas `Path.addText()` will
|
||||||
|
|
|
@ -38,7 +38,5 @@ paths.smurve = new Path()
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
```
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ Path path.smurve_(Point cp2, Point end)
|
||||||
```
|
```
|
||||||
|
|
||||||
:::tip
|
:::tip
|
||||||
This method is chainable as it returns the `Path` object
|
This method is chainable as it returns the `Path` objecti
|
||||||
:::
|
:::
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
@ -33,13 +33,11 @@ points.bTo = new Point(10,50)
|
||||||
paths.smurve = new Path()
|
paths.smurve = new Path()
|
||||||
.move(points.aFrom)
|
.move(points.aFrom)
|
||||||
.curve(points.aCp1, points.aCp2,points.aTo)
|
.curve(points.aCp1, points.aCp2,points.aTo)
|
||||||
.smurve\_(points.bTo)
|
.smurve_(points.bTo)
|
||||||
.reverse() // Puts text at the end
|
.reverse() // Puts text at the end
|
||||||
.setText('Path.smurve()')
|
.setText('Path.smurve()')
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
```
|
|
||||||
|
|
|
@ -35,7 +35,5 @@ snippets.end = new Snippet("notch", paths.demo.start())
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
```
|
|
||||||
|
|
|
@ -29,8 +29,8 @@ points.to = new Point(90, 20)
|
||||||
|
|
||||||
paths.line = new Path()
|
paths.line = new Path()
|
||||||
.move(points.from)
|
.move(points.from)
|
||||||
.\_curve(points.cp2, points.to)
|
._curve(points.cp2, points.to)
|
||||||
.setText("Path.\_curve()", "text-sm center fill-note")
|
.setText("Path._curve()", "text-sm center fill-note")
|
||||||
.attr("data-text-dy", -1)
|
.attr("data-text-dy", -1)
|
||||||
|
|
||||||
return part
|
return part
|
||||||
|
|
|
@ -32,7 +32,5 @@ paths.c = new Path().move(points.left).line(points.top).setText('c')
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
```
|
|
||||||
|
|
|
@ -41,7 +41,5 @@ points.c = new Point(70, 10)
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
```
|
|
||||||
|
|
|
@ -34,13 +34,12 @@ paths.hidden = new Path()
|
||||||
.line(points.anchor.shift(0, 80))
|
.line(points.anchor.shift(0, 80))
|
||||||
.addClass('hidden')
|
.addClass('hidden')
|
||||||
|
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
Remember to [use translation keys, not text](/guides/best-practices#use-translation-keys)
|
Remember to [use translation keys, not text](/guides/best-practices#use-translation-keys)
|
||||||
```
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ Point point.attr(
|
||||||
|
|
||||||
If the third parameter is set to `true` it will call [`this.attributes.set()`](/reference/api/attributes/set/) instead, thereby overwriting the value of the attribute.
|
If the third parameter is set to `true` it will call [`this.attributes.set()`](/reference/api/attributes/set/) instead, thereby overwriting the value of the attribute.
|
||||||
|
|
||||||
|
|
||||||
:::tip
|
:::tip
|
||||||
This method is chainable as it returns the `Point` object
|
This method is chainable as it returns the `Point` object
|
||||||
:::
|
:::
|
||||||
|
@ -40,7 +41,6 @@ paths.hidden = new Path()
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
|
|
||||||
|
@ -48,4 +48,3 @@ return part
|
||||||
|
|
||||||
See [Using Attributes](/howtos/code/attributes)
|
See [Using Attributes](/howtos/code/attributes)
|
||||||
for information about custom Attributes that can be used with Points.
|
for information about custom Attributes that can be used with Points.
|
||||||
```
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ paths.hidden = new Path()
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
|
|
||||||
|
@ -46,4 +45,3 @@ return part
|
||||||
The [`Point.copy()`](/reference/api/point/copy/) method will only copy the
|
The [`Point.copy()`](/reference/api/point/copy/) method will only copy the
|
||||||
point's coordinates, whereas this `Point.clone()` method will also copy its
|
point's coordinates, whereas this `Point.clone()` method will also copy its
|
||||||
attributes.
|
attributes.
|
||||||
```
|
|
||||||
|
|
|
@ -48,7 +48,5 @@ points.c = new Point(70, 10)
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
```
|
|
||||||
|
|
|
@ -37,11 +37,9 @@ paths.hidden = new Path()
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
Remember to [use translation keys, not text](/guides/best-practices#use-translation-keys)
|
Remember to [use translation keys, not text](/guides/best-practices#use-translation-keys)
|
||||||
```
|
|
||||||
|
|
|
@ -40,7 +40,6 @@ paths.diag = new Path()
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
|
|
||||||
|
@ -48,4 +47,3 @@ return part
|
||||||
See [Using Attributes](/howtos/code/attributes)
|
See [Using Attributes](/howtos/code/attributes)
|
||||||
for information about what Attributes can be used with Snippets.
|
for information about what Attributes can be used with Snippets.
|
||||||
:::
|
:::
|
||||||
```
|
|
||||||
|
|
|
@ -35,8 +35,6 @@ paths.diag = new Path()
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
|
|
||||||
```
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ This method is chainable as it returns the `Snippet` object
|
||||||
for (const i of [1,2,3,4,5,6]) {
|
for (const i of [1,2,3,4,5,6]) {
|
||||||
snippets[`demo${i}`] = new Snippet(
|
snippets[`demo${i}`] = new Snippet(
|
||||||
"logo",
|
"logo",
|
||||||
new Point(30\*i, 0)
|
new Point(30*i, 0)
|
||||||
).scale(i/10)
|
).scale(i/10)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,8 +35,6 @@ paths.diag = new Path()
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
|
|
||||||
```
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ Point | false utils.beamIntersectsLine(
|
||||||
<Example caption="A Utils.beamIntersectsLine() example">
|
<Example caption="A Utils.beamIntersectsLine() example">
|
||||||
|
|
||||||
```js
|
```js
|
||||||
;({ Point, points, Path, paths, Snippet, snippets, utils, part }) => {
|
({ Point, points, Path, paths, Snippet, snippets, utils, part }) => {
|
||||||
points.A = new Point(45, 20)
|
points.A = new Point(45, 20)
|
||||||
points.B = new Point(60, 15)
|
points.B = new Point(60, 15)
|
||||||
points.C = new Point(10, 10)
|
points.C = new Point(10, 10)
|
||||||
|
|
|
@ -62,7 +62,6 @@ snippets[p.y] = new Snippet("notch", p)
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
|
|
||||||
|
@ -73,4 +72,3 @@ This is a low-level (and faster) variant
|
||||||
of [`Path.intersectsX()`](/reference/api/path/intersectsx).
|
of [`Path.intersectsX()`](/reference/api/path/intersectsx).
|
||||||
Instead of a path, you describe a single curve by passing the four
|
Instead of a path, you describe a single curve by passing the four
|
||||||
points that describes it.
|
points that describes it.
|
||||||
```
|
|
||||||
|
|
|
@ -22,8 +22,8 @@ a single intersection is found, and an array
|
||||||
of [Point](/reference/api/point/) objects if
|
of [Point](/reference/api/point/) objects if
|
||||||
multiple intersections are found.
|
multiple intersections are found.
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
|
## Example
|
||||||
<Example caption="A Utils.curveIntersectY() example">
|
<Example caption="A Utils.curveIntersectY() example">
|
||||||
```js
|
```js
|
||||||
({ Point, points, Path, paths, Snippet, snippets, utils, part }) => {
|
({ Point, points, Path, paths, Snippet, snippets, utils, part }) => {
|
||||||
|
@ -62,7 +62,6 @@ snippets[p.x] = new Snippet("notch", p)
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
|
|
||||||
|
@ -72,4 +71,3 @@ This is a low-level (and faster) variant
|
||||||
of [`Path.intersectsY()`](/reference/api/path/intersectsy).
|
of [`Path.intersectsY()`](/reference/api/path/intersectsy).
|
||||||
Instead of a path, you describe a single curve by passing the four
|
Instead of a path, you describe a single curve by passing the four
|
||||||
points that describes it.
|
points that describes it.
|
||||||
```
|
|
||||||
|
|
|
@ -69,7 +69,5 @@ snippets[getId()] = new Snippet('notch', intersections)
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
</Example>
|
</Example>
|
||||||
```
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue