lib/qipowl/bowlers/html.rb in qipowl-0.9.2 vs lib/qipowl/bowlers/html.rb in qipowl-0.9.3

- old
+ new

@@ -1,8 +1,9 @@ # encoding: utf-8 require 'net/http' +require 'typogrowth' require_relative '../core/bowler' module Qipowl module Mappers @@ -195,10 +196,17 @@ # Alias for {#▶}, according to YAML rules specifies additional # class for the data list `<dl>` tag behind (`dl-horizontal`.) alias_method :▷, :▶ protected + # @see {Qipowl::Bowlers::Bowler#defreeze} + # + # @param [String] str to be defreezed + def defreeze str + (super str) + end + # Computes the level of the `:linewide` element by counting # preceeding non-breakable spaces. For instance, nested lists # are produced by appending `"\u{00A0}"` to the line item # DSL tag: # @@ -214,10 +222,18 @@ def canonize callee callee.to_s.gsub(/^#{String::NBSP}*/, '').to_sym if callee end + # Produces html paragraph tag (`<p>`) with no class. + # @see Qipowl::Bowler#orphan + # @param str the words, to be put in paragraph tag. + # @return [String] tagged words. + def orphan str + "#{tagify(:p, {}, str.to_s.strip)}" + end + # @see Qipowl::Bowler#harvest # # Additionally it checks if there was a `:linewide` item, requiring # surrounding html element (like `<ul>` aroung several `<li>`s.) # @@ -257,17 +273,10 @@ self.class.class_eval "alias_method :#{method}, :#{canonize(method)}" send method, args, block end - # Produces html paragraph tag (`<p>`) with class `owl`. - # @see Qipowl::Bowler#orphan - # @param str the words, to be put in paragraph tag. - # @return [String] tagged words. - def orphan str - "#{tagify(:p, {}, str.to_s.strip)}" - end # Constructs opening html tag for the input given. # # To construct `abbr` tag with `title` _Title_ and class _default_: # # opening :abbr, { :title=>'Title', :class=>'default' } @@ -363,26 +372,9 @@ end alias_method :⊂, :∈ - # @see {Qipowl::Bowler#defreeze} - # - # Additionally it checks if tag is a `:block` tag and - # substitutes all the carriage returns (`$/`) with special symbol - # {String::CARRIAGE_RETURN} to prevent format damage. - # - # @param [String] str to be defreezed - def defreeze str - str = super str - @mapping[:block].each { |tag, htmltag| - str.gsub!(/(#{tag})(.*?)$(.*?)(#{tag}|\Z)/m) { |m| - "#{$1}('#{$2}', '#{$3}')\n\n" - } - } - str - end - # @see {Qipowl::Bowler#serveup} # # Additionally it beatifies the output HTML # # @param [String] str to be roasted \ No newline at end of file