commit 75f7a2d7426f56fd73cd8d15758dc699e4e4a89f Author: François Pelletier Date: Mon Jan 8 10:18:32 2024 -0500 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..85e7c1d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/.idea/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ca24659 --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright 2024 François Pelletier + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..df4e04c --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Convert Markdown output from Freeplane to Markdown lists \ No newline at end of file diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/markdown-fix-freeplane.py b/markdown-fix-freeplane.py new file mode 100644 index 0000000..d29e376 --- /dev/null +++ b/markdown-fix-freeplane.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python + + +import re +import sys + + +# %% +def replace_title_with_list(text): + text = re.sub(r'#(#+)\s*(.*)', r'\1- \2', text) + text = re.sub(r'#', ' ', text) + return text + + +def __main__(): + # read file passed as argument + with open(sys.argv[1], 'r') as my_file: + text = my_file.read() + print(replace_title_with_list(text)) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..66e5000 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,22 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "markdown-fix-freeplane" +version = "0.0.1" +authors = [ + { name="François Pelletier", email="francois@jevalide.ca" }, +] +description = "Convert Markdown output from Freeplane to Markdown lists" +readme = "README.md" +requires-python = ">=3.8" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", +] + +[project.urls] +Homepage = "https://git.jevalide.ca/partage/markdown-fix-freeplane" +Issues = "https://git.jevalide.ca/partage/markdown-fix-freeplane/issues"