{"id":27387102,"url":"https://github.com/bxt/wptemplates","last_synced_at":"2025-10-17T08:03:13.940Z","repository":{"id":7528231,"uuid":"8879706","full_name":"bxt/wptemplates","owner":"bxt","description":"Collect template informations from MediaWiki markup","archived":false,"fork":false,"pushed_at":"2016-10-21T05:15:50.000Z","size":79,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-14T03:33:58.319Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/bxt.png","metadata":{"files":{"readme":"README.md","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":"2013-03-19T13:51:19.000Z","updated_at":"2016-10-21T04:13:20.000Z","dependencies_parsed_at":"2022-08-21T02:20:29.275Z","dependency_job_id":null,"html_url":"https://github.com/bxt/wptemplates","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/bxt/wptemplates","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bxt%2Fwptemplates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bxt%2Fwptemplates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bxt%2Fwptemplates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bxt%2Fwptemplates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bxt","download_url":"https://codeload.github.com/bxt/wptemplates/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bxt%2Fwptemplates/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279307807,"owners_count":26144797,"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","status":"online","status_checked_at":"2025-10-17T02:00:07.504Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-04-13T17:53:32.166Z","updated_at":"2025-10-17T08:03:13.912Z","avatar_url":"https://github.com/bxt.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wptemplates\n\n[![Build Status](https://travis-ci.org/bxt/wptemplates.png?branch=master)](https://travis-ci.org/bxt/wptemplates)\n[![Gem Version](https://badge.fury.io/rb/wptemplates.png)](http://badge.fury.io/rb/wptemplates)\n\nGem for collecting template informations from mediawiki markup. \n\nIt will help you to extract useful machine-readable data from\nwikipedia articles, since there ist a lot of useful stuff\nencoded as templates.\n\nCurrently only templates and links are parsed, all other markup is ignored.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'wptemplates'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install wptemplates\n\n## Usage\n\nTo parse a piece of markup simply call:\n\n\u003c!-- EXAMPLES:INIT --\u003e\n    ast = Wptemplates.parse(\"{{foo | bar | x = 3 }} baz [[bam (2003)|]]y\")\n\n\u003c!-- /EXAMPLES --\u003e\n\nYou will get an instance of Wptemplates::Soup which is an array of\nWptemplates::Template, Wptemplates::Link and Wptemplates::Text. \nYou can explore the AST with these methods:\n\n\u003c!-- EXAMPLES:intro --\u003e\n    ast.templates.is_a?(Array) \u0026\u0026 ast.templates.length # =\u003e 1\n    ast.text # =\u003e \" baz bamy\"\n\u003c!-- /EXAMPLES --\u003e\n\nTo find template data:\n\n\u003c!-- EXAMPLES:templates --\u003e\n    ast[0].name # =\u003e :foo\n    ast[0].params[0].text # =\u003e \" bar \"\n    ast[0].params[:x].text # =\u003e \"3\"\n    ast.all_templates_of(:foo).map{|t| t.params[:x].text} # =\u003e [\"3\"]\n    ast.navigate(:foo, :x) {|p|p.text} # =\u003e \"3\"\n    ast.navigate(:foo, :y) {|p|p.text} # =\u003e nil\n\u003c!-- /EXAMPLES --\u003e\n\nYou can access the links via: \n\n\u003c!-- EXAMPLES:links --\u003e\n    ast.links.length # =\u003e 1\n    ast.links[0].text # =\u003e \"bamy\"\n    ast.all_links.map{|l| l.link} # =\u003e [\"Bam (2003)\"]\n\u003c!-- /EXAMPLES --\u003e\n\n## Developing\n\nHere's some useful info if you want to improve/customize this gem. \n\n### Getting Started\n\nCheckout the project, run `bundle` and then `rake` to see if the tests\npass. Run `rake -T` to see the rake tasks. \n\n### Markup\n\nMediaWiki markup is not trivial to parse and there might always\nbe compatibility issues. There's a useful help page about \n[templates][tmplh] and a [markup spec][mspec]. For links there\nis a page about [links][linkh] and about the [pipe trick][ptrkh]. \nAlso, there is a page with [link's BNF][lnbnf]. \n\n### Known Issues\n\n* If you have images in your templates the pipes cause a new parameter\n* Namespaced links are not recognized\n* Templates in links are not recognized\n* Links contents are not htmldecoded\n* nowiki, pre and math blocks might cause problems\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n[tmplh]: http://en.wikipedia.org/wiki/Help:Template#Usage_syntax \"English Wikipedia Template help page, syntax section\"\n[mspec]: http://www.mediawiki.org/wiki/Markup_spec \"MediaWiki Markup spec\"\n[linkh]: http://en.wikipedia.org/wiki/Help:Link \"English Wikipedia Link help page\"\n[ptrkh]: http://en.wikipedia.org/wiki/Help:Pipe_trick \"English Wikipedia Pipe trick help page\"\n[lnbnf]: http://www.mediawiki.org/wiki/Markup_spec/BNF/Links \"MediaWiki Link BNF\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbxt%2Fwptemplates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbxt%2Fwptemplates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbxt%2Fwptemplates/lists"}