<%* // Автодополнение §-ссылок и тем
const activeEditor = app.workspace.activeEditor; if (!activeEditor) { new Notice("Нет активного редактора"); return; }
const editor = activeEditor.editor;
<%* // Автодополнение §-ссылок и тем
const activeEditor = app.workspace.activeEditor; if (!activeEditor) { new Notice("Нет активного редактора"); return; }
const editor = activeEditor.editor;
## <% tp.user.fmtDates(tp, "ddd DD MMM", true) %> | |
<%* | |
// Get tasks from monthly log | |
const monthlyNote = tp.file.find_tfile(tp.date.now("YYYY-MM", 0, tp.file.title, "YYYY-MM-DD")) // get the TFile of yesterday's note | |
console.log('monthlyNote='+monthlyNote) | |
let monthlyNoteData = await app.vault.read(monthlyNote) | |
let monthlyNoteContent = monthlyNoteData.split("\n") | |
console.log('content='+monthlyNoteContent) | |
const header = "## " + tp.user.fmtDates(tp, "ddd DD", true) // replace with whatever the header is |
<%* | |
// get the current task | |
let re = /(^\s*|^\t*)(-\s\[ \]\s|-\s\[.\]\s|\*\s|-\s|\d*\.\s|\*\s|\b|^)([^\n\r]*)/gim; | |
let editor = app.workspace.activeLeaf.view.editor; | |
let cur = editor.getCursor("from"); | |
let text = editor.getLine(cur.line); | |
// find next daily note, create if not exists | |
let fname = tp.date.now("YYYY-MM-DD", 1, tp.file.title, "YYYY-MM-DD") | |
console.log('fname='+fname) | |
let mname = tp.date.now("YYYY-MM", 1, tp.file.title, "YYYY-MM-DD") |
// Форматирование дат по-русски | |
// tp - ссылка на объект tp, fmt - формат, source == true - взять дату из заголовка файла, false - текущая дата | |
function fmtDates(tp, fmt, source) | |
{ | |
const days = ["ВС", "ПН", "ВТ", "СР", "ЧТ", "ПТ", "СБ"] | |
const mon = ["ЯНВ", "ФЕВ", "МАР", "АПР", "МАЯ", "ИЮН", "ИЮЛ", "АВГ", "СЕН", "ОКТ", "НОЯ", "ДЕК"] | |
const months = ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", " | |
Декабрь"] | |
let dateS | |
if (typeof source === "string") // использовать как дату |
<%* tp.user.para(tp, false) %>
<%* | |
let parName = tp.file.folder(true) + '.md'; | |
if (await tp.file.exists(parName)) { | |
app.workspace.openLinkText('', parName); | |
} | |
%> |
<%* | |
let lst = ['[ ] to-do', | |
'[/] incomplete', | |
'[x] done', | |
'[-] canceled', | |
'[>] forwarded', | |
'[<] scheduling', | |
'[?] question', | |
'[!] important', | |
'[*] star', |