Skip to content

Commit

Permalink
Do not include code blocks in transclusions extraction
Browse files Browse the repository at this point in the history
Any transclusion done inside a code block, like

`{{Example}}` or

```
{{Example}}
```

Is not considered when extracting transclusion patterns from the text
body.
  • Loading branch information
talha131 committed Nov 11, 2022
1 parent 9eed10f commit f9bc920
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type: text/vnd.tiddlywiki

\define back-transclusion-pattern() {{\s*$(currentTiddler)$((\s*\|{2}[^{^}]+)|(!{2}[^\{^\}]+)|)}}
\define escapechars-pattern() ([\?\.\*\+\(\)\$\^\\])
\define code-pattern() `[\s\S]+`

<!-- transclusion of current tiddler by other tiddlers -->
\define back-transclusion-filter()
Expand All @@ -17,7 +18,7 @@ type: text/vnd.tiddlywiki

<!-- transclusion of other tiddlers in the current tiddler -->
\define transclusion-filter()
[all[current]get[text]splitregexp[\n]unique[]split[{{]butfirst[]]
[all[current]get[text]search-replace:g:regexp<code-pattern>,[]splitregexp[\n]unique[]split[{{]butfirst[]]
:filter[!prefix[{]search:title[}}]]
:map[split[}}]first[]trim[]]
:map[split[!!]first[]trim[]]
Expand Down

0 comments on commit f9bc920

Please sign in to comment.