{"id":13877995,"url":"https://github.com/postmodern/nokogiri-diff","last_synced_at":"2025-04-04T08:07:44.053Z","repository":{"id":1181389,"uuid":"1080973","full_name":"postmodern/nokogiri-diff","owner":"postmodern","description":"Calculate the differences between two XML/HTML documents.","archived":false,"fork":false,"pushed_at":"2024-01-25T07:01:24.000Z","size":54,"stargazers_count":131,"open_issues_count":2,"forks_count":12,"subscribers_count":8,"default_branch":"main","last_synced_at":"2024-10-12T19:45:17.812Z","etag":null,"topics":["html","html-diff","ruby","xml","xml-diff"],"latest_commit_sha":null,"homepage":"","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/postmodern.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2010-11-15T04:41:29.000Z","updated_at":"2024-06-07T12:12:08.000Z","dependencies_parsed_at":"2024-01-18T04:54:28.248Z","dependency_job_id":"d1133717-91de-4f14-a099-0fe3dc4c9be2","html_url":"https://github.com/postmodern/nokogiri-diff","commit_stats":{"total_commits":75,"total_committers":3,"mean_commits":25.0,"dds":"0.040000000000000036","last_synced_commit":"7e6bc945b91d738077fc1367247ee610bb97ff31"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postmodern%2Fnokogiri-diff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postmodern%2Fnokogiri-diff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postmodern%2Fnokogiri-diff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postmodern%2Fnokogiri-diff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/postmodern","download_url":"https://codeload.github.com/postmodern/nokogiri-diff/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247142052,"owners_count":20890652,"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":["html","html-diff","ruby","xml","xml-diff"],"created_at":"2024-08-06T08:01:37.017Z","updated_at":"2025-04-04T08:07:44.028Z","avatar_url":"https://github.com/postmodern.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# nokogiri-diff\n\n[![CI](https://github.com/postmodern/nokogiri-diff/actions/workflows/ruby.yml/badge.svg)](https://github.com/postmodern/nokogiri-diff/actions/workflows/ruby.yml)\n\n* [Source](https://github.com/postmodern/nokogiri-diff)\n* [Issues](https://github.com/postmodern/nokogiri-diff/issues)\n* [Documentation](http://rubydoc.info/gems/nokogiri-diff/frames)\n\n## Description\n\nnokogiri-diff adds the ability to calculate the differences (added or\nremoved nodes) between two XML/HTML documents.\n\n## Features\n\n* Performs a breadth-first comparison between children nodes.\n* Compares XML/HTML Elements, Attributes, Text nodes and DTD nodes.\n* Allows calculating differences between documents, or just enumerating the\n  added or removed nodes.\n\n## Examples\n\nEnumerate over the differences between two HTML documents:\n\n```ruby\nrequire 'nokogiri/diff'\n\ndoc1 = Nokogiri::HTML('\u003cdiv\u003e\u003cp\u003eone\u003c/p\u003e two \u003c/div\u003e')\ndoc2 = Nokogiri::HTML('\u003cdiv\u003e\u003cp id=\"1\"\u003eone\u003c/p\u003e \u003cp\u003ethree\u003c/p\u003e\u003c/div\u003e')\n\ndoc1.diff(doc2) do |change,node|\n  puts \"#{change} #{node.to_html}\".ljust(30) + node.parent.path\nend\n\n#   \u003cdiv\u003e\n# \u003cp\u003eone\u003c/p\u003e two \u003c/div\u003e /\n#   \u003cp\u003eone\u003c/p\u003e                  /div\n# -  two                        /div\n# +                             /div\n# + \u003cp\u003ethree\u003c/p\u003e                /div\n# +  id=\"1\"                     /div/p[1]\n#   one                         /div/p\n```\n\nOnly find the added nodes:\n\n```ruby\ndoc1.diff(doc2, :added =\u003e true) do |change,node|\n  puts node.to_html.ljust(30) + node.parent.path\nend\n\n#                               /div\n# \u003cp\u003ethree\u003c/p\u003e                  /div\n#  id=\"1\"                       /div/p[1]\n```\n\nOnly find the removed nodes:\n\n```ruby\ndoc1.diff(doc2, :removed =\u003e true) do |change,node|\n  puts node.to_html.ljust(30) + node.parent.path\nend\n\n#  two                          /div\n```\n\n## Requirements\n\n* [ruby](http://www.ruby-lang.org/) \u003e= 2.0.0\n* [tdiff](http://github.com/postmodern/tdiff) ~\u003e 0.4\n* [nokogiri](http://nokogiri.rubyforge.org/) ~\u003e 1.5\n\n## Install\n\n```shell\n$ gem install nokogiri-diff\n```\n\n## License\n\nSee {file:LICENSE.txt} for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostmodern%2Fnokogiri-diff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpostmodern%2Fnokogiri-diff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostmodern%2Fnokogiri-diff/lists"}