lib/kramdown/document.rb in kramdown-0.13.2 vs lib/kramdown/document.rb in kramdown-0.13.3

- old
+ new

@@ -72,14 +72,14 @@ # Create a new Kramdown document from the string +source+ and use the provided +options+. The # options that can be used are defined in the Options module. # - # The special options key <tt>:input</tt> can be used to select the parser that should parse the + # The special options key :input can be used to select the parser that should parse the # +source+. It has to be the name of a class in the Kramdown::Parser module. For example, to - # select the kramdown parser, one would set the <tt>:input</tt> key to +Kramdown+. If this key - # is not set, it defaults to +Kramdown+. + # select the kramdown parser, one would set the :input key to +Kramdown+. If this key is not + # set, it defaults to +Kramdown+. # # The +source+ is immediately parsed by the selected parser so that the root element is # immediately available and the output can be generated. def initialize(source, options = {}) @options = Options.merge(options).freeze @@ -130,15 +130,15 @@ # # Represents the root of a kramdown document. # # The root element contains the following option keys: # - # <tt>:encoding</tt>:: When running on Ruby 1.9 this key has to be set to the encoding used for - # the text parts of the kramdown document. + # :encoding:: When running on Ruby 1.9 this key has to be set to the encoding used for the text + # parts of the kramdown document. # - # <tt>:abbrev_defs</tt>:: This key may be used to store the mapping of abbreviation to - # abbreviation definition. + # :abbrev_defs:: This key may be used to store the mapping of abbreviation to abbreviation + # definition. # # # === :blank # # [Category] Block-level element @@ -157,24 +157,24 @@ # [Usage context] Where block-level elements are expected # [Content model] Span-level elements # # Represents a paragraph. # - # If the option <tt>:transparent</tt> is +true+, this element just represents a block of text. - # I.e. this element just functions as a container for span-level elements. + # If the option :transparent is +true+, this element just represents a block of text. I.e. this + # element just functions as a container for span-level elements. # # # === :header # # [Category] Block-level element # [Usage context] Where block-level elements are expected # [Content model] Span-level elements # # Represents a header. # - # The option <tt>:level</tt> specifies the header level and has to contain a number between 1 and - # \6. The option <tt>:raw_text</tt> has to contain the raw header text. + # The option :level specifies the header level and has to contain a number between 1 and \6. The + # option :raw_text has to contain the raw header text. # # # === :blockquote # # [Category] Block-level element @@ -267,13 +267,12 @@ # elements # # Represents a table. Each table row (i.e. :tr element) of the table has to contain the same # number of :td elements. # - # The option <tt>:alignment</tt> has to be an array containing the alignment values, exactly one - # for each column of the table. The possible alignment values are <tt>:left</tt>, - # <tt>:center</tt>, <tt>:right</tt> and <tt>:default</tt>. + # The option :alignment has to be an array containing the alignment values, exactly one for each + # column of the table. The possible alignment values are :left, :center, :right and :default. # # # === :thead # # [Category] None @@ -328,12 +327,12 @@ # # Represents mathematical text that is written in LaTeX. # # The +value+ field has to contain the actual mathematical text. # - # The option <tt>:category</tt> has to be set to either <tt>:span</tt> or <tt>:block</tt> - # depending on the context where the element is used. + # The option :category has to be set to either :span or :block depending on the context where the + # element is used. # # # == Text Markup Elements # # === :text @@ -398,13 +397,13 @@ # [Content model] None # # Represents a footnote marker. # # The +value+ field has to contain an element whose children are the content of the footnote. The - # option <tt>:name</tt> has to contain a valid and unique footnote name. A valid footnote name - # consists of a word character or a digit and then optionally followed by other word characters, - # digits or dashes. + # option :name has to contain a valid and unique footnote name. A valid footnote name consists of + # a word character or a digit and then optionally followed by other word characters, digits or + # dashes. # # # === :em # # [Category] Span-level element @@ -430,11 +429,11 @@ # [Content model] None # # Represents an HTML entity. # # The +value+ field has to contain an instance of Kramdown::Utils::Entities::Entity. The option - # <tt>:original</tt> can be used to store the original representation of the entity. + # :original can be used to store the original representation of the entity. # # # === :typographic_sym # # [Category] Span-level element @@ -444,17 +443,17 @@ # Represents a typographic symbol. # # The +value+ field needs to contain a Symbol representing the specific typographic symbol from # the following list: # - # <tt>:mdash</tt>:: An mdash character (---) - # <tt>:ndash</tt>:: An ndash character (--) - # <tt>:hellip</tt>:: An ellipsis (...) - # <tt>:laquo</tt>:: A left guillemet (<<) - # <tt>:raquo</tt>:: A right guillemet (>>) - # <tt>:laquo_space</tt>:: A left guillemet with a space (<< ) - # <tt>:raquo_space</tt>:: A right guillemet with a space ( >>) + # :mdash:: An mdash character (---) + # :ndash:: An ndash character (--) + # :hellip:: An ellipsis (...) + # :laquo:: A left guillemet (<<) + # :raquo:: A right guillemet (>>) + # :laquo_space:: A left guillemet with a space (<< ) + # :raquo_space:: A right guillemet with a space ( >>) # # # === :smart_quote # # [Category] Span-level element @@ -463,14 +462,14 @@ # # Represents a quotation character. # # The +value+ field needs to contain a Symbol representing the specific quotation character: # - # <tt>:lsquo</tt>:: Left single quote - # <tt>:rsquo</tt>:: Right single quote - # <tt>:ldquo</tt>:: Left double quote - # <tt>:rdquo</tt>:: Right double quote + # :lsquo:: Left single quote + # :rsquo:: Right single quote + # :ldquo:: Left double quote + # :rdquo:: Right double quote # # # === :abbreviation # # [Category] Span-level element @@ -478,11 +477,11 @@ # [Content model] None # # Represents a text part that is an abbreviation. # # The +value+ field has to contain the text part that is the abbreviation. The definition of the - # abbreviation is stored in the <tt>:root</tt> element of the document. + # abbreviation is stored in the :root element of the document. # # # == Other Elements # # === :html_element @@ -493,15 +492,14 @@ # # Represents an HTML element. # # The +value+ field has to contain the name of the HTML element the element is representing. # - # The option <tt>:category</tt> has to be set to either <tt>:span</tt> or <tt>:block</tt> - # depending on the whether the element is a block-level or a span-level element. The option - # <tt>:content_model</tt> has to be set to the content model for the element (either - # <tt>:block</tt> if it contains block-level elements, <tt>:span</tt> if it contains span-level - # elements or <tt>:raw</tt> if it contains raw content). + # The option :category has to be set to either :span or :block depending on the whether the + # element is a block-level or a span-level element. The option :content_model has to be set to the + # content model for the element (either :block if it contains block-level elements, :span if it + # contains span-level elements or :raw if it contains raw content). # # # === :xml_comment # # [Category] Block/span-level element @@ -510,12 +508,12 @@ # # Represents an XML/HTML comment. # # The +value+ field has to contain the whole XML/HTML comment including the delimiters. # - # The option <tt>:category</tt> has to be set to either <tt>:span</tt> or <tt>:block</tt> - # depending on the context where the element is used. + # The option :category has to be set to either :span or :block depending on the context where the + # element is used. # # # === :xml_pi # # [Category] Block/span-level element @@ -525,12 +523,12 @@ # Represents an XML/HTML processing instruction. # # The +value+ field has to contain the whole XML/HTML processing instruction including the # delimiters. # - # The option <tt>:category</tt> has to be set to either <tt>:span</tt> or <tt>:block</tt> - # depending on the context where the element is used. + # The option :category has to be set to either :span or :block depending on the context where the + # element is used. # # # === :comment # # [Category] Block/span-level element @@ -539,12 +537,12 @@ # # Represents a comment. # # The +value+ field has to contain the comment. # - # The option <tt>:category</tt> has to be set to either <tt>:span</tt> or <tt>:block</tt> - # depending on the context where the element is used. + # The option :category has to be set to either :span or :block depending on the context where the + # element is used. # # # === :raw # # [Category] Block/span-level element @@ -554,16 +552,16 @@ # Represents a raw string that should not be modified. For example, the element could contain some # HTML code that should be output as-is without modification and escaping. # # The +value+ field has to contain the actual raw text. # - # The option <tt>:category</tt> has to be set to either <tt>:span</tt> or <tt>:block</tt> - # depending on the context where the element is used. The option <tt>:type</tt> can be set to an - # array of strings to define for which converters the raw string is valid. + # The option :category has to be set to either :span or :block depending on the context where the + # element is used. The option :type can be set to an array of strings to define for which + # converters the raw string is valid. class Element - # A symbol representing the element type. For example, <tt>:p</tt> or <tt>:blockquote</tt>. + # A symbol representing the element type. For example, :p or :blockquote. attr_accessor :type # The value of the element. The interpretation of this field depends on the type of the element. # Many elements don't use this field. attr_accessor :value @@ -596,14 +594,13 @@ CATEGORY = {} # :nodoc: [:blank, :p, :header, :blockquote, :codeblock, :ul, :ol, :dl, :table, :hr].each {|b| CATEGORY[b] = :block} [:text, :a, :br, :img, :codespan, :footnote, :em, :strong, :entity, :typographic_sym, :smart_quote, :abbreviation].each {|b| CATEGORY[b] = :span} - # Return the category of +el+ which can be <tt>:block</tt>, <tt>:span</tt> or +nil+. + # Return the category of +el+ which can be :block, :span or +nil+. # # Most elements have a fixed category, however, some elements can either appear in a block-level - # or a span-level context. These elements need to have the option <tt>:category</tt> correctly - # set. + # or a span-level context. These elements need to have the option :category correctly set. def self.category(el) CATEGORY[el.type] || el.options[:category] end end