-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2980d4a
commit a8c7552
Showing
13 changed files
with
126 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{title-block}# {title}{end-title-block} | ||
|
||
{tags-array-block} | ||
--- | ||
Tags: {tags-array} | ||
|
||
--- | ||
{end-tags-array-block} | ||
|
||
{content-block}{content}{end-content-block} | ||
|
||
{created-at-block} Created at: {created-at}{end-created-at-block} | ||
{updated-at-block} Updated at: {updated-at}{end-updated-at-block} | ||
{source-url-block} Source: {source-url}{end-source-url-block} | ||
{notebook-block} Notebook: {notebook}{end-notebook-block} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
export const escapeStringRegexp = (text: string): string => { | ||
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); | ||
}; | ||
|
16 changes: 16 additions & 0 deletions
16
src/utils/templates/apply-functions/apply-tags-array-template.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { cloneDeep, templateSettings } from 'lodash'; | ||
|
||
import { NoteData } from '../../../models/NoteData'; | ||
import * as P from '../placeholders/tags-array-placeholders'; | ||
|
||
import { applyTemplateOnBlock } from './apply-template-on-block'; | ||
import { getTemplateBlockSettings } from './get-templateblock-settings'; | ||
export const applyTagsArrayTemplate = (noteData: NoteData, inputText: string, check: Function): string => { | ||
const result = cloneDeep(inputText); | ||
|
||
if (noteData.tags) | ||
noteData.tags = JSON.stringify(noteData.tags.split(' ')); | ||
const tagsTemplateSettings = getTemplateBlockSettings(result, check, P, noteData.tags); | ||
|
||
return applyTemplateOnBlock(tagsTemplateSettings); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
export const CONTENT_PLACEHOLDER = '{tags-array}'; | ||
export const START_BLOCK = '{tags-array-block}'; | ||
export const END_BLOCK = '{end-tags-array-block}'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{title-block}# {title}{end-title-block} | ||
|
||
{tags-array-block} | ||
--- | ||
Tags: {tags-array} | ||
|
||
--- | ||
{end-tags-array-block} | ||
|
||
{content-block}{content}{end-content-block} | ||
|
||
{created-at-block} Created at: {created-at}{end-created-at-block} | ||
{updated-at-block} Updated at: {updated-at}{end-updated-at-block} | ||
{source-url-block} Source: {source-url}{end-source-url-block} | ||
{notebook-block} Notebook: {notebook}{end-notebook-block} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# test -note with text only | ||
|
||
|
||
--- | ||
Tags: ["tag1","tag2"] | ||
|
||
--- | ||
|
||
|
||
This is the content | ||
|
||
Created at: 2018-10-06T09:43:49+01:00 | ||
Updated at: 2018-10-06T09:44:11+01:00 | ||
Notebook: test-noteWithTags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters