Compare commits

...

21 Commits

Author SHA1 Message Date
Mohamed Elashri 1e9a6e0406
Merge pull request #29 from MohamedElashri/linter2main
Add linter to the generate_readme action
2024-11-16 04:14:21 +00:00
Mohamed Elashri bdd5b547ac
Add linter to the generate_readme action 2024-11-15 22:44:12 -05:00
Mohamed Elashri cbf352bf4b
Merge pull request #28 from MohamedElashri/fix-linter
Ensure awesome-lint compliance
2024-11-16 03:13:40 +00:00
Mohamed Elashri 56cefc63c6
remove duplication in first line 2024-11-15 22:11:32 -05:00
Mohamed Elashri 158e9072e4
Update generate_readme.py 2024-11-15 22:08:26 -05:00
Mohamed Elashri b55c8df426
Add more triggering paths 2024-11-15 21:45:15 -05:00
Mohamed Elashri 9118ee6244
Merge branch 'main' into fix-linter 2024-11-16 02:25:26 +00:00
MohamedElashri 43a4b3cd60 Auto-update README.md [skip ci] 2024-11-16 02:20:28 +00:00
Mohamed Elashri 49317b4b35
Merge pull request #27 from MohamedElashri/zotero-better-author
Add  Ethereal Style for Zotero plugin
2024-11-16 02:20:17 +00:00
Mohamed Elashri 0a34bba749
Resolve duplicate links and enforce list formatting for awesome-lint compliance 2024-11-15 21:10:37 -05:00
Mohamed Elashri acab6bbd6c
Remove duplicate obsidian-zotlit 2024-11-15 21:07:51 -05:00
Mohamed Elashri 5f5ef27a82
Add obsidian-zotlit
The purpose also is to test the linter fix
2024-11-15 21:05:54 -05:00
Mohamed Elashri 36b4f83194
Add manual run for the testing CI 2024-11-15 21:02:46 -05:00
Mohamed Elashri 04a567519f
Fix: Ensure awesome-lint compliance with badge and punctuation updates 2024-11-15 20:59:18 -05:00
Mohamed Elashri 54ba5f463a
Add Ethereal Style for Zotero plugin 2024-11-15 20:26:24 -05:00
MohamedElashri 4f39f72afe Auto-update README.md [skip ci] 2024-11-13 20:57:36 +00:00
Mohamed Elashri 4899f276af
Merge pull request #26 from MohamedElashri/zotero-arxiv-workflow
Add zotero-arxiv-workflow plugin
2024-11-13 20:57:25 +00:00
MohamedElashri e9f799e891
Add zotero-arxiv-workflow plugin 2024-11-12 09:51:20 -05:00
Mohamed Elashri 26e18544b2
Merge pull request #25 from MohamedElashri/mix-_linter_with_test_ci
Integrate Awesome Lint Check into PR Workflow for README Generation
2024-11-12 14:45:01 +00:00
MohamedElashri e3684f0002
Remove lint workflow and modify README generation test action with linting step 2024-11-12 09:40:39 -05:00
Mohamed Elashri e6706d18f5
Merge pull request #24 from MohamedElashri/add_generate_test_action
Add generate test action
2024-11-12 14:32:05 +00:00
6 changed files with 99 additions and 43 deletions

View File

@ -1,20 +1,28 @@
name: Update README
on:
push:
branches:
- main
paths:
- '_README.md'
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Generate README.md
run: |
python3 generate_readme.py _README.md > README.md
- name: Lint README.md
run: npx awesome-lint README.md
- name: Commit changes
if: success() # Only commit if linting passes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'Auto-update README.md [skip ci]'

View File

@ -1,17 +0,0 @@
name: Awesome Lint CI
on:
push:
branches: ['main']
pull_request:
branches: ['**']
schedule:
- cron: "0 7 * * *"
jobs:
Awesome_Lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Run Awesome Lint
run: npx awesome-lint

View File

@ -1,19 +1,28 @@
name: Test README Generation
on:
pull_request:
branches: ['**']
paths:
- '_README.md'
workflow_dispatch:
- 'generate_readme.py'
- '.github/workflows/test-readme.yml'
workflow_dispatch:
jobs:
test-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Generate README.md (Test Only)
run: |
python3 generate_readme.py _README.md > README.md
- name: Show README.md output
run: |
cat README.md
- name: Run Awesome Lint on Generated README
run: npx awesome-lint README.md

