From 4e019ac186eecbea56a9fb6bb3e578a87cf64dfd Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Sun, 10 Sep 2023 12:38:20 +0700 Subject: [PATCH] chore: update documentation --- README.md | 9 +++++++-- src/backTranslation.ts | 6 +++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ab14f4f..63adbae 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,11 @@ Parameters -d [Directory of Toolbox text files for a single book (one chapter per file)] -j [JSON file representing a single book - used for testing conversion to SFM] -s [Directory of directories (each subdirectory is a separate book)] + + Optional for processing rich text (rtf) files - one of: + -b [A single rtf text file (one chapter of a book)] + -bd [Directory of rtf text files for a single book (one chapter per file)] + -bs [Directory of directories (each subdirectory is a separate book)] ``` ### Help @@ -68,10 +73,10 @@ npx tsc ``` ### Install UnRTF for .rtf Files -This is needed if the source files are .rtf Rich Text Format. Download at +This is needed if the source files are .rtf Rich Text Format, and currently only works on Linux. Download at https://www.gnu.org/software/unrtf/#downloading -or on Linux: +or on command line: ```bash sudo apt install unrtf ``` diff --git a/src/backTranslation.ts b/src/backTranslation.ts index 8764282..8e168d4 100644 --- a/src/backTranslation.ts +++ b/src/backTranslation.ts @@ -55,7 +55,11 @@ export function getBookAndChapter(file: string) : toolbox.fileInfoType { * @param {boolean} debugMode - Whether to print additional logging */ export async function updateObj(bookObj: books.objType, file: string, currentChapter: number, - s: sfmConsole.SFMConsole, debugMode = false) { + s: sfmConsole.SFMConsole, debugMode = false) { + if (!os.type().startsWith('Linux')) { + console.error("unRtf needs to run on Linux"); + process.exit(1); + } const unRtfPath = os.type().startsWith('Linux') ? "/usr/bin" : ""; // Path for UnRtf const unRtf = new UnRTF(unRtfPath); const options = {