From 802ddaa8b6c2aa3813c2f1fdd503bd493c2393d7 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 30 Oct 2024 12:38:01 +0100 Subject: [PATCH 1/2] Added an option to set the 2-letter language code for the Wikipedia page --- wiki-to-md.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wiki-to-md.py b/wiki-to-md.py index c190193..80490f1 100644 --- a/wiki-to-md.py +++ b/wiki-to-md.py @@ -47,9 +47,19 @@ def generate_markdown(topic): type=str, help="The topic to generate a markdown file for.", ) +parser.add_argument( + "--lang", + type=str, + default="en", + help="The 2-letter language code for the Wikipedia page (default: 'en')." +) args = parser.parse_args() +# Set the language for Wikipedia if provided +wikipedia.set_lang(args.lang) + topic = f"{args.topic}" generate_markdown(topic) + From a956280867394466275ad6e8f0d4c32a9b9e4118 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 30 Oct 2024 12:38:50 +0100 Subject: [PATCH 2/2] Added an option to set the 2-letter language code for the Wikipedia page --- wiki-to-md-images.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/wiki-to-md-images.py b/wiki-to-md-images.py index 2036281..095bf06 100644 --- a/wiki-to-md-images.py +++ b/wiki-to-md-images.py @@ -68,9 +68,18 @@ def generate_markdown(topic, download_images): default='yes', help="Specify whether to download images (yes or no).", ) +parser.add_argument( + "--lang", + type=str, + default="en", + help="The 2-letter language code for the Wikipedia page (default: 'en')." +) args = parser.parse_args() +# Set the language for Wikipedia if provided +wikipedia.set_lang(args.lang) + topic = f"{args.topic}" download_images = args.dl_image == 'yes'