mirror of
https://github.com/rabirabirara/obsidian-jelly-snippets.git
synced 2026-07-22 07:30:22 +00:00
revert a4c6600
This doesn't work if the user doesn't add newlines for the snippets. It's also super manual and hacky. Better to have a solution that doesn't require precision.
This commit is contained in:
parent
a17c4d0dd4
commit
86ba8bfade
1 changed files with 4 additions and 8 deletions
12
main.ts
12
main.ts
|
|
@ -137,14 +137,10 @@ export default class JellySnippets extends Plugin {
|
|||
// go through the snippets file, split by the snippet divider, split by the part divider, put in map
|
||||
let snippetLines = this.settings.snippetsFile.split(snippetDivider);
|
||||
snippetLines.forEach((snippet, index) => {
|
||||
// All but first should trim left newline, all but last should trim right newline.
|
||||
if (index !== 0) {
|
||||
snippet = snippet.slice(1, undefined);
|
||||
}
|
||||
if (index !== snippetLines.length - 1) {
|
||||
snippet = snippet.slice(0, snippet.length - 1);
|
||||
}
|
||||
let snippetParts = snippet.split(this.settings.snippetPartDivider);
|
||||
// Trim newlines. Instead, use symbols to let people insert whitespace.
|
||||
let snippetParts = snippet
|
||||
.trim()
|
||||
.split(this.settings.snippetPartDivider);
|
||||
let lhs = snippetParts.shift();
|
||||
let rhs = snippetParts.join(this.settings.snippetPartDivider);
|
||||
if (lhs === undefined) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue