mirror of
https://github.com/FliegendeWurst/telegram_notes_bot.git
synced 2024-12-04 07:49:07 +00:00
Properly format newlines of plain text ICS entries
This commit is contained in:
parent
a1371b2948
commit
974d544db8
@ -32,9 +32,9 @@ const targetTemplate = await api.currentNote.getRelationValue('targetTemplate');
|
|||||||
const options = {
|
const options = {
|
||||||
"parentNoteId": dayNote.noteId,
|
"parentNoteId": dayNote.noteId,
|
||||||
"title": name,
|
"title": name,
|
||||||
"content": summaryHtml != "" ? summaryHtml : summary,
|
"content": summaryHtml != "" ? summaryHtml : summary.replace(/\n/g, "<br>").replace(/\r/g, ""),
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"mime": summaryHtml != "" ? "text/html" : "text/plain"
|
"mime": "text/html"
|
||||||
};
|
};
|
||||||
const resp = await api.createNewNote(options);
|
const resp = await api.createNewNote(options);
|
||||||
const note = resp.note;
|
const note = resp.note;
|
||||||
|
@ -142,8 +142,8 @@ async fn process_one(update: Update, context: &mut Context) -> Result<(), Error>
|
|||||||
if CLIENT.get(&trilium_url("/custom/new_event")).form(&json!({
|
if CLIENT.get(&trilium_url("/custom/new_event")).form(&json!({
|
||||||
"uid": calendar.events[0].uid,
|
"uid": calendar.events[0].uid,
|
||||||
"name": calendar.events[0].summary,
|
"name": calendar.events[0].summary,
|
||||||
"summary": calendar.events[0].description,
|
"summary": calendar.events[0].description.replace("\\n", "\n"),
|
||||||
"summaryHtml": calendar.events[0].description_html.as_deref().unwrap_or_default(),
|
"summaryHtml": calendar.events[0].description_html.as_deref().map(|x| x.replace("\\n", "\n")).unwrap_or_default(),
|
||||||
"fileName": document.file_name,
|
"fileName": document.file_name,
|
||||||
"fileData": text,
|
"fileData": text,
|
||||||
"location": calendar.events[0].location,
|
"location": calendar.events[0].location,
|
||||||
|
Loading…
Reference in New Issue
Block a user