Skip to content

Commit

Permalink
Additional project feature
Browse files Browse the repository at this point in the history
  • Loading branch information
rberenguel committed Nov 9, 2024
1 parent 2973ffc commit 4037070
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
1 change: 1 addition & 0 deletions .vscode/ltex.disabledRules.en-US.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
COMMA_PARENTHESIS_WHITESPACE
1 change: 1 addition & 0 deletions lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const numMojis = [
];

const linkRegex = /\[(.*?)\]\((.*?)\)/;
const linkPlusRegex = /\[(.*?)\]\((.*?)\)\s+(.*)/;

function toTop(div) {
const allDivs = document.querySelectorAll("div");
Expand Down
27 changes: 18 additions & 9 deletions lib/taskUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,10 @@ function textToTaskObject(text) {
obj.done = true;
cleaned = cleaned.slice(3);
}
const linkMatch = cleaned.match(linkRegex);
const linkMatch = cleaned.match(linkPlusRegex);
if (linkMatch) {
obj.text = linkMatch[1];
console.log(linkMatch);
obj.text = linkMatch[1] + (linkMatch[3] ?? "");
obj.link = linkMatch[2];
} else {
obj.text = cleaned;
Expand Down Expand Up @@ -231,7 +232,7 @@ function tasksFromMarkdown(paths, cb) {
tasks.push(obj);
}
return tasks;
})
}),
);
});

Expand Down Expand Up @@ -327,7 +328,7 @@ function addTasksToDiv(_tasks, targetDivId) {
const taskExtra = d();
taskText.classList.add("taskText");
const taskTitle = d();
taskText.appendChild(taskTitle)
taskText.appendChild(taskTitle);
taskExtra.classList.add("taskExtra");
let text = task.text.replace("#kr", "✨ #kr");
const extra = task.extra ? task.extra : "";
Expand All @@ -352,12 +353,20 @@ function addTasksToDiv(_tasks, targetDivId) {
pproj = [_p];
}
const color = colors[i % colors.length];

for (let proj of pproj) {
const full = `.${proj}`;
const adjColor = `color-mix(in srgb, var(${color}) 98%, var(--light) 2%)`;
text = text.replace(
proj,
`<strong style="color: ${adjColor};">${proj}</strong>`
);
console.log(text);
if (text.endsWith(full)) {
text = text.replace(full, "");
text = `<span style="color: ${adjColor};">${text}</span>`;
} else {
text = text.replace(
proj,
`<strong style="color: ${adjColor};">${proj}</strong>`,
);
}
}
}
taskTitle.innerHTML = text;
Expand All @@ -382,7 +391,7 @@ function addTasksToDiv(_tasks, targetDivId) {
}

const allHighlights = allRows.filter((r) =>
r.classList.contains("highlight")
r.classList.contains("highlight"),
);

if (allHighlights.length == 0) {
Expand Down
6 changes: 3 additions & 3 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ iframe {
margin-right: 1em;
}

.taskText > strong {
.taskText > div > strong {
text-shadow: -0.06em -0.06em 0;
}

Expand Down Expand Up @@ -224,7 +224,7 @@ span[data-title]:hover::after {

.taskRow.highlight {
padding-left: 2em;
filter: saturate(1.2) brightness(1.2);;
filter: saturate(1.2) brightness(1.2);
}

.taskRow.dim {
Expand Down Expand Up @@ -276,7 +276,7 @@ span[data-title]:hover::after {
color: var(--light-grey-trans) !important;
}

.done .taskText > strong {
.done .taskText > div > strong {
color: var(--light-grey-trans) !important;
text-shadow: none !important;
}

0 comments on commit 4037070

Please sign in to comment.