View File

@ -179,6 +179,14 @@ Your help is much appreciated. If you want to add something or fix a problem, lo
![Stars](https://img.shields.io/github/stars/wshanks/Zutilo?style=flat-square)
![Forks](https://img.shields.io/github/forks/wshanks/Zutilo?style=flat-square)
- [zotero-style](https://github.com/MuiseDestiny/zotero-style) - Zotero plugin to provide ethereal Style
![Last Commit](https://img.shields.io/github/last-commit/MuiseDestiny/zotero-style?style=flat-square)
![License](https://img.shields.io/github/license/MuiseDestiny/zotero-style?style=flat-square)
![Issues](https://img.shields.io/github/issues/MuiseDestiny/zotero-style?style=flat-square)
![Stars](https://img.shields.io/github/stars/MuiseDestiny/zotero-style?style=flat-square)
![Forks](https://img.shields.io/github/forks/MuiseDestiny/zotero-style?style=flat-square)
### Developer
- [Generator-zotero-plugin](https://www.npmjs.com/package/generator-zotero-plugin) - Generate a Zotero Plugin scaffold.
@ -285,6 +293,14 @@ Your help is much appreciated. If you want to add something or fix a problem, lo
![Stars](https://img.shields.io/github/stars/syt2/zotero-addons?style=flat-square)
![Forks](https://img.shields.io/github/forks/syt2/zotero-addons?style=flat-square)
- [zotero-arxiv-workflow](https://github.com/AllanChain/zotero-arxiv-workflow) - Zotero plugin to help you manage adding and updating papers from arXiv.
![Last Commit](https://img.shields.io/github/last-commit/AllanChain/zotero-arxiv-workflow?style=flat-square)
![License](https://img.shields.io/github/license/AllanChain/zotero-arxiv-workflow?style=flat-square)
![Issues](https://img.shields.io/github/issues/AllanChain/zotero-arxiv-workflow?style=flat-square)
![Stars](https://img.shields.io/github/stars/AllanChain/zotero-arxiv-workflow?style=flat-square)
![Forks](https://img.shields.io/github/forks/AllanChain/zotero-arxiv-workflow?style=flat-square)
### Productivity
- [Chartero](https://github.com/volatile-static/Chartero) - Zotero plugin to provide charts in Zotero.

View File

@ -46,6 +46,7 @@ Your help is much appreciated. If you want to add something or fix a problem, lo
- [Zotero-reference](https://github.com/MuiseDestiny/zotero-reference) - PDF references add-on for Zotero.
- [Zotero-pdf-preview](https://github.com/windingwind/zotero-pdf-preview) - Preview Zotero attachments in the library view.
- [Zutilo](https://github.com/wshanks/Zutilo) - Zotero plugin providing some additional editing features.
- [zotero-style](https://github.com/MuiseDestiny/zotero-style) - Zotero plugin to provide ethereal Style
### Developer
- [Generator-zotero-plugin](https://www.npmjs.com/package/generator-zotero-plugin) - Generate a Zotero Plugin scaffold.
@ -68,6 +69,7 @@ Your help is much appreciated. If you want to add something or fix a problem, lo
- [Awesome GPT](https://github.com/MuiseDestiny/zotero-gpt) - Zotero plugin to provide GPT backend into Zotero using API.
- [KeepZotero](https://github.com/yhmtsai/KeepZotero) - Zotero plugin to keep Zotero in the taskbar by changing close to minimize or disabling shortcuts.
- [Zotero Addons](https://github.com/syt2/zotero-addons) - Zotero add-on to list and install add-ons in Zotero.
- [zotero-arxiv-workflow](https://github.com/AllanChain/zotero-arxiv-workflow) - Zotero plugin to help you manage adding and updating papers from arXiv.
### Productivity
- [Chartero](https://github.com/volatile-static/Chartero) - Zotero plugin to provide charts in Zotero.

View File

@ -9,6 +9,7 @@ def extract_repo(url):
match = re.match(r'https://github\.com/([^/]+/[^/]+)', url)
return match[1] if match else ''
def add_badges(lines):
"""Add GitHub badges to lines containing GitHub repository URLs."""
processed_lines = []
@ -22,11 +23,11 @@ def add_badges(lines):
processed_lines.append('') # Add a blank line
# Add shields.io badges
badges = [
f' ![Last Commit](https://img.shields.io/github/last-commit/{repo_name})',
f'![License](https://img.shields.io/github/license/{repo_name})',
f'![Issues](https://img.shields.io/github/issues/{repo_name})',
f'![Stars](https://img.shields.io/github/stars/{repo_name})',
f'![Forks](https://img.shields.io/github/forks/{repo_name})',
f' ![Last Commit](https://img.shields.io/github/last-commit/{repo_name}?style=flat-square)',
f'![License](https://img.shields.io/github/license/{repo_name}?style=flat-square)',
f'![Issues](https://img.shields.io/github/issues/{repo_name}?style=flat-square)',
f'![Stars](https://img.shields.io/github/stars/{repo_name}?style=flat-square)',
f'![Forks](https://img.shields.io/github/forks/{repo_name}?style=flat-square)',
''
]
processed_lines.extend(badges)
@ -36,30 +37,64 @@ def add_badges(lines):
processed_lines.append(line)
return processed_lines
def style_badges(lines):
"""Add the 'flat-square' style to all image badges in the lines."""
def replace_style(match):
alt_text = match.group(1)
url = match.group(2)
url += '&style=flat-square' if '?' in url else '?style=flat-square'
return f'![{alt_text}]({url})'
styled_lines = []
pattern = re.compile(r'!\[([^\]]+)\]\(([^)]+)\)')
def ensure_punctuation(lines):
"""Ensure all list item descriptions end with a period."""
punctuated_lines = []
for line in lines:
styled_line = pattern.sub(replace_style, line)
styled_lines.append(styled_line)
return styled_lines
if re.match(r'- \[.*?\]\(.*?\) - .*[^.]$', line):
line += '.' # Append a period
punctuated_lines.append(line)
return punctuated_lines
def remove_extra_parentheses(lines):
"""Remove extra closing parentheses at the end of image markdown links."""
corrected_lines = []
for line in lines:
# Match image links with potential extra closing parentheses
corrected_line = re.sub(r'(!\[[^\]]*\]\([^\)]*\))\)+', r'\1', line)
corrected_lines.append(corrected_line)
return corrected_lines
def add_awesome_badge(lines):
"""Ensure the Awesome badge is correctly added."""
# Check for an existing "Awesome" badge in the lines
for line in lines:
if "https://awesome.re" in line:
return lines # Badge already exists; do nothing
# Add the badge at the top if not present
badge = '[![Awesome](https://awesome.re/badge-flat.svg)](https://awesome.re)'
lines.insert(0, badge)
return lines
def fix_list_item_format(lines):
"""Ensure list items use a dash separator between link and description."""
formatted_lines = []
for line in lines:
if re.match(r'- \[.*?\]\(.*?\) .*', line):
line = re.sub(r'(\]\(.*?\)) ', r'\1 - ', line) # Ensure a dash after the link
formatted_lines.append(line)
return formatted_lines
def remove_duplicate_links(lines):
"""Remove duplicate links in the markdown."""
seen_links = set()
deduplicated_lines = []
for line in lines:
# Check for links in the current line
if match := re.search(r'\((https?://[^\)]+)\)', line):
link = match.group(1)
if link in seen_links and "https://awesome.re" not in line:
continue # Skip duplicate links (but don't remove Awesome badge)
seen_links.add(link)
deduplicated_lines.append(line)
return deduplicated_lines
def main():
if len(sys.argv) != 2:
print("Usage: python script.py <input_markdown_file>")
@ -70,13 +105,16 @@ def main():
with open(input_file, 'r', encoding='utf-8') as f:
lines = [line.rstrip('\n') for line in f]
lines_with_badges = add_badges(lines)
lines = add_awesome_badge(lines)
lines = add_badges(lines)
lines = ensure_punctuation(lines)
lines = fix_list_item_format(lines)
lines = remove_duplicate_links(lines)
lines = remove_extra_parentheses(lines)
lines_with_square_badges = style_badges(lines_with_badges)
final_lines = remove_extra_parentheses(lines_with_square_badges)
for line in final_lines:
for line in lines:
print(line)
main()
if __name__ == "__main__":
main()