A Supra + Pandoc post-processor for footnote cross-references.

Overview

AutoCref

AutoCref is a Supra and Pandoc post-processor that turns footnote cross-references in a Word document into automatically updated fields.

About

AutoCref is a Supra and Pandoc post-processor that turns footnote cross-references in a Word document into automatically updated fields.

.docx files are a zip file of mostly .xml files. AutoCref adds markup to two of those files—document.xml and footnotes.xml—which turns the Supra-produced footnote cross-references into automatically updated fields.

The program works with cross-references that consist of an intalicized "supra" or "infra" immediately followed by a space and the word "note" or "notes". The cross-references produced by Supra should work fine. Manual cross-references (such as those referring the reader to other notes where something is discussed) are less reliable. If there is anything besides a space between the italicized "supra" or "infra" and the word "note" or "notes", AutoCref will not change the number to a field.

So, for example:

# A document with the following Supra markup...
Some text.^[*See* [@jones2001] at 100.]
Some more text.^[*See* *supra* notes [?id1]–[?id2].]

# ... will render as the following plain text:
Some text.^[*See* Jones, *supra* note 1, at 100.]
Some more text.^[*See* *supra* notes 1–2.]

# After Pandoc creates a .docx file, AutoCref will change the numbers 1 and 2 into automatically updating numbers.

AutoCref recognizes two kinds of cross-references: (1) those to a single number, and (2) those in a range (e.g., "notes 10–12"). AutoCref expects that ranges of notes will be separated by an en-dash. But it will also recognize a hyphen. There should be no spaces before or after the en-dash (or hyphen). Sets of cross-references (e.g., "notes 10 & 12") are not supported at this time.

Usage

Using AutoCref involves three steps. First you must unzip the .docx file. Then you run AutoCref. Then you re-zip the .docx file.

1. Unzip the .docx File

First, the .docx file must be unzipped into its own directory.

unzip example.docx -d example-contents

2. Run AutoCref Inside the Archive

Move to the directory into which you unzipped the .docx file and run AutoCref.

cd example-contents
autocref

By default, AutoCref will alter the document.xml and footnotes.xml in the ./word/ subdirectory. If for some reason you want to set different files, you can set the document.xml and footnotes.xml files by providing filenames after autocref. The document.xml filename must come first. The footnotes.xml filename must come second.

3. Zip the Files Into a .docx File

Then re-zip the files in that directory into a .docx file.

zip -r example.docx *

zip should be run inside the directory into which you unzipped the .docx contents. After re-zipping, move the new .docx file to wherever you want to keep it. You can then delete the directory containing the .docx contents.

Makefile

Probably the easiest way to use AutoCref is adding it to the Makefile used for Supra and Pandoc. The following lines can come after those for Pandoc:

unzip example.docx -d autocref-temp; \
cd autocref-temp; \
autocref; \
zip -r example.docx *; \
mv example.docx ../; \
cd ..; \
rm -r autocref-temp

Changelog

  • 0.1.0: Initial release
You might also like...
Cross-platform terminal screen clearing library

ClearScreen Cross-platform terminal screen clearing library. API documentation. Dual-licensed with Apache 2.0 and MIT. Uses Caretaker Maintainership.

Cross-platform terminal program to download IEEE journals
Cross-platform terminal program to download IEEE journals

IEEE Journal Downloader A cross-platform terminal program which tries to download every article in a specified journal and merge the documents into on

📺(tv) Tidy Viewer is a cross-platform CLI csv pretty printer that uses column styling to maximize viewer enjoyment.
📺(tv) Tidy Viewer is a cross-platform CLI csv pretty printer that uses column styling to maximize viewer enjoyment.

📺(tv) Tidy Viewer is a cross-platform CLI csv pretty printer that uses column styling to maximize viewer enjoyment.

Native cross-platform full feature terminal-based sequence editor for git interactive rebase.
Native cross-platform full feature terminal-based sequence editor for git interactive rebase.

Native cross-platform full feature terminal-based sequence editor for git interactive rebase.

Cross-platform Rust rewrite of the GNU coreutils
Cross-platform Rust rewrite of the GNU coreutils

Cross-platform Rust rewrite of the GNU coreutils

Rust-battery - Rust crate providing cross-platform information about the notebook batteries.

battery Rust crate providing cross-platform information about the notebook batteries. Table of contents Overview Supported platforms Install Examples

Cross-platform CLI Rimworld Mod manager. Still under development

rwm Inspired by Spoons rmm. This is a cross-platform Mod Manager for RimWorld intended to work with macOS, linux and Windows Up to now, you must have

Build light & secure cross-platform applications with a web-based UI
Build light & secure cross-platform applications with a web-based UI

Millennium Icon by XFaon. *Stats are from Tauri and may not be fully accurate. Millennium is a cross-platform webview framework written in Rust. With

A cross-platform file sorting program

Cabinet Cross-platform file sorting system that sorts files based on their attributes, such as file type, file name and date modified. Disclaimer: Not

Owner
null
a crate to swap values between possibly-overlapping references

omniswap: a crate to swap values between possibly-overlapping references Motivating Example You cannot simply use std::mem::swap to replace values wit

Masaki Hara 21 Nov 30, 2022
tpp (Tera Pre-Processor) is a versatile CLI (Command Line Interface) tool crafted for preprocessing files using the Tera templating engine.

tpp (Tera Pre-Processor) is a versatile CLI (Command Line Interface) tool crafted for preprocessing files using the Tera templating engine. Drawing inspiration from pre-processors like cpp and gpp, tpp is the next evolution with its powerful expressive toolset.

null 3 Nov 23, 2023
Functional command-line JSON processor

rq rq is a tiny functional language with which you can manipulate JSON. Basically, it is (an insignificant subset of!) jq, written in Rust. NOTE: This

Tony Zorman 13 Feb 10, 2024
Command-line HTTP client for sending a POST request to specified URI on each stdin line.

line2httppost Simple tool to read lines from stdin and post each line as separate POST request to a specified URL (TCP connection is reused though). G

Vitaly Shukela 3 Jan 3, 2023
convert images to ansi or irc, with a bunch of post-processing filters

img2irc (0.2.0) img2irc is a utility which converts images to halfblock irc/ansi art, with a lot of post-processing filters halfblock means that each

null 6 Apr 4, 2023
Cross-platform Rust library for coloring and formatting terminal output

Coloring terminal output Documentation term-painter is a cross-platform (i.e. also non-ANSI terminals) Rust library for coloring and formatting termin

Lukas Kalbertodt 75 Jul 28, 2022
Cross platform terminal library rust

Cross-platform Terminal Manipulation Library Crossterm is a pure-rust, terminal manipulation library that makes it possible to write cross-platform te

crossterm-rs 2.1k Jan 2, 2023
A cross platform minimalistic text user interface

titik Titik is a crossplatform TUI widget library with the goal of being able to interact intuitively on these widgets. It uses crossterm as the under

Jovansonlee Cesar 113 Dec 31, 2022
Alacritty - A fast, cross-platform, OpenGL terminal emulator

Alacritty is a modern terminal emulator that comes with sensible defaults, but allows for extensive configuration. By integrating with other applications, rather than reimplementing their functionality, it manages to provide a flexible set of features with high performance. The supported platforms currently consist of BSD, Linux, macOS and Windows.

Alacritty 43.8k Dec 31, 2022
A cross-platform graphical process/system monitor with a customizable interface and a multitude of features

A cross-platform graphical process/system monitor with a customizable interface and a multitude of features. Supports Linux, macOS, and Windows. Inspired by both gtop and gotop.

Clement Tsang 5.8k Jan 8, 2023