Skip to content

Commit

Permalink
correct formatting of the date in Org-Mode
Browse files Browse the repository at this point in the history
add tags to Org-Mode header
add field `tags` to YAML front matter with same content as the `keywords` field
  • Loading branch information
Release-Candidate committed Oct 8, 2021
1 parent 76cb9ad commit ec88aee
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 21 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Notoy Browser Extensions Changelog

## Version 1.0.1 (2021-10-08)

- correct formatting of the date in Org-Mode (with angle brackets, like `<2021-10-08>`)
- add tags to Org-Mode header
- add field `tags` to YAML front matter with same content as the `keywords` field

## Version 1.0.0 (2021-10-05)

- Translations finished:
Expand Down
21 changes: 15 additions & 6 deletions Chrome/formatContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
/* eslint-disable no-undef */
// Most names are not locally used.
/* eslint-disable no-unused-vars */
// Eslint and Prettier disagree on formatting
/* eslint-disable indent */

//=============================================================================
// Translation constants
Expand Down Expand Up @@ -51,7 +53,7 @@ function getMarkdown({
} = {}) {
return `${getYamlFrontMatter({ title, keywords, addYaml })}# ${title}
${getTimestamp(addTimestamp)}${transKeywords} ${tagifyKeywords(keywords)}
${getTimestamp({ addTimestamp })}${transKeywords} ${tagifyKeywords(keywords)}
${description}
[${title}](${url})
Expand All @@ -78,9 +80,13 @@ function getOrgMode({
#+date: ${getDateString()}
#+FILETAGS: ${orgifyKeywords(keywords)}
* ${title}
* ${title}\t\t${orgifyKeywords(keywords)}
${getTimestamp(addTimestamp)}${transKeywords} ${keywords}
${getTimestamp({
addTimestamp,
start: "<",
end: ">",
})}${transKeywords} ${keywords}
${description}
[[${url}][${title}]]
Expand All @@ -106,7 +112,7 @@ function getPlainText({
} = {}) {
return `${getYamlFrontMatter({ title, keywords, addYaml })}${title}
${getTimestamp(addTimestamp)}${transKeywords} ${keywords}
${getTimestamp({ addTimestamp })}${transKeywords} ${keywords}
${description}
${url}
Expand Down Expand Up @@ -168,6 +174,7 @@ title: "${title}"
author:
-
keywords: ${getKeywordsYAML(keywords)}
tags: ${getKeywordsYAML(keywords)}
lang: ${chrome.i18n.getUILanguage()}
---`
return addYaml ? yamlString + "\n\n" : ""
Expand All @@ -178,11 +185,13 @@ lang: ${chrome.i18n.getUILanguage()}
*
* @param {*} addTimestamp If this is `true`, a date string is returned, else
* the empty string.
* @param {*} start The string to add before the date string
* @param {*} end The string to add after the date string
* @returns The current date as string, if `addTimestamp` is `true`, the empty
* string ("") else.
*/
function getTimestamp(addTimestamp) {
return addTimestamp ? getDateString() + "\n\n" : ""
function getTimestamp({ addTimestamp, start = "", end = "" }) {
return addTimestamp ? start + getDateString() + end + "\n\n" : ""
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Chrome/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "__MSG_extensionName__",
"description": "__MSG_extensionDescription__",
"version": "1.0.0",
"version": "1.0.1",
"default_locale": "en",
"manifest_version": 3,
"author": "Roland Csaszar",
Expand Down
21 changes: 15 additions & 6 deletions Edge/formatContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
/* eslint-disable no-undef */
// Most names are not locally used.
/* eslint-disable no-unused-vars */
// Eslint and Prettier disagree on formatting
/* eslint-disable indent */

//=============================================================================
// Translation constants
Expand Down Expand Up @@ -51,7 +53,7 @@ function getMarkdown({
} = {}) {
return `${getYamlFrontMatter({ title, keywords, addYaml })}# ${title}
${getTimestamp(addTimestamp)}${transKeywords} ${tagifyKeywords(keywords)}
${getTimestamp({ addTimestamp })}${transKeywords} ${tagifyKeywords(keywords)}
${description}
[${title}](${url})
Expand All @@ -78,9 +80,13 @@ function getOrgMode({
#+date: ${getDateString()}
#+FILETAGS: ${orgifyKeywords(keywords)}
* ${title}
* ${title}\t\t${orgifyKeywords(keywords)}
${getTimestamp(addTimestamp)}${transKeywords} ${keywords}
${getTimestamp({
addTimestamp,
start: "<",
end: ">",
})}${transKeywords} ${keywords}
${description}
[[${url}][${title}]]
Expand All @@ -106,7 +112,7 @@ function getPlainText({
} = {}) {
return `${getYamlFrontMatter({ title, keywords, addYaml })}${title}
${getTimestamp(addTimestamp)}${transKeywords} ${keywords}
${getTimestamp({ addTimestamp })}${transKeywords} ${keywords}
${description}
${url}
Expand Down Expand Up @@ -168,6 +174,7 @@ title: "${title}"
author:
-
keywords: ${getKeywordsYAML(keywords)}
tags: ${getKeywordsYAML(keywords)}
lang: ${chrome.i18n.getUILanguage()}
---`
return addYaml ? yamlString + "\n\n" : ""
Expand All @@ -178,11 +185,13 @@ lang: ${chrome.i18n.getUILanguage()}
*
* @param {*} addTimestamp If this is `true`, a date string is returned, else
* the empty string.
* @param {*} start The string to add before the date string
* @param {*} end The string to add after the date string
* @returns The current date as string, if `addTimestamp` is `true`, the empty
* string ("") else.
*/
function getTimestamp(addTimestamp) {
return addTimestamp ? getDateString() + "\n\n" : ""
function getTimestamp({ addTimestamp, start = "", end = "" }) {
return addTimestamp ? start + getDateString() + end + "\n\n" : ""
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Edge/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "__MSG_extensionName__",
"version": "1.0.0",
"version": "1.0.1",
"description": "__MSG_extensionDescription__",
"author": "Roland Csaszar",
"default_locale": "en",
Expand Down
1 change: 1 addition & 0 deletions Edge/options.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ html {
padding-left: 10vw;
padding-top: 5vh;
padding-bottom: 10vh;
width: 800px;
margin: 0px;
box-sizing: border-box;
background-color: whitesmoke;
Expand Down
21 changes: 15 additions & 6 deletions Firefox/formatContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
/* eslint-disable no-undef */
// Most names are not locally used.
/* eslint-disable no-unused-vars */
// Eslint and Prettier disagree on formatting
/* eslint-disable indent */

//=============================================================================
// Translation constants
Expand Down Expand Up @@ -51,7 +53,7 @@ function getMarkdown({
} = {}) {
return `${getYamlFrontMatter({ title, keywords, addYaml })}# ${title}
${getTimestamp(addTimestamp)}${transKeywords} ${tagifyKeywords(keywords)}
${getTimestamp({ addTimestamp })}${transKeywords} ${tagifyKeywords(keywords)}
${description}
[${title}](${url})
Expand All @@ -78,9 +80,13 @@ function getOrgMode({
#+date: ${getDateString()}
#+FILETAGS: ${orgifyKeywords(keywords)}
* ${title}
* ${title}\t\t${orgifyKeywords(keywords)}
${getTimestamp(addTimestamp)}${transKeywords} ${keywords}
${getTimestamp({
addTimestamp,
start: "<",
end: ">",
})}${transKeywords} ${keywords}
${description}
[[${url}][${title}]]
Expand All @@ -106,7 +112,7 @@ function getPlainText({
} = {}) {
return `${getYamlFrontMatter({ title, keywords, addYaml })}${title}
${getTimestamp(addTimestamp)}${transKeywords} ${keywords}
${getTimestamp({ addTimestamp })}${transKeywords} ${keywords}
${description}
${url}
Expand Down Expand Up @@ -168,6 +174,7 @@ title: "${title}"
author:
-
keywords: ${getKeywordsYAML(keywords)}
tags: ${getKeywordsYAML(keywords)}
lang: ${browser.i18n.getUILanguage()}
---`
return addYaml ? yamlString + "\n\n" : ""
Expand All @@ -178,11 +185,13 @@ lang: ${browser.i18n.getUILanguage()}
*
* @param {*} addTimestamp If this is `true`, a date string is returned, else
* the empty string.
* @param {*} start The string to add before the date string
* @param {*} end The string to add after the date string
* @returns The current date as string, if `addTimestamp` is `true`, the empty
* string ("") else.
*/
function getTimestamp(addTimestamp) {
return addTimestamp ? getDateString() + "\n\n" : ""
function getTimestamp({ addTimestamp, start = "", end = "" }) {
return addTimestamp ? start + getDateString() + end + "\n\n" : ""
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Firefox/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "__MSG_extensionName__",
"version": "1.0.0",
"version": "1.0.1",
"description": "__MSG_extensionDescription__",
"author": "Roland Csaszar",
"default_locale": "en",
Expand Down

0 comments on commit ec88aee

Please sign in to comment.