Skip to main content

OAT Tools is a CLI for managing Oppimispäiväkirja Markdown files.

Project description

OAT Tools

OAT Tools is a CLI tool written in Python. It is installed as executable oat using uv tool install or as one-off run using uvx. The tool has been designed to help you manage Markdown files written to learning diary written using OAT Spec (as described in Oppimispäiväkirja 101).

The idea is to keep the tool minimalistic and simple. It will handle the following tasks:

  • Detect unused references (Footnotes in Vancouver style)
  • Order references by first appearance
  • Remove unused references
  • Count words in Markdown files, excluding code blocks, footnotes and urls.

Installation

You can install OAT Tools using uv:

uv tool install oat-tools

The output will some something like this:

Resolved 3 packages in 1ms
Installed 3 packages in 3ms
 + click==8.2.1
 + oat-tools==1.0.0
 + tabulate==0.9.0
Installed 1 executable: oat

From now on, you can use the oat command in your terminal to run the tool.

Update

You can update the tool using uv:

uv tool update oat-tools

Usage

References

To detect unused references, order them by first appearance, and remove unused references, you can use the following command:

# Abstract
oat references [check|fix] <FILE...>

# Concrete example (check diary, another and all Markdown files in docs directory)
oat references check diary.md another.md docs/**/*.md

# Concrete example (fix the same files)
oat references fix diary.md another.md docs/**/*.md

Where <FILE...> is any number or Markdown files you want to process. You can use wildcards since your shell will expand them. Note that the --fix option will modify the files in place, so use it with caution. It is recommended to run the command without --fix first to see what changes will be made. Any unused references will be REMOVED, which is a destructive operation. It is recommended to run these commands after a Git commit, so you can easily revert the changes if needed, and can also review the changes using various diff tools.

Terminology used in this tool:

  • appearance: Means that the [^ref] is used in the body text.
  • reference: Means that the [^ref]: is defined in the footnotes section.
  • unused: The [^ref]: is defined in the footnotes section, but has no appearance in the body text.
  • orphan: Opposite situation. The [^ref] is used in the body text without a corresponding [^ref]:.

Word Count

To count words in Markdown files, excluding code blocks, footnotes, and URLs, you can use the following command:

# Abstract
oat wordcount <FILE...>

# Concrete example
oat wordcount diary.md another.md docs/**/*.md

Where <FILE...> is any number of Markdown files you want to process. Again, you can use wildcards.

Captions

To check and fix caption numbering in Markdown files, you can use the following command:

# Abstract
oat captions [check|fix] <FILE...>

# Concrete example (check captions in all Markdown files in docs directory)
oat captions check docs/**/*.md

# Concrete example (fix caption numbering in the same files)
oat captions fix docs/**/*.md

Where <FILE...> is any number of Markdown files you want to process. You can use wildcards since your shell will expand them.

The captions feature ensures that image captions are numbered sequentially starting from 1. Captions must follow this exact format:

**Kuva #**: Caption text goes here as a one-liner.

The check command will report any captions that are not in the correct numerical order, showing which files need attention. The fix command will renumber all captions sequentially, starting from 1, in the order they appear in the file.

Note: The fix option will modify the files in place, so use it with caution. It is recommended to run the check command first to see what changes will be made. As with other commands, it's best to run these after a Git commit so you can easily review and revert changes if needed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oat_tools-1.1.1.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oat_tools-1.1.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file oat_tools-1.1.1.tar.gz.

File metadata

  • Download URL: oat_tools-1.1.1.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for oat_tools-1.1.1.tar.gz
Algorithm Hash digest
SHA256 bacd7978ea429506c2de530141a434f9924daba4994215679f522df4017ea7b6
MD5 9615757517de891a56e232a51512700c
BLAKE2b-256 b8380605a03a141ab91e95c2457a3256d684b2b6ad11586ff31f4a24797b3186

See more details on using hashes here.

File details

Details for the file oat_tools-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: oat_tools-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for oat_tools-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 086f6116e258d0656ba5b56575f14e61705ba009a121cccf3959e1ac85999b29
MD5 b507cba3e94b2b2a60da266b601a1dd4
BLAKE2b-256 9a74f496db5a1563ee64e1fb73d450af3d4fe25d4df19b95c613cc0e9adb8cca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page