djcev.com

//

Memory / Work / djcev.com

Created , last updated . Source file.
Tags: , , , , , , .

Notes taken while working on this website.

Useful Git commands

Echo a file in a specific commit (specified by ID), redirect to a new path:

git show $commit:$path > $newpath

Remove sensitive data from a Git repo

Importing Mastodon Archive Data

References, useful links:

Wrote a new script based on mastodon-data-viewer that handles filtering unwanted toots & writes each toot to its own file for rendering by blogofile_blog. These files still need to be edited after the fact (to update hashtags and to possibly further redact content) but the script handles most of the work.

Procedure:

  • Unpack the downloaded archive tarball (hostname-archive-id.tar.gz)
  • Copy mastodon-archive-blogofile.py to the directory created above
  • Run mastodon-archive-blogofile.py, redirect output to a file
    • The file created thru the redirect above is a list of cp(1) commands that will copy the media attachments (well, the images anyway) to the site gfx directory
    • This will create files, one per toot, in a hostname_account dir
  • Take a look at the files in the hostname_account dir; do they look right?
  • If yes you can start copying them into the blog _posts directory & start editing them. (They will need to be cleaned up, tags edited, etc.)
  • Don't forget to run the media attachments copy script before building the site.

Simple CGI comments

References:

needs some kind of rate limiting, also file locking (fnctl.flock)

Alternative to CGI comments: double down on mentions

Write up a "how to comment" guide modeled after How To Post Replies To Fogknife articles.

Font & Container Sizing

Left (content) / Right (sidebar) layout: 65% 35% ?

font-size 2.5vw = 16px at 640 wide, 18px at 720, 20px at 800.

Max width for full-screen is 38em (leaving 2em for margins) when font-size is 2.5vw (2.5 * 40 = 100)

38em + 10em sidebar + 4em for margins = 52em; 52em at 18px transitions at 972px wide (i.e., 18 * (52 + 2), adding 2em for extra margin).

One readability guide suggests between 50 and 75 characters per line; I'm going over that (by a little bit) fairly often. (guide in question: https://baymard.com/blog/line-length-readability .)

Rewriting and/or Simplifying Blogofile

Overall program sequence (something like this, not guaranteed to be accurate):

  1. load config file
    1. read _config.py with def load_config
  2. parse commandline arguments (overriding config file)
    1. need an output directory override in particular
  3. check sanity of CLI arguments (and maybe also config file)
  4. erase files in output dir
  5. set up Mako Template engine
    1. initialize the engine with a lookup path & store it for later
    2. reference template.MakoTemplate
  6. iterate over contents of _posts and _memory; _controllers/blog code
    1. this collects filenames & creates a collection of Post objects
      • apply_filters (markdown) is run when Post objects are created
    2. this also collects vimwiki pages in _memory
  7. iterate over the posts collection(s) and render various templates
    1. permapages
    2. chronological
    3. monthly & yearly archives, then archive_index
    4. category chronological views
    5. tag indexes
    6. RSS & Atom feeds
  8. render git/* (gitview) & copy to output dir
    1. rewrite data dicts as objects? Or rework them as a Hierarchical Cache?
  9. copy files not handled by the above three processes (use ignore regex)
    1. was writer.__write_files()
    2. notably copies css, gfx, snd, vid, etc.
  10. cleanup?

the sequence for calling a Mako template looks like this:

  1. call materialize_template(template_name, location, attrs{})
  2. create new MakoTemplate object. within init function:
    1. instantiate & store a mako.lookup.TemplateLookup
      • MakoTemplate.create_lookup(...)
    2. instantiate mako.template.Template with the lookup from above
  3. extend the object's dict with attrs passed in step 1
  4. template object render function.
    1. build template context obj containing template name & render path
    2. call render() on the mako template object
  5. render() then calls template.write() which writes to location from step 1

Really need to rework the post visibility system. Visible in: archive, chronological (main), feeds,