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)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
So Long Neofetch and Thanks for the Info
Today is a day that every Linux user who enjoys bragging about their system(s) will mourn, as Neofetch has come to an end.
-
Ubuntu 24.04 Comes with a “Flaw"
If you're thinking you might want to upgrade from your current Ubuntu release to the latest, there's something you might want to consider before doing so.
-
Canonical Releases Ubuntu 24.04
After a brief pause because of the XZ vulnerability, Ubuntu 24.04 is now available for install.
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.
-
Canonical Collaborates with Qualcomm on New Venture
This new joint effort is geared toward bringing Ubuntu and Ubuntu Core to Qualcomm-powered devices.
-
Kodi 21.0 Open-Source Entertainment Hub Released
After a year of development, the award-winning Kodi cross-platform, media center software is now available with many new additions and improvements.
-
Linux Usage Increases in Two Key Areas
If market share is your thing, you'll be happy to know that Linux is on the rise in two areas that, if they keep climbing, could have serious meaning for Linux's future.
-
Vulnerability Discovered in xz Libraries
An urgent alert for Fedora 40 has been posted and users should pay attention.