From eaca4d1d09ad7678682079806e4ad7fe5df149b8 Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Mon, 20 Mar 2017 10:52:41 -0400 Subject: [PATCH] ADDED: Add command line support for nl/sv quotes; Improve help screen organization --- Sources/libMultiMarkdown/i18n.h | 16 +++++++++++++++- Sources/libMultiMarkdown/mmd.c | 6 ++++++ Sources/multimarkdown/main.c | 28 +++++++++++++++------------- 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/Sources/libMultiMarkdown/i18n.h b/Sources/libMultiMarkdown/i18n.h index 86938bd..07d158f 100644 --- a/Sources/libMultiMarkdown/i18n.h +++ b/Sources/libMultiMarkdown/i18n.h @@ -37,7 +37,7 @@ #include -#define kNumberOfLanguages 4 +#define kNumberOfLanguages 6 #define kNumberOfStrings 4 #define kLanguage 0 @@ -74,21 +74,29 @@ static const char * lc_lookup[kNumberOfLanguages * kNumberOfStrings] = { "Regresar al texto", // Español "Zum Haupttext", // Deutsch "Retour au texte principal", // Français + "return to body", // Nederlands + "return to body", // Svenska "see footnote", // English "Ver nota a pie de página", // Español "Siehe Fußnote", // Deutsch "Voir note de bas de page", // Français + "see footnote", // Nederlands + "see footnote", // Svenska "see citation", // English "Ver referencia", // Español "Siehe Zitat", // Deutsch "Voir citation", // Français + "see citation", // Nederlands + "see citation", // Svenska "see glossary", // English "Ver glosario", // Español "Siehe Glossar", // Deutsch "Voir glossaire", // Français + "see glossary", // Nederlands + "see glossary", // Svenska }; @@ -130,6 +138,8 @@ enum lc_languages { LC_ES, //!< Español LC_DE, //!< Deutsch LC_FR, //!< Français + LC_NL, //!< Nederlands + LC_SV, //!< Svenska }; @@ -141,6 +151,10 @@ static inline short i18n_language_from_string(const char * l) { return LC_DE; } else if (strcmp(l, "fr") == 0) { return LC_FR; + } else if (strcmp(l, "nl") == 0) { + return LC_NL; + } else if (strcmp(l, "sv") == 0) { + return LC_SV; } return 0; diff --git a/Sources/libMultiMarkdown/mmd.c b/Sources/libMultiMarkdown/mmd.c index 8b38659..0a46132 100644 --- a/Sources/libMultiMarkdown/mmd.c +++ b/Sources/libMultiMarkdown/mmd.c @@ -209,6 +209,12 @@ void mmd_engine_set_language(mmd_engine * e, short language) { case LC_FR: e->quotes_lang = FRENCH; break; + case LC_NL: + e->quotes_lang = DUTCH; + break; + case LC_SV: + e->quotes_lang = SWEDISH; + break; default: e->quotes_lang = ENGLISH; } diff --git a/Sources/multimarkdown/main.c b/Sources/multimarkdown/main.c index 113e077..ec379c9 100644 --- a/Sources/multimarkdown/main.c +++ b/Sources/multimarkdown/main.c @@ -81,7 +81,7 @@ struct arg_lit *a_help, *a_version, *a_compatibility, *a_nolabels, *a_batch, struct arg_str *a_format, *a_lang; struct arg_file *a_file, *a_o; struct arg_end *a_end; -struct arg_rem *a_rem1, *a_rem2, *a_rem3, *a_rem4; +struct arg_rem *a_rem1, *a_rem2, *a_rem3, *a_rem4, *a_rem5; DString * stdin_buffer() { @@ -146,29 +146,31 @@ int main(int argc, char** argv) { a_rem1 = arg_rem("", ""), - a_format = arg_str0("t", "to", "FORMAT", "convert to FORMAT, FORMAT = html|latex|beamer|memoir|mmd|odf|epub"), - a_o = arg_file0("o", "output", "FILE", "send output to FILE"), - a_batch = arg_lit0("b", "batch", "process each file separately"), - a_compatibility = arg_lit0("c", "compatibility", "Markdown compatibility mode"), a_full = arg_lit0("f", "full", "force a complete document"), a_snippet = arg_lit0("s", "snippet", "force a snippet"), - a_random = arg_lit0("", "random", "use random numbers for footnote anchors"), + a_compatibility = arg_lit0("c", "compatibility", "Markdown compatibility mode"), + a_random = arg_lit0(NULL, "random", "use random numbers for footnote anchors"), + a_nolabels = arg_lit0(NULL, "nolabels", "Disable id attributes for headers"), a_rem2 = arg_rem("", ""), - a_accept = arg_lit0("a", "accept", "accept all CriticMarkup changes"), - a_reject = arg_lit0("r", "reject", "reject all CriticMarkup changes"), + a_format = arg_str0("t", "to", "FORMAT", "convert to FORMAT, FORMAT = html|latex|beamer|memoir|mmd|odf|epub"), + a_o = arg_file0("o", "output", "FILE", "send output to FILE"), - a_rem3 = arg_rem("", ""), + a_rem3 = arg_rem("",""), - a_nolabels = arg_lit0(NULL, "nolabels", "Disable id attributes for headers"), - - a_file = arg_filen(NULL, NULL, "", 0, argc+2, "read input from file(s)"), + a_accept = arg_lit0("a", "accept", "accept all CriticMarkup changes"), + a_reject = arg_lit0("r", "reject", "reject all CriticMarkup changes"), a_rem4 = arg_rem("", ""), a_lang = arg_str0("l", "lang", "LANG", "language/smart quote localization, LANG = en|es|de|fr|nl|sv"), + + a_rem5 = arg_rem("", ""), + + a_file = arg_filen(NULL, NULL, "", 0, argc+2, "read input from file(s) -- use stdin if no files given"), + a_end = arg_end(20), }; @@ -179,7 +181,7 @@ int main(int argc, char** argv) { // '--help' takes precedence if (a_help->count > 0) { - printf("\n%s v%s\n\n", MULTIMARKDOWN_NAME, MULTIMARKDOWN_VERSION); + printf("\n%s v%s -- %s\n\n", MULTIMARKDOWN_NAME, MULTIMARKDOWN_VERSION, MULTIMARKDOWN_COPYRIGHT); printf("\tUsage: %s", binname); arg_print_syntax(stdout, argtable, "\n\n"); printf("Options:\n"); -- 2.40.0