1
0
Fork 0

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:
Benjamin Fan 2025-05-19 08:04:05 +02:00 committed by Joost De Cock
parent a7eb3e0072
commit ed8a166ea9
34 changed files with 421 additions and 471 deletions

View file

@ -3,7 +3,7 @@ title: Snippet.attr()
---
The `Snippet.attr()` method can be used to add attributes to the Snippet
object. It calls `this.attributes.add()` under the hood, and returns the
object. It calls `this.attributes.add()` under the hood, and returns the
Snippet object.
If the third parameter is set to `true` it will call `this.attributes.set()`
@ -29,18 +29,17 @@ This method is chainable as it returns the `Snippet` object
```js
({ Point, points, Path, paths, Snippet, snippets, part }) => {
snippets.logo = new Snippet('logo', new Point(0,0))
.attr("data-scale", 0.75)
.attr("data-rotate", 180)
snippets.logo = new Snippet('logo', new Point(0,0))
.attr("data-scale", 0.75)
.attr("data-rotate", 180)
// Prevent clipping
paths.diag = new Path()
.move(new Point(-25,-10))
.move(new Point(25,35))
// Prevent clipping
paths.diag = new Path()
.move(new Point(-25,-10))
.move(new Point(25,35))
return part
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.
:::
```

View file

@ -21,22 +21,20 @@ This method is chainable as it returns the `Snippet` object
```js
({ Point, Path, paths, Snippet, snippets, part }) => {
for (const i of [0,1,2,3,4,5,6]) {
snippets[`demo${i}`] = new Snippet(
"logo",
new Point(60*i, 0)
).rotate(60 * i)
for (const i of [0,1,2,3,4,5,6]) {
snippets[`demo${i}`] = new Snippet(
"logo",
new Point(60*i, 0)
).rotate(60 * i)
}
// Prevent clipping
paths.diag = new Path()
.move(new Point(-30,-50))
.move(new Point(400,50))
return part
}
// Prevent clipping
paths.diag = new Path()
.move(new Point(-30,-50))
.move(new Point(400,50))
return part
}
```
</Example>
```

View file

@ -21,22 +21,20 @@ This method is chainable as it returns the `Snippet` object
```js
({ Point, Path, paths, Snippet, snippets, part }) => {
for (const i of [1,2,3,4,5,6]) {
snippets[`demo${i}`] = new Snippet(
"logo",
new Point(30\*i, 0)
).scale(i/10)
for (const i of [1,2,3,4,5,6]) {
snippets[`demo${i}`] = new Snippet(
"logo",
new Point(30*i, 0)
).scale(i/10)
}
// Prevent clipping
paths.diag = new Path()
.move(new Point(0,-30))
.move(new Point(200,20))
return part
}
// Prevent clipping
paths.diag = new Path()
.move(new Point(0,-30))
.move(new Point(200,20))
return part
}
```
</Example>
```