Module: HtmlToMarkdown::AnnotationKind
- Extended by:
- T::Helpers, T::Sig
- Included in:
- AnnotationKindBold, AnnotationKindCode, AnnotationKindHighlight, AnnotationKindItalic, AnnotationKindLink, AnnotationKindStrikethrough, AnnotationKindSubscript, AnnotationKindSuperscript, AnnotationKindUnderline
- Defined in:
- lib/html_to_markdown/native.rb
Overview
The type of an inline text annotation.
Uses internally tagged representation (‘“annotation_type”: “bold”`) for JSON serialization.
Class Method Summary collapse
Class Method Details
.from_hash(hash) ⇒ Object
635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 |
# File 'lib/html_to_markdown/native.rb', line 635 def self.from_hash(hash) discriminator = hash[:annotation_type] || hash["annotation_type"] case discriminator when "bold" then AnnotationKindBold.from_hash(hash) when "italic" then AnnotationKindItalic.from_hash(hash) when "underline" then AnnotationKindUnderline.from_hash(hash) when "strikethrough" then AnnotationKindStrikethrough.from_hash(hash) when "code" then AnnotationKindCode.from_hash(hash) when "subscript" then AnnotationKindSubscript.from_hash(hash) when "superscript" then AnnotationKindSuperscript.from_hash(hash) when "highlight" then AnnotationKindHighlight.from_hash(hash) when "link" then AnnotationKindLink.from_hash(hash) else raise "Unknown discriminator: #{discriminator}" end end |