{"id":19474583,"url":"https://github.com/tomasc/improve_typography","last_synced_at":"2025-04-25T12:31:51.348Z","repository":{"id":13843535,"uuid":"74394616","full_name":"tomasc/improve_typography","owner":"tomasc","description":"Improves typography (quotes, hyphens, etc.) of a given string. Works well with I18n.","archived":false,"fork":false,"pushed_at":"2022-05-30T12:16:38.000Z","size":80,"stargazers_count":5,"open_issues_count":6,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-13T00:47:11.350Z","etag":null,"topics":["ruby-gem","typography"],"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/tomasc.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}},"created_at":"2016-11-21T18:43:14.000Z","updated_at":"2022-05-30T10:54:59.000Z","dependencies_parsed_at":"2022-08-20T23:10:09.627Z","dependency_job_id":null,"html_url":"https://github.com/tomasc/improve_typography","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/tomasc%2Fimprove_typography","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasc%2Fimprove_typography/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasc%2Fimprove_typography/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasc%2Fimprove_typography/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomasc","download_url":"https://codeload.github.com/tomasc/improve_typography/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250817785,"owners_count":21492221,"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":["ruby-gem","typography"],"created_at":"2024-11-10T19:25:44.176Z","updated_at":"2025-04-25T12:31:49.756Z","avatar_url":"https://github.com/tomasc.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Improve Typography\n\n[![Build Status](https://travis-ci.org/tomasc/improve_typography.svg)](https://travis-ci.org/tomasc/improve_typography) [![Gem Version](https://badge.fury.io/rb/improve_typography.svg)](http://badge.fury.io/rb/improve_typography) [![Coverage Status](https://img.shields.io/coveralls/tomasc/improve_typography.svg)](https://coveralls.io/r/tomasc/improve_typography)\n\nImproves typography (quotes, hyphens, etc.) of a given string. Works well with I18n.\n\nEasy to extend by the way of locale files and processors. **Pull requests are welcome!**\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'improve_typography'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install improve_typography\n\n## Usage\n\n```ruby\nImproveTypography::Base.call(\"'so it isn't authorless'\") # =\u003e \"‘so it isn’t authorless’\"\n```\n\nOnly text inside XHTML tags is corrected (quotes around attributes etc. are preserved).\n\n### Locale\n\nThe replacements are locale-specific (corresponding to `I18n.locale`), with a fallback to default `:en`.\n\nLocale can be also provided locally as:\n\n```ruby\nImproveTypography::Base.call(\"'so it isn't authorless'\", locale: :cs)\n```\n\n### Extending locales\n\nThere are two options how to provide locale-specific replacements:\n\n#### Via locale files (preferred)\n\nCreate or override locale files in your application. See the locale files in the `locales` folder.\n\n#### Via custom class\n\nFor more complex replacements, where the above method is not sufficient, it is possible to create locale-specific classes and override default behavior. For example:\n\n```ruby\nmodule ImproveTypography\n  module Processors\n    module CS # locale name in upcase\n      class SingleQuotes \u003c Processor\n        def call\n          # custom behavior\n        end\n      end\n    end\n  end\nend\n```\n\n### Configuration\n\nYou can configure applied processors (and their order).\n\n#### Globally\n\n```ruby\nImproveTypography.configure do |config|\n  config.processors = [ImproveTypography::Processors::Ellipsis]\nend\n```\n\n#### Locally\n\n```ruby\nImproveTypography::Base.call(\"'so it isn't authorless'\", processors: [ImproveTypography::Processors::Ellipsis])\n```\n\n## Available processors\n\n* `Apostrophe`\n* `DoubleQuotes`\n* `Ellipsis`\n* `EmDash`\n* `EnDash`\n* `MultiplySign`\n* `Nbsp`\n* `Numbers`\n* `SingleQuotes`\n* `Units`\n* `WordLineSeparator`\n\n## Supported locales\n\n* `:en` (Int. English)\n* `:cs` (Czech)\n\n## Resources and inspiration\n\n* [SmartyPants](https://michelf.ca/projects/php-smartypants)\n* [Truty](https://github.com/mkj-is/Truty)\n* [Typogruby](https://avdgaag.github.io/typogruby)\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/tomasc/improve_typography.\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomasc%2Fimprove_typography","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomasc%2Fimprove_typography","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomasc%2Fimprove_typography/lists"}