feat: better layout in a lot of places
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import { parseDocument, renderMarkdown } from "@lib/documents.ts";
|
||||
import { parse } from "yaml";
|
||||
import { createCrud } from "@lib/crud.ts";
|
||||
import { extractHashTags } from "@lib/string.ts";
|
||||
|
||||
export type Movie = {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
hashtags: string[];
|
||||
tags: string[];
|
||||
meta: {
|
||||
date: Date;
|
||||
image: string;
|
||||
@@ -52,16 +53,15 @@ export function parseMovie(original: string, id: string): Movie {
|
||||
}
|
||||
|
||||
let description = original.slice(range[0], range[1]);
|
||||
const hashtags = [];
|
||||
for (const [hashtag] of original.matchAll(/\B(\#[a-zA-Z]+\b)(?!;)/g)) {
|
||||
hashtags.push(hashtag.replace(/\#/g, ""));
|
||||
description = description.replace(hashtag, "");
|
||||
const tags = extractHashTags(description);
|
||||
for (const tag of tags) {
|
||||
description = description.replace("#" + tag, "");
|
||||
}
|
||||
|
||||
return {
|
||||
id,
|
||||
name,
|
||||
hashtags,
|
||||
tags,
|
||||
description: renderMarkdown(description),
|
||||
meta,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user