Unverified Commit 0a3db013 authored by Hong Minhee's avatar Hong Minhee
Browse files

Comments

parent b5dd99b7
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -81,18 +81,29 @@ export async function* generateDecoder(
   * Converts a JSON-LD structure to an object of this type.
   * @param json The JSON-LD structure to convert.
   * @returns The object of this type.
   * @throws {TypeError} If the given \`json\` is invalid.
   */
  static async fromJsonLd(
    json: unknown,
    options: { documentLoader?: DocumentLoader } = {}
  ): Promise<${type.name}> {
    if (typeof json === "undefined") {
      throw new TypeError("Invalid JSON-LD: undefined.");
    }
    else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
    options = {
      ...options,
      documentLoader: options.documentLoader ?? fetchDocumentLoader,
    };
    // deno-lint-ignore no-explicit-any
    let values: Record<string, any[]> & { "@id"?: string };
    if (globalThis.Object.keys(json).length == 0) {
      values = {};
    } else {
      const expanded = await jsonld.expand(json, options);
      // deno-lint-ignore no-explicit-any
    const values = expanded[0] as (Record<string, any[]> & { "@id"?: string });
      values = expanded[0] as (Record<string, any[]> & { "@id"?: string });
    }
  `;
  const subtypes = getSubtypes(typeUri, types, true);
  if (subtypes.length > 0) {
+2 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
    "fedify",
    "fediverse",
    "preact",
    "unfollow",
    "unfollowing",
    "uuidv7"
  ]
+10 −0
Original line number Diff line number Diff line
@@ -11,6 +11,16 @@ of the following technologies:
 -  [Fresh] for web framework
 -  Fedify for federation

It provides the following features:

 -  Publish a new post
 -  View a post and its comments
 -  View a list of posts
 -  Federate with other servers in the fediverse
     -  Fediverse users can follow/unfollow your blog
     -  Followers can see your posts in their timelines
     -  Followers can reply to your posts

[Deno]: https://deno.com/
[Deno KV]: https://deno.com/kv
[Fresh]: https://fresh.deno.dev/
+29 −0
Original line number Diff line number Diff line
import {
  type Comment as CommentModel,
  getContentHtml,
} from "../models/comment.ts";

interface CommentProps {
  comment: CommentModel;
}

export default function Comment({ comment }: CommentProps) {
  return (
    <article>
      <header>
        <hgroup>
          <h3>
            Re: <a href={comment.author.url}>{comment.author.name}</a>
          </h3>
          <p>
            {comment.author.handle} &middot;{" "}
            <time datetime={comment.published.toString()}>
              {comment.published.toLocaleString()}
            </time>
          </p>
        </hgroup>
      </header>
      <div dangerouslySetInnerHTML={{ __html: getContentHtml(comment) }} />
    </article>
  );
}
+12 −10
Original line number Diff line number Diff line
@@ -7,16 +7,18 @@ interface PostProps {
export default function Post({ post }: PostProps) {
  return (
    <article>
      <header>
        <hgroup>
        <h1>
          <h2>
            <a href={`/posts/${post.uuid}`}>{post.title}</a>
        </h1>
          </h2>
          <p>
            <time datetime={post.published.toString()}>
              {post.published.toLocaleString()}
            </time>
          </p>
        </hgroup>
      </header>
      <div dangerouslySetInnerHTML={{ __html: getContentHtml(post) }} />
    </article>
  );
Loading