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
|
||||
}
|
||||
|
||||
````
|
||||
```
|
||||
</Example>
|
||||
|
||||
## Notes
|
||||
|
@ -42,4 +41,4 @@ as the two following calls yield the same result:
|
|||
```js
|
||||
path.attr('class', 'fabric')
|
||||
path.addClass('fabric')
|
||||
````
|
||||
```
|
||||
|
|
|
@ -31,8 +31,7 @@ paths.line = new Path()
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
````
|
||||
```
|
||||
</Example>
|
||||
|
||||
## Notes
|
||||
|
@ -43,7 +42,7 @@ as the two following calls yield the same result:
|
|||
```js
|
||||
path.attr('data-text', 'Hello')
|
||||
path.addText('Hello')
|
||||
````
|
||||
```
|
||||
|
||||
The difference with [Path.setText()](/reference/api/path/addtext) is that this
|
||||
method will add to the existing text whereas `Path.setText()` will overwrite
|
||||
|
|
|
@ -41,7 +41,6 @@ paths.example = new Path()
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
|
||||
|
@ -57,4 +56,3 @@ all call this method under the hood.
|
|||
|
||||
See [Using Attributes](/howtos/code/attributes)
|
||||
for information about custom Attributes that can be used with Paths.
|
||||
```
|
||||
|
|
|
@ -55,4 +55,3 @@ return part
|
|||
|
||||
```
|
||||
</Example>
|
||||
```
|
||||
|
|
|
@ -26,14 +26,12 @@ points.to = new Point(90, 20)
|
|||
|
||||
paths.line = new Path()
|
||||
.move(points.from)
|
||||
.\_curve(points.cp2, points.to)
|
||||
._curve(points.cp2, points.to)
|
||||
.close()
|
||||
.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
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
```
|
||||
|
|
|
@ -33,7 +33,5 @@ paths.line = new Path()
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
```
|
||||
|
|
|
@ -18,10 +18,12 @@ This method is chainable as it returns the `Path` object
|
|||
|
||||
## Example
|
||||
|
||||
|
||||
<Example caption="Example of the Path.curve\_() method">
|
||||
|
||||
```js
|
||||
;({ Point, points, Path, paths, part }) => {
|
||||
({ Point, points, Path, paths, part }) => {
|
||||
|
||||
points.from = new Point(10, 20)
|
||||
points.cp1 = new Point(40, 0)
|
||||
points.to = new Point(90, 20)
|
||||
|
@ -29,8 +31,8 @@ This method is chainable as it returns the `Path` object
|
|||
paths.line = new Path()
|
||||
.move(points.from)
|
||||
.curve_(points.cp1, points.to)
|
||||
.setText('Path.curve_()', 'text-sm center fill-note')
|
||||
.attr('data-text-dy', -1)
|
||||
.setText("Path.curve_()", "text-sm center fill-note")
|
||||
.attr("data-text-dy", -1)
|
||||
|
||||
return part
|
||||
}
|
||||
|
|
|
@ -35,7 +35,5 @@ snippets.end = new Snippet("notch", paths.demo.end())
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
```
|
||||
|
|
|
@ -30,7 +30,5 @@ paths.c = new Path().move(points.left).line(points.top).setText('c')
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
```
|
||||
|
|
|
@ -15,6 +15,7 @@ Path path.insop(string id, Path path)
|
|||
This method is chainable as it returns the `Path` object
|
||||
:::
|
||||
|
||||
|
||||
<Example caption="Example of the Path.insop() method">
|
||||
```js
|
||||
({ Point, points, Path, paths, part }) => {
|
||||
|
@ -43,11 +44,9 @@ new Path()
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
|
||||
## Notes
|
||||
|
||||
This is often used to insert darts into a path.
|
||||
```
|
||||
|
|
|
@ -31,7 +31,5 @@ paths.line = new Path()
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
```
|
||||
|
|
|
@ -46,7 +46,5 @@ new Path()
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
```
|
||||
|
|
|
@ -30,8 +30,7 @@ paths.line = new Path()
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
````
|
||||
```
|
||||
</Example>
|
||||
|
||||
## Notes
|
||||
|
@ -42,4 +41,4 @@ as the two following calls yield the same result:
|
|||
```js
|
||||
path.attr('class', 'fabric', true)
|
||||
path.setClass('fabric')
|
||||
````
|
||||
```
|
||||
|
|
|
@ -31,7 +31,5 @@ paths.c = new Path().move(points.left).line(points.top).setText('c')
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
```
|
||||
|
|
|
@ -31,8 +31,7 @@ paths.line = new Path()
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
````
|
||||
```
|
||||
</Example>
|
||||
|
||||
## Notes
|
||||
|
@ -43,7 +42,7 @@ as the two following calls yield the same result:
|
|||
```js
|
||||
path.attr('data-text', 'Hello')
|
||||
path.setText('Hello')
|
||||
````
|
||||
```
|
||||
|
||||
The difference with [Path.addText()](/reference/api/path/addtext) is that this
|
||||
method will overwrite existing text on the path, whereas `Path.addText()` will
|
||||
|
|
|
@ -38,7 +38,5 @@ paths.smurve = new Path()
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
```
|
||||
|
|
|
@ -14,7 +14,7 @@ Path path.smurve_(Point cp2, Point end)
|
|||
```
|
||||
|
||||
:::tip
|
||||
This method is chainable as it returns the `Path` object
|
||||
This method is chainable as it returns the `Path` objecti
|
||||
:::
|
||||
|
||||
## Example
|
||||
|
@ -33,13 +33,11 @@ points.bTo = new Point(10,50)
|
|||
paths.smurve = new Path()
|
||||
.move(points.aFrom)
|
||||
.curve(points.aCp1, points.aCp2,points.aTo)
|
||||
.smurve\_(points.bTo)
|
||||
.smurve_(points.bTo)
|
||||
.reverse() // Puts text at the end
|
||||
.setText('Path.smurve()')
|
||||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
```
|
||||
|
|
|
@ -35,7 +35,5 @@ snippets.end = new Snippet("notch", paths.demo.start())
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
```
|
||||
|
|
|
@ -29,8 +29,8 @@ points.to = new Point(90, 20)
|
|||
|
||||
paths.line = new Path()
|
||||
.move(points.from)
|
||||
.\_curve(points.cp2, points.to)
|
||||
.setText("Path.\_curve()", "text-sm center fill-note")
|
||||
._curve(points.cp2, points.to)
|
||||
.setText("Path._curve()", "text-sm center fill-note")
|
||||
.attr("data-text-dy", -1)
|
||||
|
||||
return part
|
||||
|
|
|
@ -32,7 +32,5 @@ paths.c = new Path().move(points.left).line(points.top).setText('c')
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
```
|
||||
|
|
|
@ -41,7 +41,5 @@ points.c = new Point(70, 10)
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
```
|
||||
|
|
|
@ -34,13 +34,12 @@ paths.hidden = new Path()
|
|||
.line(points.anchor.shift(0, 80))
|
||||
.addClass('hidden')
|
||||
|
||||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
|
||||
## Notes
|
||||
|
||||
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.
|
||||
|
||||
|
||||
:::tip
|
||||
This method is chainable as it returns the `Point` object
|
||||
:::
|
||||
|
@ -40,7 +41,6 @@ paths.hidden = new Path()
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
|
||||
|
@ -48,4 +48,3 @@ return part
|
|||
|
||||
See [Using Attributes](/howtos/code/attributes)
|
||||
for information about custom Attributes that can be used with Points.
|
||||
```
|
||||
|
|
|
@ -36,7 +36,6 @@ paths.hidden = new Path()
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
|
||||
|
@ -46,4 +45,3 @@ return part
|
|||
The [`Point.copy()`](/reference/api/point/copy/) method will only copy the
|
||||
point's coordinates, whereas this `Point.clone()` method will also copy its
|
||||
attributes.
|
||||
```
|
||||
|
|
|
@ -48,7 +48,5 @@ points.c = new Point(70, 10)
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
```
|
||||
|
|
|
@ -37,11 +37,9 @@ paths.hidden = new Path()
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
|
||||
## Notes
|
||||
|
||||
Remember to [use translation keys, not text](/guides/best-practices#use-translation-keys)
|
||||
```
|
||||
|
|
|
@ -40,7 +40,6 @@ paths.diag = new Path()
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
|
||||
|
@ -48,4 +47,3 @@ return part
|
|||
See [Using Attributes](/howtos/code/attributes)
|
||||
for information about what Attributes can be used with Snippets.
|
||||
:::
|
||||
```
|
||||
|
|
|
@ -35,8 +35,6 @@ paths.diag = new Path()
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</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]) {
|
||||
snippets[`demo${i}`] = new Snippet(
|
||||
"logo",
|
||||
new Point(30\*i, 0)
|
||||
new Point(30*i, 0)
|
||||
).scale(i/10)
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,6 @@ paths.diag = new Path()
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
|
||||
```
|
||||
|
|
|
@ -24,7 +24,7 @@ Point | false utils.beamIntersectsLine(
|
|||
<Example caption="A Utils.beamIntersectsLine() example">
|
||||
|
||||
```js
|
||||
;({ Point, points, Path, paths, Snippet, snippets, utils, part }) => {
|
||||
({ Point, points, Path, paths, Snippet, snippets, utils, part }) => {
|
||||
points.A = new Point(45, 20)
|
||||
points.B = new Point(60, 15)
|
||||
points.C = new Point(10, 10)
|
||||
|
|
|
@ -62,7 +62,6 @@ snippets[p.y] = new Snippet("notch", p)
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
|
||||
|
@ -73,4 +72,3 @@ This is a low-level (and faster) variant
|
|||
of [`Path.intersectsX()`](/reference/api/path/intersectsx).
|
||||
Instead of a path, you describe a single curve by passing the four
|
||||
points that describes it.
|
||||
```
|
||||
|
|
|
@ -22,8 +22,8 @@ a single intersection is found, and an array
|
|||
of [Point](/reference/api/point/) objects if
|
||||
multiple intersections are found.
|
||||
|
||||
## Example
|
||||
|
||||
## Example
|
||||
<Example caption="A Utils.curveIntersectY() example">
|
||||
```js
|
||||
({ Point, points, Path, paths, Snippet, snippets, utils, part }) => {
|
||||
|
@ -62,7 +62,6 @@ snippets[p.x] = new Snippet("notch", p)
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
|
||||
|
@ -72,4 +71,3 @@ This is a low-level (and faster) variant
|
|||
of [`Path.intersectsY()`](/reference/api/path/intersectsy).
|
||||
Instead of a path, you describe a single curve by passing the four
|
||||
points that describes it.
|
||||
```
|
||||
|
|
|
@ -69,7 +69,5 @@ snippets[getId()] = new Snippet('notch', intersections)
|
|||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue