Hacking free software for creative writing
Binary Diffs
I covered diffoscope [7] in depth in the November 2020 issue of Linux Magazine [8]. Here, I will only say that diffoscope is a new command that brings the time-honored diff
command to the desktop and works with over 60 binary formats, including LibreOffice's ODT format. Although originally written by Debian's Reproducible Builds project, diffoscope is an important building block for writers who choose to work more like developers.
At its simplest, diffoscope requires no more than the command and two file names to compare versions (Figure 3). However, if you choose, you can specify options such as the length of each excerpt from the two files and regular expressions to include or omit. You can also experiment with fuzzy logic.
Merging Files
One of the barriers to using git
or diff
commands for writing is that they usually work with text files, while most writers work in binary formats or at least have to submit their work in one. In addition, as I write, diffoscope is too new to have automated merge capacity. Consequently, most merges have to be manual, although there are several ways to go about it.
If you only want to append files, ooo_cat
[9] will do the job. From the desktop, you can connect files to each other in LibreOffice using File | Send | Create Master Documents (Figure 4). This feature not only appends documents but also allows files to be rearranged and new text entered. The files in a master document remain separate but can be printed or saved as a single document.
More complicated file merges can be done with LibreOffice's Edit | Track Changes | Compare Documents (Figure 5). You can open a second file so that you can approve all the changes, one at a time. Alternatively, you can use Merge Documents to combine both documents all at once. The Compare Documents option in particular has an interface complicated enough to take some getting used to, although it is a powerful solution.
You also have the option of working in plain text so you can use Git's own merge features. In order to do so, you need to convert ODT files to plain text, using a solution like odt2text [10] for LibreOffice files or PDFMiner [11] for PDF files. Unfortunately, while you can convert text back to ODT format by opening a file in LibreOffice and then saving it, much of the formatting to prepare a manuscript for submission still needs to be added – a task eased by styles, but still a tedious one. A more practical solution would be to write in LaTeX or HTML, markup languages that work with plain text and therefore allow you to work directly with Git's merge
command. When you are finished editing, you can compile a LaTeX file or run a script to convert text to ODT or HTML to ODT.
The New Workflow
None of the tools mentioned here is promoted as being specifically for writers. However, with a little ingenuity, writers can benefit from them almost as much as developers. They require a change in workflow that takes a while to learn, but the effort is worth the struggle. In the last few months, I have found that thanks to these tools I am getting organized in my habits. I no longer have to hunt for background notes, or figure out where my drafts are, or scroll up and down as much as I once did. These development tools have helped me to organize my workflow and increase my efficiency – improvements that, like most writers, I have badly needed.
Infos
- Williams, Robin. The PC is Not A Typewriter. Peachpit Press, 1992:https://www.amazon.com/Pc-not-typewriter-Robin-Williams/dp/0938151495
- VimWiki: https://vimwiki.github.io/
- Zim: https://zim-wiki.org/
- xkcdpass: https://pypi.org/project/xkcdpass/
- Git: https://git-scm.com/
- Mercurial: https://www.mercurial-scm.org/
- Diffoscope: https://diffoscope.org/
- "A modern diff utility" by Bruce Byfield, Linux Magazine, issue 240, November 2020, pp. 30-32
- ooo_cat: http://ooopy.sourceforge.net/
- odt2text: https://medium.com/@mbrehin/git-advanced-diff-odt-pdf-doc-xls-ppt-25afbf4f1105
- PDFMiner: https://github.com/euske/pdfminer
« Previous 1 2
Buy this article as PDF
(incl. VAT)