Compare commits
4 Commits
6f6df5fd07
...
68ad78e0a3
Author | SHA1 | Date | |
---|---|---|---|
68ad78e0a3 | |||
f13dfc77f8 | |||
2bcdde6341 | |||
d9035f6f2f |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
*.swp
|
||||
env
|
||||
n
|
||||
web
|
||||
|
11
notes2web.py
11
notes2web.py
@ -41,6 +41,7 @@ def get_files(folder):
|
||||
|
||||
return markdown, plaintext, other
|
||||
|
||||
|
||||
def git_filehistory(working_dir, filename):
|
||||
print(f"{pathlib.Path(filename).relative_to(working_dir)=}")
|
||||
git_response = subprocess.run(
|
||||
@ -302,7 +303,7 @@ def main(args):
|
||||
'isdirectory': fullpath.is_dir()
|
||||
})
|
||||
|
||||
indexentries.sort(key=lambda entry: str(entry['title']))
|
||||
indexentries.sort(key=lambda entry: str(entry['title']).lower())
|
||||
indexentries.sort(key=lambda entry: entry['isdirectory'], reverse=True)
|
||||
|
||||
html = re.sub(r'\$title\$', str(directory), INDEX_TEMPLATE_HEAD)
|
||||
@ -313,7 +314,13 @@ def main(args):
|
||||
)
|
||||
|
||||
for entry in indexentries:
|
||||
html += f"<div class=\"article\"><a href=\"{entry['path']}\">{entry['title']}{'/' if entry['isdirectory'] else ''}</a></div>"
|
||||
html += (
|
||||
'<div class="article">'
|
||||
f'<a href="{entry["path"]}">'
|
||||
f'{entry["title"]}{"/" if entry["isdirectory"] else ""}'
|
||||
'</a>'
|
||||
'</div>'
|
||||
)
|
||||
html += INDEX_TEMPLATE_FOOT
|
||||
|
||||
with open(directory.joinpath('index.html'), 'w+') as fp:
|
||||
|
11
readme.md
11
readme.md
@ -15,6 +15,7 @@ doing it for me:
|
||||
- It was annoying to sync to my phone
|
||||
- PDFs do not scale so they were hard to read on smaller screens
|
||||
- Probably more reasons I can't think of right now
|
||||
- Fun
|
||||
|
||||
|
||||
## Install
|
||||
@ -32,11 +33,13 @@ doing it for me:
|
||||
|
||||
- notes2web reads the following YAML [frontmatter](https://jekyllrb.com/docs/front-matter/) variable:
|
||||
|
||||
- `author` --- The person(s) who wrote the article
|
||||
- `tags` --- A YAML list of tags which the article relates to - this is used for browsing and also searching
|
||||
- `title` --- The title of the article
|
||||
- `author` --- The person(s) who wrote the article
|
||||
- `tags` --- A YAML list of tags which the article relates to - this is used for browsing and also
|
||||
searching
|
||||
- `title` --- The title of the article
|
||||
|
||||
- notes2web indexes [ATX-style headings](https://pandoc.org/MANUAL.html#atx-style-headings) for searching
|
||||
- notes2web indexes [ATX-style headings](https://pandoc.org/MANUAL.html#atx-style-headings) for
|
||||
searching
|
||||
- notes2web attempts to display file history through the `git log` command
|
||||
|
||||
## CLI Usage
|
||||
|
Reference in New Issue
Block a user