{"id":22007407,"url":"https://github.com/joshpetit/reference_parser","last_synced_at":"2025-05-05T23:22:37.658Z","repository":{"id":54987337,"uuid":"299726389","full_name":"joshpetit/reference_parser","owner":"joshpetit","description":"Parse strings for bible references","archived":false,"fork":false,"pushed_at":"2024-07-19T13:11:05.000Z","size":239,"stargazers_count":7,"open_issues_count":2,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T00:41:14.871Z","etag":null,"topics":["bible","dart","parser","passage","religion"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/reference_parser","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joshpetit.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-09-29T20:07:32.000Z","updated_at":"2024-11-28T00:31:00.000Z","dependencies_parsed_at":"2024-11-30T01:26:19.601Z","dependency_job_id":"17dd7705-a54c-4b90-b0af-4684fa3ed9da","html_url":"https://github.com/joshpetit/reference_parser","commit_stats":{"total_commits":234,"total_committers":2,"mean_commits":117.0,"dds":"0.012820512820512775","last_synced_commit":"854adb70745a3c50501972b39a9be2aeeb7c02b6"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshpetit%2Freference_parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshpetit%2Freference_parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshpetit%2Freference_parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshpetit%2Freference_parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joshpetit","download_url":"https://codeload.github.com/joshpetit/reference_parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252591134,"owners_count":21773028,"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":["bible","dart","parser","passage","religion"],"created_at":"2024-11-30T01:26:12.483Z","updated_at":"2025-05-05T23:22:37.637Z","avatar_url":"https://github.com/joshpetit.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# reference_parser\nA dart package that parses strings for bible references. You can parse single references or\nmultiple references from a string in a variety of formats and also identify a text to\nits potential match in the bible.\n\nReally 99% of what you need to know will be found in the \n[Parsing References](#parsing-references) and [Identifying References](#identifying-references)\nheaders. But if you have more complicated needs this package can handle those!\n\n\u003c!-- toc --\u003e\n- [Usage](#usage)\n  * [Parsing References](#parsing-references)\n  * [Identifying References](#identifying-references)\n  * [Objects and References](#objects-and-references)\n    + [Reference](#reference)\n    + [Verses](#verses)\n    + [Chapters](#chapters)\n    + [Books](#books)\n  * [Constructing References](#constructing-references)\n    + [Invalid References](#invalid-references)\n  * [Other Fun Stuff](#other-fun-stuff)\n\u003c!-- tocstop --\u003e\n\n# Usage\n\nto include the default exports of reference parser add this to your imports:\n```dart\nimport package:reference_parser/reference_parser.dart`\n```\n\n## Parsing References\nuse the `parseReference` function to retrieve a single reference:\n\n```dart\nvar ref = parseReference(\"I like Mat 2:4-10 and John 3:1\");\n```\nThis will return a reference object describing 'Matthew 2:4-10'.\n\nuse the `parseAllReference` to retrieve all references within a string.\n\n```dart\nvar refs = parseAllReferences('I enjoy reading Gen 5:7 and 1Co 2-3');\n```\n**Note**: The word 'is' will be parsed as the book of Isaiah.\n\n## Identifying References\nimport the identification library with:\n\n`import 'package:reference_parser/identification.dart';`\n\nthen identify references like this:\n```dart\nidentifyReference(\"Come to me all ye\").then((possibilities) =\u003e {\n      print(possibilities[0]), // The most likely match would be at index 0\n    });\n```\nThe `identifyReference` method uses [biblehub.com](https://biblehub.com).\nIt will return a PassageQuery object that contains a Reference object along with\na preview of the verse and the original query.\n\n## Objects and References\n\n### Reference\nReference objects are the broadest kind of reference.\nYou can directly construct one by following this format:\n\n```dart\nvar ref = Reference(book, [startChp, startVer, endChp, endVer]);\n```\n(for ease of use the `Reference` class has multiple named\nconstructorsr. Look [here](#constructing-references) and at the API reference.)\n\nTheir most important fields are these:\n```dart\nref.reference // The string representation (osisReference, shortReference, and abbr also available)\nref.startVerseNumber\nref.endVerseNumber\nref.startChapterNumber\nref.endChapterNumber\nref.referenceType // VERSE, CHAPTER, VERSE_RANGE, CHAPTER_RANGE\n```\nBased on what is passed in, the constructor will figure out\ncertain fields. For example, if you were to construct `Reference('James')`\nthe last chapter and verse numbers in James will be initialized accordingly.\n\nThere are many other fields that may prove useful such as \nones that subdivid the reference, look [here](#other-fun stuff)\n\n-------\n\n### Verses\n\n`Reference` objects have a `startVerse` and `endVerse` field\nthat return objects of the Verse type.\n```dart\nvar firstVerse = ref.startVerse;\nvar randomVerse = Verse(book, chapter, verse);\n```\n\nYou can also construct `Reference`s that 'act' like\nverses by using the named constructor\n```dart\nvar ref = Reference.verse(book, chapter, verse);\n```\n\n------\n\n### Chapters\n```dart\nref = parseReference(\"James 5 is a chapter\");\n```\nThe `ref` object now holds a `Reference` to \"James 5\". Despite this, startVerseNumber and endVerseNumber are initialized to the first and last verses in James 5. \n```dart\nref.startVerseNumber // 1\nref.endVerseNumber // 20\nref.referenceType // ReferenceType.CHAPTER\n```\n\nThe Reference object also has start/end chapter fields\n```dart\nvar ref = parseReference('James 5-10 is cool');\nref.startChapterNumber // 5\nref.endChapterNumber // 10\n```\n\nJust like verses you can create chapter objects:\n\n```dart\nvar chp = Chapter(book, chapter);\n```\n------\n\n### Books\n```dart\nvar ref = parseReference(\"Ecclesiastes is hard to spell\");\nref.startChapterNumber // 1\nref.endChapterNumber // 12\nref.ReferenceType // ReferenceType.BOOK\n```\nBooks don't have their own class, they're the equivalent of\na `Reference` object.\n\n## Constructing References\n\n### Verses\n```dart\nvar ref = Reference(\"Mat\", 2, 4);\nvar ref = Reference.verse(\"Mat\", 2, 4);\nvar verse = Verse(\"Matt\", 2, 4);\n```\nNote that the `verse` object has different fields than a\n`Reference` object. Check the API.\n\n### Verse Ranges\n```dart\nref = Reference(\"Mat\", 2, 4, null, 10);\nref = Reference.verseRange(\"Mat\", 2, 4, 10);\n```\nThese are equivalents that create a reference to 'Matthew 2:4-10'.\n\nThe same constructors and classes apply for chapters.\n\n### Invalid References\nAll references have an `isValid` field that says whether this reference\nis within the bible.\n\n```dart\nvar ref = Reference(\"McDonald\", 2, 4, 10);\nprint(ref.isValid) // false, as far as I know at least.\n```\n**Notice that the other fields are still initialized!!** So if needed, make\nsure to check that a reference is valid before using it.\n```dart\nref.reference // \"McDonald 2:4-10\"\nref.book // \"McDonald\"\nref.startVerseNumber // 4\nref.osisBook // null, and so will be other formats.\n```\n\nThe same logic applies to chapters and verse numbers.\n```dart\nref = Reference(\"Jude\", 2, 10);\nref.isValid // false (Jude only has one chapter)\n```\n## Other fun stuff\nI made this library bloat so it can do a lot haha.\n```dart\nref.verses // returns a list of verse objects within this reference. There's Also one for chapters.\nref.chapters // each chapter\nref.osisReference // the osis representation (there's also short, and abbr)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshpetit%2Freference_parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshpetit%2Freference_parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshpetit%2Freference_parser/lists"}