{"id":15493806,"url":"https://github.com/peter554/shrtcodes","last_synced_at":"2025-03-28T17:13:19.113Z","repository":{"id":57467009,"uuid":"276986526","full_name":"Peter554/shrtcodes","owner":"Peter554","description":"Shortcodes for Python","archived":false,"fork":false,"pushed_at":"2023-10-18T06:51:59.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T09:44:33.389Z","etag":null,"topics":["python","shortcodes"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/shrtcodes/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Peter554.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-03T21:00:12.000Z","updated_at":"2022-12-16T07:18:34.000Z","dependencies_parsed_at":"2024-12-08T06:23:04.836Z","dependency_job_id":"bafe5cd9-604e-43b9-b194-bb4c58c8a358","html_url":"https://github.com/Peter554/shrtcodes","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.5,"last_synced_commit":"de0de49d155d6886266343bcca9d02f48d1c42a8"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Peter554%2Fshrtcodes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Peter554%2Fshrtcodes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Peter554%2Fshrtcodes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Peter554%2Fshrtcodes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Peter554","download_url":"https://codeload.github.com/Peter554/shrtcodes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246068302,"owners_count":20718503,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","shortcodes"],"created_at":"2024-10-02T08:09:27.174Z","updated_at":"2025-03-28T17:13:19.080Z","avatar_url":"https://github.com/Peter554.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# shrtcodes\n\n![example workflow name](https://github.com/Peter554/shrtcodes/workflows/CI/badge.svg)\n\n`pip install shrtcodes`\n\nShortcodes for Python.\n\n## Example:\n\nA toy example.\n\nDefine our shortcodes:\n\n```py\n# example.py\nfrom shrtcodes import Shrtcodes\n\n\nshortcodes = Shrtcodes()\n\n\n# {% img src alt %} will create an image.\n@shortcodes.register_inline(\"img\")\ndef handle_img(src: str, alt: str) -\u003e str:\n    return f'\u003cimg src=\"{src}\" alt=\"{alt}\"/\u003e'\n\n\n# {% repeat n %}...{% / %} will repeat a block n times.\n@shortcodes.register_block(\"repeat\")\ndef handle_repeat(block: str, n: str) -\u003e str:\n    return block * int(n)\n\n\n# we can call process_text to get the final text.\nin_text = \"...\"\nout_text = shortcodes.process_text(in_text)\n\n# or, we can create a CLI.\nshortcodes.create_cli()\n\n```\n\n```\npython example.py --help\n```\n\n```\nusage: example.py [-h] [--check_file CHECK_FILE] in_file\n\npositional arguments:\n  in_file               File to be processed\n\noptions:\n  -h, --help            show this help message and exit\n  --check_file CHECK_FILE\n                        Checks the output against this file and errors if\n                        there is a diff\n\n```\n\nWrite some text:\n\n```\n# example.txt\nHello!\n\n{% img http://cutedogs.com/dog123.jpg \"A very cute dog\" %}\n\nFoo bar baz...\n\n{% repeat 3 %}\nWoop\n{% / %}\n\nBye!\n```\n\nProcess the text:\n\n```\npython example.py example.txt\n```\n\n```\nHello!\n\n\u003cimg src=\"http://cutedogs.com/dog123.jpg\" alt=\"A very cute dog\"/\u003e\n\nFoo bar baz...\n\nWoop\nWoop\nWoop\n\nBye!\n```\n\nA more useful example would be the generation of this README itself.\nSee [`make_readme.py`](/make_readme.py) and [`.README.template.md`](/.README.template.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter554%2Fshrtcodes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeter554%2Fshrtcodes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter554%2Fshrtcodes/lists"}