Skip to content

Commit c9b9a22

Browse files
authored
Duplicate examples in luasnip-extra-match docs (#1279)
doc: remove duplicate examples in `luasnip-extra-match`.
1 parent 33b06d7 commit c9b9a22

File tree

2 files changed

+25
-37
lines changed

2 files changed

+25
-37
lines changed

DOC.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,32 +1349,24 @@ something other than strings).
13491349

13501350
Examples:
13511351

1352-
* `match(n, "^ABC$", "A")` .
1353-
* `match(n, lambda._1:match(lambda._1:reverse()), "PALINDROME")`
1352+
* `match(n, "^ABC$", "A")`
13541353

13551354
```lua
1356-
s("trig", {
1357-
i(1), t":",
1358-
i(2), t"::",
1359-
m({1, 2}, l._1:match("^"..l._2.."$"), l._1:gsub("a", "e"))
1360-
})
1361-
```
1362-
1363-
1364-
* ```lua
13651355
s("extras1", {
13661356
i(1), t { "", "" }, m(1, "^ABC$", "A")
13671357
})
13681358
```
13691359
Inserts "A" if the node with jump-index `n` matches "ABC" exactly, nothing otherwise.
13701360

13711361
<!-- panvimdoc-ignore-start -->
1372-
1362+
13731363
![extras1](https://user-images.githubusercontent.com/25300418/184359431-50f90599-3db0-4df0-a3a9-27013e663649.gif)
1374-
1364+
13751365
<!-- panvimdoc-ignore-end -->
13761366

1377-
* ```lua
1367+
* `match(n, lambda._1:match(lambda._1:reverse()), "PALINDROME")`
1368+
1369+
```lua
13781370
s("extras2", {
13791371
i(1, "INPUT"), t { "", "" }, m(1, l._1:match(l._1:reverse()), "PALINDROME")
13801372
})
@@ -1386,7 +1378,9 @@ Examples:
13861378
![extras2](https://user-images.githubusercontent.com/25300418/184359435-21e4de9f-c56b-4ee1-bff4-331b68e1c537.gif)
13871379

13881380
<!-- panvimdoc-ignore-end -->
1389-
* ```lua
1381+
* `match(n, lambda._1:match("^" .. lambda._2 .. "$"), lambda._1:gsub("a", "e"))`
1382+
1383+
```lua
13901384
s("extras3", {
13911385
i(1), t { "", "" }, i(2), t { "", "" },
13921386
m({ 1, 2 }, l._1:match("^" .. l._2 .. "$"), l._1:gsub("a", "e"))

doc/luasnip.txt

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*luasnip.txt* For NVIM v0.8.0 Last change: 2024 December 02
1+
*luasnip.txt* For NVIM v0.8.0 Last change: 2025 January 04
22

33
==============================================================================
44
Table of Contents *luasnip-table-of-contents*
@@ -1324,33 +1324,27 @@ parameters as specified above). `then`’s default-value depends on the
13241324

13251325
Examples:
13261326

1327-
- `match(n, "^ABC$", "A")`.
1328-
- `match(n, lambda._1:match(lambda._1:reverse()), "PALINDROME")`
1327+
- `match(n, "^ABC$", "A")`
13291328
>lua
1330-
s("trig", {
1331-
i(1), t":",
1332-
i(2), t"::",
1333-
m({1, 2}, l._1:match("^"..l._2.."$"), l._1:gsub("a", "e"))
1334-
})
1335-
<
1336-
- >lua
1337-
s("extras1", {
1338-
i(1), t { "", "" }, m(1, "^ABC$", "A")
1339-
})
1329+
s("extras1", {
1330+
i(1), t { "", "" }, m(1, "^ABC$", "A")
1331+
})
13401332
<
13411333
Inserts "A" if the node with jump-index `n` matches "ABC" exactly, nothing
13421334
otherwise.
1343-
- >lua
1344-
s("extras2", {
1345-
i(1, "INPUT"), t { "", "" }, m(1, l._1:match(l._1:reverse()), "PALINDROME")
1346-
})
1335+
- `match(n, lambda._1:match(lambda._1:reverse()), "PALINDROME")`
1336+
>lua
1337+
s("extras2", {
1338+
i(1, "INPUT"), t { "", "" }, m(1, l._1:match(l._1:reverse()), "PALINDROME")
1339+
})
13471340
<
13481341
Inserts `"PALINDROME"` if i(1) contains a palindrome.
1349-
- >lua
1350-
s("extras3", {
1351-
i(1), t { "", "" }, i(2), t { "", "" },
1352-
m({ 1, 2 }, l._1:match("^" .. l._2 .. "$"), l._1:gsub("a", "e"))
1353-
})
1342+
- `match(n, lambda._1:match("^" .. lambda._2 .. "$"), lambda._1:gsub("a", "e"))`
1343+
>lua
1344+
s("extras3", {
1345+
i(1), t { "", "" }, i(2), t { "", "" },
1346+
m({ 1, 2 }, l._1:match("^" .. l._2 .. "$"), l._1:gsub("a", "e"))
1347+
})
13541348
<
13551349
This inserts the text of the node with jump-index 1, with all occurrences of
13561350
`a` replaced with `e`, if the second insertNode matches the first exactly.

0 commit comments

Comments
 (0)