{"id":17059194,"url":"https://github.com/novoid/orgformat","last_synced_at":"2025-08-11T20:14:38.917Z","repository":{"id":57449635,"uuid":"219344007","full_name":"novoid/orgformat","owner":"novoid","description":"Utility library for providing functions to generate and modify Org mode syntax elements like links, time-stamps, or date-stamps.","archived":false,"fork":false,"pushed_at":"2024-10-23T09:36:56.000Z","size":108,"stargazers_count":31,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-04T18:20:51.538Z","etag":null,"topics":["date","library","org-mode","orgdown","orgmode","time"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/novoid.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-03T18:10:23.000Z","updated_at":"2025-05-01T16:23:57.000Z","dependencies_parsed_at":"2022-09-14T11:01:23.849Z","dependency_job_id":null,"html_url":"https://github.com/novoid/orgformat","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novoid%2Forgformat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novoid%2Forgformat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novoid%2Forgformat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novoid%2Forgformat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/novoid","download_url":"https://codeload.github.com/novoid/orgformat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253754967,"owners_count":21958934,"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":["date","library","org-mode","orgdown","orgmode","time"],"created_at":"2024-10-14T10:33:08.434Z","updated_at":"2025-05-12T14:32:36.740Z","avatar_url":"https://github.com/novoid.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"* orgformat\n\nThis is a utility library for providing functions to generate and\nmodify [[https://orgmode.org][Org mode]] syntax elements like [[https://orgmode.org/manual/Headlines.html#Headlines][headings]], [[https://orgmode.org/manual/External-links.html][links]], [[https://orgmode.org/manual/Timestamps.html#Timestamps][time-stamps]], or\ndate-stamps.\n\n** Documentation\n\nYou can find the [[http://htmlpreview.github.io/?https://github.com/novoid/orgformat/blob/master/orgformat.html][pydoc documentation in HTML here]]. Sorry for the\ndefault colors of pydoc.\n\nI also consider [[file:orgformat/orgformat_test.py][the unit tests as a good starting point]] to learn about\nthe features provided.\n\nJust *a few* examples:\n\n#+BEGIN_SRC python\n        self.assertEqual(OrgFormat.orgmode_timestamp_to_datetime(\n            '\u003c1980-12-31 Wed 23:59\u003e'),\n                         datetime.datetime(1980, 12, 31, 23, 59, 0, tzinfo=None))\n\n        self.assertEqual(OrgFormat.apply_timedelta_to_org_timestamp(\n            '\u003c2019-11-06 Wed 00:59\u003e', -2.0), '\u003c2019-11-05 Tue 22:59\u003e')\n\n        self.assertEqual(OrgFormat.date(time.strptime('2011-11-02T20:38', '%Y-%m-%dT%H:%M'), \n                                        inactive=False,\n                                        repeater_or_delay='+2w '),\n                         '\u003c2011-11-02 Wed +2w\u003e')\n\n        self.assertEqual(\n            OrgFormat.daterange_autodetect_time(\n                time.strptime('2011-11-29', '%Y-%m-%d'),\n                time.strptime('2011-11-30T23:59', '%Y-%m-%dT%H:%M'), inactive=True),\n            '[2011-11-29 Tue 00:00]--[2011-11-30 Wed 23:59]')\n\n        self.assertEqual(OrgFormat.strdate('2011-11-03T23:59'), '\u003c2011-11-03 Thu\u003e')\n        self.assertEqual(OrgFormat.strdate('2011-11-30 21:06', show_time=True, repeater_or_delay=' +7y   '),\n                         '\u003c2011-11-30 Wed 21:06 +7y\u003e')\n\n        self.assertEqual(OrgFormat.parse_extended_iso_datetime(\"2011-1-2T3:4:5\"),\n                         time.strptime('2011-01-02 03.04.05', '%Y-%m-%d %H.%M.%S'))\n\n\n        self.assertEqual(\n            OrgFormat.date(\n                OrgFormat.parse_basic_iso_datetime('20111219T205510Z'), True\n            ),\n            '\u003c2011-12-19 Mon 21:55\u003e'\n        )\n\n        self.assertEqual(OrgFormat.mailto_link('Bob@example.com'),\n                         '[[mailto:Bob@example.com][Bob@example.com]]')\n\n        self.assertEqual(OrgFormat.dhms_from_sec(99999), '1d 3:46:39')\n\n        self.assertEqual(OrgFormat.generate_heading(level=1,\n                                                    keyword='TODO',\n                                                    priority='A',\n                                                    title='This is my title',\n                                                    tags=['foo', 'bar_baz'],\n                                                    scheduled_timestamp='\u003c2019-12-29 Sun 11:35\u003e',\n                                                    deadline_timestamp='\u003c2019-12-30 Mon 23:59\u003e',\n                                                    properties=[('CREATED', OrgFormat.strdate('2011-11-03 23:59', inactive=True, show_time=True)),\n                                                                ('myproperty','foo bar baz')],\n                                                    section=' With this being\\nthe content of the heading section.'),\n'''* TODO [#A] This is my title  :foo:bar_baz:\nSCHEDULED: \u003c2019-12-29 Sun 11:35\u003e DEADLINE: \u003c2019-12-30 Mon 23:59\u003e\n:PROPERTIES:\n:CREATED: [2011-11-03 Thu 23:59]\n:myproperty: foo bar baz\n:END:\n\n With this being\nthe content of the heading section.\n''')\n#+END_SRC\n\n** Installation\n\nThis tool needs [[http://www.python.org/downloads/][Python 3 to be installed]].\n\nYou can install orgformat stand-alone via [[https://packaging.python.org/tutorials/installing-packages/][pip]]:\n\n: pip3 install orgformat\n\nIf you are using a project that is referring to orgformat, this\nlibrary usually gets added to the =requirements.txt= file of that\nproject and installed when you do invoke:\n\n: pip3 install -r requirements.txt\n\n** Changelog\n\nThis changelog does not list all commits/changes, just the substantial\nones.\n\n- 2019.11.03.1: Finished moving from Memacs and lazyblorg to a separate library\n- 2019.11.06.1:\n  - [[https://www.python.org/dev/peps/pep-0484/][Python type annotations]] added for [[https://mypy.readthedocs.io/en/latest/index.html][mypy]] checks\n  - Refactoring, simplification, unification:\n    - more parameters for =show_time= and =inactive=\n    - removed some very basic and so-far unused wrappers for other functions\n    - removed functions for detailed parameters that got replaced by more generalized functions\n    - renamed some functions\n  - Unit tests for all functions ;-)\n  - Much [[file:orgformat.html][better documentation]] including examples\n  - /Don't worry about these breaking changes/: Memacs and lazyblorg\n    (the only projects using this library so far) were adapted\n    accordingly and therefore nobody else is affected. *No breaking\n    changes like this in the future.*\n- 2019.12.28.1: =generate_heading()=\n- 2019.12.29.1:\n  - =date()=, =strdate()=: added =repeater_or_delay=\n  - =generate_headining()=: added =scheduled_timestamp= and =deadline_timestamp=\n\n** History\n\nThis file was initially written mainly by https://github.com/awieser\nand was part of [[https://github.com/novoid/Memacs][Memacs]].\n\nAs of 2019-10-31, this file is moved to an independent library since\nmultiple projects are using its functions such as:\n\n- [[https://github.com/novoid/lazyblorg][lazyblorg]]\n- [[https://github.com/novoid/appendorgheading][appendorgheading]] is basically a Python wrapper script for\n  =generate_headining()= to be used from command line\n\n** How to Thank Me\n\nI'm glad you like my tools. If you want to support me:\n\n- Send old-fashioned *postcard* per snailmail - I love personal feedback!\n  - see [[http://tinyurl.com/j6w8hyo][my address]]\n- Send feature wishes or improvements as an issue on GitHub\n- Create issues on GitHub for bugs\n- Contribute merge requests for bug fixes\n- Contribute unit tests\n- Check out my other cool [[https://github.com/novoid][projects on GitHub]]\n\n* Local Variables                                                  :noexport:\n# Local Variables:\n# mode: auto-fill\n# mode: flyspell\n# eval: (ispell-change-dictionary \"en_US\")\n# End:\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnovoid%2Forgformat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnovoid%2Forgformat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnovoid%2Forgformat/lists"}