{"id":13508273,"url":"https://github.com/f34nk/modest_ex","last_synced_at":"2025-04-22T17:25:09.950Z","repository":{"id":62429956,"uuid":"123043163","full_name":"f34nk/modest_ex","owner":"f34nk","description":"Elixir library to do pipeable transformations on html strings (with CSS selectors)","archived":false,"fork":false,"pushed_at":"2022-01-18T09:15:21.000Z","size":594,"stargazers_count":31,"open_issues_count":4,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-22T17:25:06.115Z","etag":null,"topics":["css-selector","elixir","html-parser","html-renderer"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/f34nk.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}},"created_at":"2018-02-26T23:11:36.000Z","updated_at":"2024-08-31T13:54:27.000Z","dependencies_parsed_at":"2022-11-01T20:08:00.589Z","dependency_job_id":null,"html_url":"https://github.com/f34nk/modest_ex","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f34nk%2Fmodest_ex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f34nk%2Fmodest_ex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f34nk%2Fmodest_ex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f34nk%2Fmodest_ex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/f34nk","download_url":"https://codeload.github.com/f34nk/modest_ex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250286087,"owners_count":21405361,"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":["css-selector","elixir","html-parser","html-renderer"],"created_at":"2024-08-01T02:00:50.702Z","updated_at":"2025-04-22T17:25:09.913Z","avatar_url":"https://github.com/f34nk.png","language":"C","funding_links":[],"categories":["HTML"],"sub_categories":[],"readme":"# This project is not maintained anymore.\n\n\n[![Build status](https://travis-ci.org/f34nk/modest_ex.svg?branch=master)](https://travis-ci.org/f34nk/modest_ex)\n[![ModestEx version](https://img.shields.io/hexpm/v/modest_ex.svg)](https://hex.pm/packages/modest_ex)\n[![Hex.pm](https://img.shields.io/hexpm/dt/modest_ex.svg)](https://hex.pm/packages/modest_ex)\n\n![humble by Eliricon from the Noun Project](https://github.com/f34nk/modest_ex/blob/master/modest_ex_icon.png)\n\n# ModestEx\n\nA library to do pipeable transformations on html strings with CSS selectors, e.g. find(), prepend(), append(), replace() etc.\n\nElixir/Erlang bindings for lexborisov's **Modest**\n\n\u003eModest is a fast HTML renderer implemented as a pure C99 library with no outside dependencies.\n\n- [Modest](https://github.com/lexborisov/Modest)\n  - HTML5 parsing library in pure C99\n  - fully conformant with the HTML5 spec\n\nAll Modest-related features are implemented in `C` using my wrapper library [modest_html](https://github.com/f34nk/modest_html).\n\nThe binding is implemented as a **C-Node** following the excellent example in Overbryd's package **nodex**. If you want to learn how to set up bindings to C/C++, you should definitely check it out.\n\n- [nodex](https://github.com/Overbryd/nodex)\n  - distributed Elixir\n  - save binding with C-Nodes\n\n\u003eC-Nodes are external os-processes that communicate with the Erlang VM through erlang messaging. That way you can implement native code and call into it from Elixir in a safe predictable way. The Erlang VM stays unaffected by crashes of the external process.\n\nFor news and updates please check out the [forum discussion](https://elixirforum.com/t/modestex-pipeable-transformations-on-html-strings-with-css-selectors/12793).\n\n## Example\n\nTotal **16** features implemented. See [**complete feature list**](https://github.com/f34nk/modest_ex/blob/master/FEATURES.md).\n\nBuild transformation pipelines...\n\n```elixir\ntest \"build up a complete DOM\" do\n  result = \"\"\n  |\u003e ModestEx.serialize()\n  |\u003e ModestEx.append(\"body\", \"\u003cdiv\u003e\")\n  |\u003e ModestEx.set_attribute(\"div\", \"class\", \"col-md-12\")\n  |\u003e ModestEx.append(\"div\", \"\u003cdiv\u003e\")\n  |\u003e ModestEx.set_attribute(\"div.col-md-12 div\", \"class\", \"col-md-6\")\n  |\u003e ModestEx.append(\"div.col-md-12 div\", \"\u003ca\u003e\u003c/a\u003e\")\n  |\u003e ModestEx.set_text(\"a\", \"Hello\")\n\n  copy = ModestEx.find(result, \"div.col-md-12 div\")\n  |\u003e ModestEx.set_text(\"a\", \"World\")\n  \n  result = ModestEx.insert_after(result, \"div.col-md-12 div\", copy)\n  |\u003e ModestEx.set_attribute(\"div.col-md-6:first-of-type a\", \"href\", \"https://elixir-lang.org\")\n  |\u003e ModestEx.set_attribute(\"div.col-md-6:last-of-type a\", \"href\", \"https://google.de\")\n  \n  assert result == \"\u003cdiv class=\\\"col-md-12\\\"\u003e\u003cdiv class=\\\"col-md-6\\\"\u003e\u003ca href=\\\"https://elixir-lang.org\\\"\u003eHello\u003c/a\u003e\u003c/div\u003e\u003cdiv class=\\\"col-md-6\\\"\u003e\u003ca href=\\\"https://google.de\\\"\u003eWorld\u003c/a\u003e\u003c/div\u003e\u003c/div\u003e\"\nend\n```\n\n## Supported CSS Selectors\n\nAll common CSS Selectors are supported. Total **38** selector patterns implemented.\nSee [**complete list of supported CSS selectors**](https://github.com/f34nk/modest_ex/blob/master/SELECTORS.md).\n\n## Installation\n\nAvailable on [hex](https://hex.pm/packages/modest_ex).\n\n```elixir\ndef deps do\n  [\n    {:modest_ex, \"~\u003e 1.0.4\"}\n  ]\nend\n```\n\n## Target dependencies\n```\ncmake 3.x\nerlang-dev\nerlang-xmerl\nerlang-parsetools\n```\n## Compile and test\n```\nmix deps.get\nmix compile\nmix test\n```\n## Cloning\n```\ngit clone git@github.com:f34nk/modest_ex.git\ncd modest_ex\n```\nAll binding targets are added as submodules in the `target/` folder.\n```\ngit submodule update --init --recursive --remote\nmix deps.get\nmix compile\nmix test\nmix test.target\n```\nCleanup\n```\nmix clean\n```\n## Roadmap\n\nSee [CHANGELOG](https://github.com/f34nk/modest_ex/blob/master/CHANGELOG.md).\n\n- [ ] Bindings\n  - [x] Call as C-Node\n  - [ ] Call as dirty-nif\n- [ ] Tests\n  - [x] Call as C-Node\n  - [ ] Call as dirty-nif\n  - [x] Target tests\n  - [x] Feature tests\n  - [x] Package test\n- [ ] Features\n  - [x] Find nodes using a CSS selector\n  - [x] Serialize any string with valid or broken html\n  - [x] Get attribute with optional CSS selector\n  - [x] Set attribute with optional CSS selector\n  - [x] Get text with optional CSS selector\n  - [x] Set text with optional CSS selector\n  - [x] Remove a node from html\n  - [x] Append node to another node\n  - [x] Prepend node to another node\n  - [x] Insert node before another node\n  - [x] Insert node after another node\n  - [x] Replace node with another node\n  - [x] Slice html to a subset of nodes\n  - [x] Get position of node in relation to its parent\n  - [x] Wrap node with another node\n  - [x] Pretty print html\n  - [ ] Compare two html strings (see [here](https://github.com/f34nk/modest_html/blob/master/CHANGELOG.md#200))\n  - [ ] Transform html string by list of actions\n- [x] Custom CSS selector for pseudo class `:contains(text)` implemented in [Modest](https://github.com/lexborisov/Modest/pull/42)\n- [x] Scope flag to control serialization\n- [x] List of supported CSS Selectors\n- [x] Documentation\n- [x] Publish as hex package\n\n## License\n\nModestEx is under LGPL license. Check the [LICENSE](https://github.com/f34nk/modest_ex/blob/master/LICENSE) file for more details.\n\n\n## Icon Credit\n\nhumble by Eliricon from the Noun Project\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff34nk%2Fmodest_ex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ff34nk%2Fmodest_ex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff34nk%2Fmodest_ex/lists"}