From fa10c82ee849c8ea1839ace8d1a6585d0b760059 Mon Sep 17 00:00:00 2001 From: Andy Meneely Date: Sun, 24 Jan 2016 00:55:23 -0500 Subject: [PATCH] Creating new files for readthedocs port --- docs/colors.rst | 28 ++++++++++++++++++++++++++++ docs/dsl/circle.rst | 2 ++ docs/dsl/cm.rst | 2 ++ docs/dsl/csv.rst | 2 ++ docs/dsl/curve.rst | 2 ++ docs/dsl/ellipse.rst | 2 ++ docs/dsl/grid.rst | 2 ++ docs/dsl/hand.rst | 2 ++ docs/dsl/hint.rst | 2 ++ docs/dsl/inches.rst | 2 ++ docs/dsl/index.rst | 31 +------------------------------ docs/dsl/line.rst | 2 ++ docs/dsl/png.rst | 2 ++ docs/dsl/polygon.rst | 2 ++ docs/dsl/rect.rst | 2 ++ docs/dsl/save.rst | 2 ++ docs/dsl/save_pdf.rst | 2 ++ docs/dsl/save_png.rst | 2 ++ docs/dsl/save_sheet.rst | 2 ++ docs/dsl/set.rst | 2 ++ docs/dsl/showcase.rst | 2 ++ docs/dsl/star.rst | 2 ++ docs/dsl/svg.rst | 2 ++ docs/dsl/triangle.rst | 2 ++ docs/dsl/xlsx.rst | 2 ++ docs/index.rst | 7 +++++-- docs/learning.rst | 2 ++ docs/parameters.rst | 17 +++++++++++++++++ 28 files changed, 99 insertions(+), 32 deletions(-) create mode 100644 docs/colors.rst create mode 100644 docs/dsl/circle.rst create mode 100644 docs/dsl/cm.rst create mode 100644 docs/dsl/csv.rst create mode 100644 docs/dsl/curve.rst create mode 100644 docs/dsl/ellipse.rst create mode 100644 docs/dsl/grid.rst create mode 100644 docs/dsl/hand.rst create mode 100644 docs/dsl/hint.rst create mode 100644 docs/dsl/inches.rst create mode 100644 docs/dsl/line.rst create mode 100644 docs/dsl/png.rst create mode 100644 docs/dsl/polygon.rst create mode 100644 docs/dsl/rect.rst create mode 100644 docs/dsl/save.rst create mode 100644 docs/dsl/save_pdf.rst create mode 100644 docs/dsl/save_png.rst create mode 100644 docs/dsl/save_sheet.rst create mode 100644 docs/dsl/set.rst create mode 100644 docs/dsl/showcase.rst create mode 100644 docs/dsl/star.rst create mode 100644 docs/dsl/svg.rst create mode 100644 docs/dsl/triangle.rst create mode 100644 docs/dsl/xlsx.rst create mode 100644 docs/learning.rst create mode 100644 docs/parameters.rst diff --git a/docs/colors.rst b/docs/colors.rst new file mode 100644 index 0000000..93900a8 --- /dev/null +++ b/docs/colors.rst @@ -0,0 +1,28 @@ +Specifying Colors & Gradients +============================= + +Colors can be specified in a wide variety of ways, mostly in a hex-string. Take a look at the examples from `samples/colors.rb`, found [here](https://github.com/andymeneely/squib/tree/master/samples/colors.rb) + +{include:file:samples/colors.rb} + +Under the hood, Squib uses the `rcairo` [color parser](https://github.com/rcairo/rcairo/blob/master/lib/cairo/color.rb) to accept a variety of color specifications, along with over [300 pre-defined constants](https://github.com/rcairo/rcairo/blob/master/lib/cairo/colors.rb). The above sample will generate a table of such constants. + +Additionally, in most places where colors are allowed, you may also supply a string that defines a gradient. Squib supports two flavors of gradients: linear and radial. Gradients are specified by supplying some xy coordinates, which are relative to the card (not the command). Each stop must be between 0.0 and 1.0, and you can supply as many as you like. Colors can be specified as above (in any of the hex notations or built-in constant). If you add two (or more) colors at the same stop, then the gradient keeps the colors in the in order specified and treats it like sharp transition. + +The format for gradient strings look like this: + +Linear: +``` +(x1,y1)(x2,y2) color1@stop1 color2@stop2 +``` +The xy coordinates define the angle of the gradient. + +Radial: +``` +(x1,y1,radius1)(x2,y2,radius2) color1@stop1 color2@stop2 +``` +The coordinates specify an inner circle first, then an outer circle. + +Check out the following sample from `samples/gradients.rb`, found [here](https://github.com/andymeneely/squib/tree/master/samples/colors.rb) + +{include:file:samples/gradients.rb} diff --git a/docs/dsl/circle.rst b/docs/dsl/circle.rst new file mode 100644 index 0000000..21a76f3 --- /dev/null +++ b/docs/dsl/circle.rst @@ -0,0 +1,2 @@ +circle +------ diff --git a/docs/dsl/cm.rst b/docs/dsl/cm.rst new file mode 100644 index 0000000..68e4fa9 --- /dev/null +++ b/docs/dsl/cm.rst @@ -0,0 +1,2 @@ +cm +-- diff --git a/docs/dsl/csv.rst b/docs/dsl/csv.rst new file mode 100644 index 0000000..5946028 --- /dev/null +++ b/docs/dsl/csv.rst @@ -0,0 +1,2 @@ +csv +--- diff --git a/docs/dsl/curve.rst b/docs/dsl/curve.rst new file mode 100644 index 0000000..2ebfd4c --- /dev/null +++ b/docs/dsl/curve.rst @@ -0,0 +1,2 @@ +curve +----- diff --git a/docs/dsl/ellipse.rst b/docs/dsl/ellipse.rst new file mode 100644 index 0000000..85e5611 --- /dev/null +++ b/docs/dsl/ellipse.rst @@ -0,0 +1,2 @@ +ellipse +------- diff --git a/docs/dsl/grid.rst b/docs/dsl/grid.rst new file mode 100644 index 0000000..5bc23ef --- /dev/null +++ b/docs/dsl/grid.rst @@ -0,0 +1,2 @@ +grid +---- diff --git a/docs/dsl/hand.rst b/docs/dsl/hand.rst new file mode 100644 index 0000000..d0e551b --- /dev/null +++ b/docs/dsl/hand.rst @@ -0,0 +1,2 @@ +hand +---- diff --git a/docs/dsl/hint.rst b/docs/dsl/hint.rst new file mode 100644 index 0000000..af9e385 --- /dev/null +++ b/docs/dsl/hint.rst @@ -0,0 +1,2 @@ +hint +---- diff --git a/docs/dsl/inches.rst b/docs/dsl/inches.rst new file mode 100644 index 0000000..7c9a7ca --- /dev/null +++ b/docs/dsl/inches.rst @@ -0,0 +1,2 @@ +inches +------ diff --git a/docs/dsl/index.rst b/docs/dsl/index.rst index 16e81b5..b25d453 100644 --- a/docs/dsl/index.rst +++ b/docs/dsl/index.rst @@ -5,33 +5,4 @@ DSL Reference :maxdepth: 1 :glob: - * - -background -circle -cm -csv -curve -ellipse -grid -hand -hint -inches -initialize -line -png -png -polygon -rect -save -save_pdf -save_png -save_sheet -set -showcase -star -stroke_outline -svg -text -triangle -xlsx + /dsl/* diff --git a/docs/dsl/line.rst b/docs/dsl/line.rst new file mode 100644 index 0000000..e0389ad --- /dev/null +++ b/docs/dsl/line.rst @@ -0,0 +1,2 @@ +line +---- diff --git a/docs/dsl/png.rst b/docs/dsl/png.rst new file mode 100644 index 0000000..6c5710e --- /dev/null +++ b/docs/dsl/png.rst @@ -0,0 +1,2 @@ +png +--- diff --git a/docs/dsl/polygon.rst b/docs/dsl/polygon.rst new file mode 100644 index 0000000..f8e7bf0 --- /dev/null +++ b/docs/dsl/polygon.rst @@ -0,0 +1,2 @@ +polygon +------- diff --git a/docs/dsl/rect.rst b/docs/dsl/rect.rst new file mode 100644 index 0000000..9be8ad9 --- /dev/null +++ b/docs/dsl/rect.rst @@ -0,0 +1,2 @@ +rect +---- diff --git a/docs/dsl/save.rst b/docs/dsl/save.rst new file mode 100644 index 0000000..4e3ad5a --- /dev/null +++ b/docs/dsl/save.rst @@ -0,0 +1,2 @@ +save +---- diff --git a/docs/dsl/save_pdf.rst b/docs/dsl/save_pdf.rst new file mode 100644 index 0000000..fc338f2 --- /dev/null +++ b/docs/dsl/save_pdf.rst @@ -0,0 +1,2 @@ +save_pdf +-------- diff --git a/docs/dsl/save_png.rst b/docs/dsl/save_png.rst new file mode 100644 index 0000000..286015e --- /dev/null +++ b/docs/dsl/save_png.rst @@ -0,0 +1,2 @@ +save_png +-------- diff --git a/docs/dsl/save_sheet.rst b/docs/dsl/save_sheet.rst new file mode 100644 index 0000000..1ad1c9a --- /dev/null +++ b/docs/dsl/save_sheet.rst @@ -0,0 +1,2 @@ +save_sheet +---------- diff --git a/docs/dsl/set.rst b/docs/dsl/set.rst new file mode 100644 index 0000000..d0495b2 --- /dev/null +++ b/docs/dsl/set.rst @@ -0,0 +1,2 @@ +set +--- diff --git a/docs/dsl/showcase.rst b/docs/dsl/showcase.rst new file mode 100644 index 0000000..2e2c19e --- /dev/null +++ b/docs/dsl/showcase.rst @@ -0,0 +1,2 @@ +showcase +-------- diff --git a/docs/dsl/star.rst b/docs/dsl/star.rst new file mode 100644 index 0000000..a97b04f --- /dev/null +++ b/docs/dsl/star.rst @@ -0,0 +1,2 @@ +star +---- diff --git a/docs/dsl/svg.rst b/docs/dsl/svg.rst new file mode 100644 index 0000000..2908e22 --- /dev/null +++ b/docs/dsl/svg.rst @@ -0,0 +1,2 @@ +svg +--- diff --git a/docs/dsl/triangle.rst b/docs/dsl/triangle.rst new file mode 100644 index 0000000..e4bc07d --- /dev/null +++ b/docs/dsl/triangle.rst @@ -0,0 +1,2 @@ +triangle +-------- diff --git a/docs/dsl/xlsx.rst b/docs/dsl/xlsx.rst new file mode 100644 index 0000000..3254360 --- /dev/null +++ b/docs/dsl/xlsx.rst @@ -0,0 +1,2 @@ +xlsx +---- diff --git a/docs/index.rst b/docs/index.rst index 32e708d..00f0180 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -8,9 +8,12 @@ Contents: :maxdepth: 1 :glob: - dsl/index.rst - units + learning + parameters range + units + colors + dsl/index.rst Indices and tables ================== diff --git a/docs/learning.rst b/docs/learning.rst new file mode 100644 index 0000000..801d338 --- /dev/null +++ b/docs/learning.rst @@ -0,0 +1,2 @@ +Learning Squib +-------------- diff --git a/docs/parameters.rst b/docs/parameters.rst new file mode 100644 index 0000000..515fd57 --- /dev/null +++ b/docs/parameters.rst @@ -0,0 +1,17 @@ +Parameters are Options +====================== + +Squib is all about sane defaults and shorthand specification. Arguments to DSL methods are almost always using hashes, which look a lot like [Ruby 2.0's named parameters](http://www.ruby-doc.org/core-2.0.0/doc/syntax/calling_methods_rdoc.html#label-Keyword+Arguments). This means you can specify your parameters in any order you please. All parameters are optional. + +For example `x` and `y` default to 0 (i.e. the upper-left corner of the card). Any parameter that is specified in the command overrides any Squib defaults, `config.yml` settings, or layout rules. + +Note: you MUST use named parameters rather than positional parameters. For example: ``save :png`` will lead to an error like this:: + + C:/Ruby200/lib/ruby/gems/2.0.0/gems/squib-0.0.3/lib/squib/api/save.rb:12:in `save': wrong number of arguments (2 for 0..1) (ArgumentError) + from deck.rb:22:in `block in
' + from C:/Ruby200/lib/ruby/gems/2.0.0/gems/squib-0.0.3/lib/squib/deck.rb:60:in `instance_eval' + from C:/Ruby200/lib/ruby/gems/2.0.0/gems/squib-0.0.3/lib/squib/deck.rb:60:in `initialize' + from deck.rb:18:in `new' + from deck.rb:18:in `
' + +Instead, you must name the parameters: `save format: :png`