| 1 | #ifndef _ManPages_h_ |
| 2 | #define _ManPages_h_ |
| 3 | /* ManPages.h |
| 4 | * |
| 5 | * Copyright (C) 1996-2005,2007,2011,2012,2015-2020,2022-2024 Paul Boersma |
| 6 | * |
| 7 | * This code is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or (at |
| 10 | * your option) any later version. |
| 11 | * |
| 12 | * This code is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 15 | * See the GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #include "ManPage.h" |
| 22 | #include "Collection.h" |
| 23 | |
| 24 | Thing_define (ManPages, Daata) { |
| 25 | OrderedOf <structManPage> pages; |
| 26 | void invalidateCache () noexcept { |
| 27 | for (integer i = 1; i <= our pages.size; i ++) |
| 28 | our pages.at [i] -> invalidateCache (); |
| 29 | } |
| 30 | |
| 31 | autoSTRVEC titles; |
| 32 | bool ground, dynamic, executable, commandsWithExternalSideEffectsAreAllowed = true; |
| 33 | structMelderFolder rootDirectory; |
| 34 | |
| 35 | void v9_destroy () noexcept |
| 36 | override; |
| 37 | void v1_readText (MelderReadText text, int formatVersion) |
| 38 | override; |
| 39 | }; |
| 40 | |
| 41 | autoManPages ManPages_create (); |
| 42 | autoManPages ManPages_createFromText (MelderReadText text, MelderFile file); |
| 43 | autoManPages ManPages_createFromText (MelderReadText text); |
| 44 | |
| 45 | void ManPages_addPage (ManPages me, conststring32 title, conststring32 copyright, |
| 46 | structManPage_Paragraph paragraphs []); |
| 47 | /* |
| 48 | All string and struct arguments must be statically allocated |
| 49 | and not change after adding them to the ManPages. |
| 50 | */ |
| 51 | |
| 52 | void ManPages_addPagesFromNotebookText (ManPages me, conststring8 text); |
| 53 | integer ManPages_addPagesFromNotebookReader (ManPages me, MelderReadText multiplePagesReader, integer startOfSelection, integer endOfSelection); |
| 54 | |
| 55 | integer ManPages_lookUp (ManPages me, conststring32 title); |
| 56 | integer ManPages_lookUp_caseSensitive (ManPages me, conststring32 title); |
| 57 | |
| 58 | void ManPages_writeOneToHtmlFile (ManPages me, Interpreter optionalInterpreterReference, integer ipage, MelderFile file); |
| 59 | void ManPages_writeAllToHtmlDir (ManPages me, Interpreter optionalInterpreterReference, conststring32 dirPath); |
| 60 | |
| 61 | integer ManPages_uniqueLinksHither (ManPages me, integer ipage); |
| 62 | constSTRVEC ManPages_getTitles (ManPages me); |
| 63 | |
| 64 | #define ManPages_FILENAME_BUFFER_SIZE 256 |
| 65 | |
| 66 | inline static bool isAllowedFileNameCharacter (char32 c) { |
| 67 | return Melder_isWordCharacter (c) || c == U'_' || c == U'-' || c == U'+'; |
| 68 | } |
| 69 | inline static bool isSingleWordCharacter (char32 c) { |
| 70 | return Melder_isWordCharacter (c) || c == U'_'; |
| 71 | } |
| 72 | |
| 73 | /* End of file ManPages.h */ |
| 74 | #endif |