👮 leading space in comments
This commit is contained in:
@@ -23,10 +23,10 @@ module Squib
|
||||
cell.strip! if cell.respond_to?(:strip) && import.strip?
|
||||
cell = yield(header, cell) if block_given?
|
||||
data[header] << cell
|
||||
end#row
|
||||
end#col
|
||||
end# row
|
||||
end# col
|
||||
explode_quantities(data, import.explode)
|
||||
end#xlsx
|
||||
end# xlsx
|
||||
module_function :xlsx
|
||||
|
||||
# DSL method. See http://squib.readthedocs.org
|
||||
|
||||
@@ -15,7 +15,7 @@ module Squib
|
||||
trans = Args::Transform.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
||||
draw = Args::Draw.new(custom_colors, { stroke_width: 0.0 }).load!(opts, expand_by: size, layout: layout, dpi: dpi)
|
||||
embed = TextEmbed.new(size, custom_colors, layout, dpi, img_dir)
|
||||
yield(embed) if block_given? #store the opts for later use
|
||||
yield(embed) if block_given? # store the opts for later use
|
||||
extents = Array.new(@cards.size)
|
||||
range.each { |i| extents[i] = @cards[i].text(embed, para[i], box[i], trans[i], draw[i]) }
|
||||
return extents
|
||||
|
||||
@@ -122,9 +122,9 @@ module Squib
|
||||
|
||||
def convert_unit(arg, dpi)
|
||||
case arg.to_s.rstrip
|
||||
when /in$/ #ends with "in"
|
||||
when /in$/ # ends with "in"
|
||||
arg.rstrip[0..-2].to_f * dpi
|
||||
when /cm$/ #ends with "cm"
|
||||
when /cm$/ # ends with "cm"
|
||||
arg.rstrip[0..-2].to_f * dpi * INCHES_IN_CM
|
||||
else
|
||||
arg
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module Squib
|
||||
#@api private
|
||||
# @api private
|
||||
module Args
|
||||
module ColorValidator
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module Squib
|
||||
#@api private
|
||||
# @api private
|
||||
module Args
|
||||
module DirValidator
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
require_relative '../constants'
|
||||
|
||||
module Squib
|
||||
#@api private
|
||||
# @api private
|
||||
module Args
|
||||
# Internal class for handling arguments
|
||||
#@api private
|
||||
# @api private
|
||||
class Typographer
|
||||
|
||||
def initialize(config = Conf::DEFAULTS)
|
||||
|
||||
@@ -11,9 +11,9 @@ module Squib
|
||||
module_function
|
||||
def parse(arg, dpi=300)
|
||||
case arg.to_s.rstrip
|
||||
when /in$/ #ends with "in"
|
||||
when /in$/ # ends with "in"
|
||||
arg.rstrip[0..-2].to_f * dpi
|
||||
when /cm$/ #ends with "cm"
|
||||
when /cm$/ # ends with "cm"
|
||||
arg.rstrip[0..-2].to_f * dpi * INCHES_IN_CM
|
||||
else
|
||||
arg
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ module Squib
|
||||
'warn_png_scale' => true,
|
||||
}
|
||||
|
||||
#Translate the hints to the methods.
|
||||
# Translate the hints to the methods.
|
||||
ANTIALIAS_OPTS = {
|
||||
nil => 'subpixel',
|
||||
'best' => 'subpixel',
|
||||
|
||||
@@ -101,7 +101,7 @@ module Squib
|
||||
inner_radius, outer_radius = poly.inner_radius, poly.outer_radius
|
||||
use_cairo do |cc|
|
||||
cc.rotate_about(x, y, trans.angle)
|
||||
cc.move_to(x + outer_radius, y) #i = 0, so cos(0)=1 and sin(0)=0
|
||||
cc.move_to(x + outer_radius, y) # i = 0, so cos(0)=1 and sin(0)=0
|
||||
theta = Math::PI / n.to_f # i.e. (2*pi) / (2*n)
|
||||
0.upto(2 * n) do |i|
|
||||
radius = i.even? ? outer_radius : inner_radius
|
||||
|
||||
@@ -69,7 +69,7 @@ module Squib
|
||||
(0..src.width).step(in_thickness) do |i|
|
||||
percentage = i / src.width.to_f
|
||||
i = src.width - i if face_right
|
||||
factor = scale + (percentage * (1.0 - scale)) #linear interpolation
|
||||
factor = scale + (percentage * (1.0 - scale)) # linear interpolation
|
||||
dest_cxt.save
|
||||
dest_cxt.translate 0, src.height / 2.0 * (1.0 - factor)
|
||||
dest_cxt.scale factor * scale, factor
|
||||
|
||||
@@ -25,7 +25,7 @@ module Squib
|
||||
def compute_valign(layout, valign, embed_h)
|
||||
return 0 unless layout.height > 0
|
||||
ink_extents = layout.extents[1]
|
||||
ink_extents.height = embed_h * Pango::SCALE if ink_extents.height == 0 #JUST embed, bug #134
|
||||
ink_extents.height = embed_h * Pango::SCALE if ink_extents.height == 0 # JUST embed, bug #134
|
||||
case valign.to_s.downcase
|
||||
when 'middle'
|
||||
Pango.pixels((layout.height - ink_extents.height) / 2)
|
||||
@@ -94,7 +94,7 @@ module Squib
|
||||
rule = embed.rules[key]
|
||||
spacing = rule[:box].width[@index] * Pango::SCALE
|
||||
kindex = clean_str.index(key)
|
||||
kindex = clean_str[0..kindex].bytesize #convert to byte index (bug #57)
|
||||
kindex = clean_str[0..kindex].bytesize # convert to byte index (bug #57)
|
||||
str = str.sub(key, "<span size=\"#{ZERO_WIDTH_CHAR_SIZE}\">a<span letter_spacing=\"#{spacing.to_i}\">a</span>a</span>")
|
||||
layout.markup = str
|
||||
clean_str = layout.text
|
||||
@@ -158,7 +158,7 @@ module Squib
|
||||
embed_draws = process_embeds(embed, para.str, layout)
|
||||
|
||||
vertical_start = compute_valign(layout, para.valign, max_embed_height(embed_draws))
|
||||
cc.move_to(0, vertical_start) #TODO clean this up a bit
|
||||
cc.move_to(0, vertical_start) # TODO clean this up a bit
|
||||
|
||||
stroke_outline!(cc, layout, draw) if draw.stroke_strategy == :stroke_first
|
||||
cc.move_to(0, vertical_start)
|
||||
|
||||
@@ -2,7 +2,7 @@ require 'yaml'
|
||||
|
||||
module Squib
|
||||
# Internal class for handling layouts
|
||||
#@api private
|
||||
# @api private
|
||||
class LayoutParser
|
||||
|
||||
# Load the layout file(s), if exists
|
||||
@@ -14,7 +14,7 @@ module Squib
|
||||
thefile = file
|
||||
thefile = builtin(file) unless File.exists?(file)
|
||||
if File.exists? thefile
|
||||
yml = layout.merge(YAML.load_file(thefile) || {}) #load_file returns false on empty file
|
||||
yml = layout.merge(YAML.load_file(thefile) || {}) # load_file returns false on empty file
|
||||
yml.each do |key, value|
|
||||
layout[key] = recurse_extends(yml, key, {})
|
||||
end
|
||||
@@ -47,11 +47,11 @@ module Squib
|
||||
elsif child_val.to_s.strip.start_with?('-=')
|
||||
parent_val - child_val.sub('-=', '').strip.to_f
|
||||
else
|
||||
child_val #child overrides parent when merging, no +=
|
||||
child_val # child overrides parent when merging, no +=
|
||||
end
|
||||
end
|
||||
h = h.merge(from_extends) do |key, older_sibling, younger_sibling|
|
||||
younger_sibling #when two siblings have the same entry, the "younger" (lower one) overrides
|
||||
younger_sibling # when two siblings have the same entry, the "younger" (lower one) overrides
|
||||
end
|
||||
end
|
||||
return h
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module Squib
|
||||
|
||||
# Some helper methods specifically for samples
|
||||
#@api private
|
||||
# @api private
|
||||
#:nodoc:
|
||||
class Deck
|
||||
|
||||
|
||||
Reference in New Issue
Block a user