-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a directory to find tasks in markdown files
- Loading branch information
Showing
13 changed files
with
95 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import re | ||
|
||
|
||
regexp = re.compile(r'''( | ||
regexp = re.compile( | ||
r"""( | ||
[a-zA-Z0-9._%+-]+ # username | ||
@ # @ symbol | ||
(\w)+ # domain name | ||
(\.[a-zA-Z]{2,4}) # dot-something | ||
)''', re.VERBOSE) | ||
)""", | ||
re.VERBOSE, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#! python3 | ||
# taskInFile.py - Finds tasks in a given markdown file, prints them to the terminal and copys them to the clipboards | ||
# Usage: call the program with a file path as the first argument | ||
# Example: >>> taskInFile.py C:\\Users\\ExampleUser\\Documents\\myTasks.md | ||
|
||
|
||
# import pyperclip | ||
import sys | ||
import os | ||
|
||
|
||
def main(): | ||
# Check if sys.argv[1] is given | ||
argumentOne = "" | ||
try: | ||
argumentOne = sys.argv[1] | ||
except IndexError: | ||
exit("No argument given. Try again with a file path as an argument") | ||
|
||
# Make absolute path if given path is a relative path | ||
if not os.path.isabs(argumentOne): | ||
argumentOne = os.path.abspath(argumentOne) | ||
|
||
files = os.listdir(argumentOne) | ||
|
||
for file in files: | ||
if file.endswith(".md"): | ||
handleFile(argumentOne + "\\" + file) | ||
|
||
|
||
def handleFile(markdownFile: str): | ||
with open(markdownFile, "r") as f: | ||
for line in f: | ||
if "!!!" in line: | ||
print(f"Task in line found: {line[:-1]}") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Header 1 | ||
## Header 2 | ||
- test | ||
# Header 3 | ||
- task !!! | ||
- Unteraufgabe | ||
- Task Unter!!! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import re | ||
# protocol (http,https,ftp), www, url with dot something | ||
regexp = re.compile(r'''(?:(?:https?|ftp):\/\/)?[\w/\-?=%.]+\.[\w/\-&?=%.]+''') | ||
|
||
# protocol (http,https,ftp), www, url with dot something | ||
regexp = re.compile(r"""(?:(?:https?|ftp):\/\/)?[\w/\-?=%.]+\.[\w/\-&?=%.]+""") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters