Title: Ability to add your own cells value encoders (converters) · Issue #118 · pythonicrubyist/creek · GitHub
Open Graph Title: Ability to add your own cells value encoders (converters) · Issue #118 · pythonicrubyist/creek
X Title: Ability to add your own cells value encoders (converters) · Issue #118 · pythonicrubyist/creek
Description: I propose to make the converter this way: class Converter BUILD_IN_CONVERTERS = [ # build-in converters from this https://github.com/pythonicrubyist/creek/blob/master/lib/creek/styles/converter.rb#L41 ] def initialize(custom_converters: ...
Open Graph Description: I propose to make the converter this way: class Converter BUILD_IN_CONVERTERS = [ # build-in converters from this https://github.com/pythonicrubyist/creek/blob/master/lib/creek/styles/converter.rb#...
X Description: I propose to make the converter this way: class Converter BUILD_IN_CONVERTERS = [ # build-in converters from this https://github.com/pythonicrubyist/creek/blob/master/lib/creek/styles/converter.rb#...
Opengraph URL: https://github.com/pythonicrubyist/creek/issues/118
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Ability to add your own cells value encoders (converters)","articleBody":"I propose to make the converter this way:\r\n\r\n```Ruby\r\nclass Converter\r\n BUILD_IN_CONVERTERS = [\r\n # build-in converters from this https://github.com/pythonicrubyist/creek/blob/master/lib/creek/styles/converter.rb#L41\r\n ]\r\n\r\n def initialize(custom_converters: [])\r\n @_converters = custom_converters + BUILD_IN_CONVERTERS\r\n end\r\n\r\n def call(value, type, style, options = {})\r\n @_converters.each do |converter|\r\n if converter.is_support?(value, type, style, options)\r\n return converter.convert(value, type, style, options)\r\n end\r\n end\r\n\r\n raise StandardError, \"Not found converter for cell #{options[:cell_name].to_s} with type #{type.to_s} and style #{style.to_s}\"\r\n end\r\n end\r\n```\r\n\r\nBase value converter class\r\n```Ruby\r\n class Base\r\n\r\n def is_support?(value, type, style, options)\r\n false\r\n end\r\n\r\n def convert(value, type, style, options)\r\n raise NotImplementedError\r\n end\r\n\r\n end\r\n```\r\n\r\nand pass to options cell name, sheet name, and raw sharing strings (in my case need to convert them to HTML with styles)\r\n","author":{"url":"https://github.com/DmitriyFirsov","@type":"Person","name":"DmitriyFirsov"},"datePublished":"2023-07-03T06:52:19.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/118/creek/issues/118"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7f5051d3-b7ab-9b8d-9c4c-310ca467c12c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EA48:35E3DA:50889DA:6CB4123:696E1279 |
| html-safe-nonce | 1347b0a140f3bef8f15d366944981350ddd2e0868a0769d594d31568e119cd23 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTQ4OjM1RTNEQTo1MDg4OURBOjZDQjQxMjM6Njk2RTEyNzkiLCJ2aXNpdG9yX2lkIjoiMzkxNzMyNjgyMjE4NDcxODk2OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 894db21b705c1095cd4e7f4f8e4bcab0831109473495359e5ca3469e834e1923 |
| hovercard-subject-tag | issue:1785465681 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/pythonicrubyist/creek/118/issue_layout |
| twitter:image | https://opengraph.githubassets.com/798a9caff1317a8fea81a513f4104c0011619f9689afa1e31b5b2645841217c9/pythonicrubyist/creek/issues/118 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/798a9caff1317a8fea81a513f4104c0011619f9689afa1e31b5b2645841217c9/pythonicrubyist/creek/issues/118 |
| og:image:alt | I propose to make the converter this way: class Converter BUILD_IN_CONVERTERS = [ # build-in converters from this https://github.com/pythonicrubyist/creek/blob/master/lib/creek/styles/converter.rb#... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DmitriyFirsov |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1a7d6d739bf034e67486b9f97a31887ca30302b72a0acac49b6bcddff34356d7 |
| turbo-cache-control | no-preview |
| go-import | github.com/pythonicrubyist/creek git https://github.com/pythonicrubyist/creek.git |
| octolytics-dimension-user_id | 1863594 |
| octolytics-dimension-user_login | pythonicrubyist |
| octolytics-dimension-repository_id | 10825818 |
| octolytics-dimension-repository_nwo | pythonicrubyist/creek |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 10825818 |
| octolytics-dimension-repository_network_root_nwo | pythonicrubyist/creek |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 87d7872ec7094ed247923539669aabda9230966f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width