Giter Site home page Giter Site logo

bryanlammon / autocref Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 30 KB

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

License: MIT License

Rust 100.00%
converter legaltools markdown pandoc rust scholarship law publishing legaltech legalscholarship

autocref's Introduction

AutoCref

AutoCref's functionality has been integrated into Supra. So it's no longer necessary or functioning. Use Supra instead.

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

autocref's People

Contributors

bryanlammon avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

pavee368

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.