Skip to content

macOS workflow and shell script for one-shot conversion of all footnotes or endnotes in odt/fodt files

License

Notifications You must be signed in to change notification settings

JayBrown/nnConv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nnConv-platform-macos nnConv-code-shell nnConv-depend-tnote nnConv-license

LibreOffice Writer: Convert All Notes

macOS workflow and shell scripts for one-shot conversion of all footnotes or endnotes in OpenDocument text files (odt/fodt) for use e.g. in LibreOffice Writer

nnConv-screengrab

In Microsoft Word it's easy to convert all footnotes to endnotes (or vice versa) in one shot, a functionality important to many scientific authors. Even though users have requested this feature to be implemented in LibreOffice Writer (for many years apparently), the developers haven't done so yet. So if you are a user of LibreOffice Writer, you need to do it manually: the only official option is to do it one note at a time within the document itself, which is time-consuming if you need to convert hundreds of notes.

To convert all notes at once you need to hack the text file, either by changing an fodt file's xml content, or by changing an odt file's content.xml. The latter two are automated by this script. Before running the script on an OpenDocument Text file, you should save the file, if you're currently working on it in LibreOffice Writer.

Note: If you just want LibreOffice Writer to display your footnotes at the end of your document without converting, you can do so by selecting the position "End of document" in the menu Tools > Footnotes and Endnotes….

Functionality

  • one-shot conversion of all notes in a document (odt/fodt formats)

    • uses the sed command for the main operation
    • only changes the note-class xml values
    • does not alter any style settings, e.g. note-style
  • automatic footnote-to-endnote conversion, if document contains only footnotes

  • automatic endnote-to-footnote conversion, if document contains only endnotes

  • user prompt with three options, if document contains both footnotes and endnotes:

    1. swap footnotes <> endnotes
    2. merge all notes as endnotes
    3. merge all notes as footnotes
  • original text file will not be touched

  • creates new text file with suffix -conv.odt or -conv.fodt

  • GitHub repository subfolder *nix contains a shell script that should be compatible with Linux, BSD, other Unix-like systems etc., including macOS

Planned functionality

  • support for docx files (Note: after some preliminary testing it's clear that it won't be easy to make the script work with Microsoft's idiotic file format)

Installation

Workflow

  • Double-click on the workflow file to install
  • If you encounter problems, open it with Automator and save/install from there
  • Standard Finder integration in the Services menu

terminal-notifier [optional, recommended]

More information: terminal-notifier

You need to have Spotlight enabled for mdfind to locate the terminal-notifier.app on your volume; if you don't install terminal-notifier, or if you have deactivated Spotlight, nnConv will call notifications via AppleScript instead

Installation method #1

Install using Homebrew with brew install terminal-notifier (or with a similar manager)

Installation method #2

  • move the terminal-notifier zip archive from the disk image to a folder on your main volume
  • unzip the application and move it to a suitable location, e.g. to /Applications, /Applications/Utilities, or $HOME/Applications

Shell script [optional]

Only necessary if for some reason you want to run this from the shell or another shell script. For normal use the workflow will be sufficient.

  • Move the script nn-conv.sh into /usr/local/bin
  • In your shell enter chmod +x /usr/local/bin/nn-conv.sh
  • Run the script with nn-conv.sh /path/to/target

Uninstall

Remove the following files or folders:

$HOME/Library/Caches/local.lcars.nnConv
$HOME/Library/Services/Convert All Notes.workflow
/usr/local/bin/nn-conv.sh

About

macOS workflow and shell script for one-shot conversion of all footnotes or endnotes in odt/fodt files

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages