Compare commits

...

4 Commits

Author SHA1 Message Date
68ad78e0a3
Formatting 2021-09-01 14:08:24 +01:00
f13dfc77f8
Sort browsing entries case-insensetive 2021-09-01 14:08:00 +01:00
2bcdde6341
Update .gitignore 2021-09-01 13:36:04 +01:00
d9035f6f2f
Update readme 2021-09-01 13:35:43 +01:00
3 changed files with 18 additions and 6 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
*.swp
env
n
web

View File

@ -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:

View File

@ -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