Giter VIP home page Giter VIP logo

prawn-manual_builder's Introduction

Prawn::ManualBuilder

Maintained: yes

This library is used by Prawn to generate its self-documenting manual, and could be used by third-party Prawn extensions to create manuals for their functionality as well.

It is in a very early stage of maintenance, and is not yet officially supported for use outside of Prawn. However, you're welcome to use it at your own risk!

Prawn::ManualBuilder was initially developed as an internal tool for Prawn by Felipe Doria, and is now maintained by Gregory Brown.

prawn-manual_builder's People

Contributors

fale avatar packetmonkey avatar pointlessone avatar practicingruby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prawn-manual_builder's Issues

Nitpick: Incorrect FSF address in current release

This was fixed back in June 2016 but the current 0.3.0 release still has the wrong address.

Raising this just so it can get picked up for next release.

rubygem-prawn-manual_builder.noarch: E: incorrect-fsf-address /usr/share/gems/gems/prawn-manual_builder-0.3.0/GPLv2

colored_box height calculation

Hello,
I tried to re-use https://github.com/prawnpdf/prawn-manual_builder/blob/1fdbb0beaa1b9d1ddf403640d70907d19c652d60/lib/prawn/manual_builder/example.rb#L328C11-L328C22 code and found that box_height calculation gives me smaller values than expected. Especially when text is long.

box_height = height_of_formatted(box_text, text_options)

bounding_box([INNER_MARGIN + RHYTHM, cursor], :width => bounds.width - (INNER_MARGIN+RHYTHM)*2) do
  ...
  formatted_text(box_text, text_options)
  ...
end

So, after a few attempts, I ended up with following:

bounding_box([INNER_MARGIN + RHYTHM, cursor], :width => bounds.width - (INNER_MARGIN+RHYTHM)*2) do
  box_height = height_of_formatted(box_text, text_options)
end

bounding_box([INNER_MARGIN + RHYTHM, cursor], :width => bounds.width - (INNER_MARGIN+RHYTHM)*2) do
  ...
  formatted_text(box_text, text_options)
  ...
end

i.e. height_of_formatted is also called within bounding_box thus providing correct value.
In my case, I call it in a separate block because I also do this

bounding_box([INNER_MARGIN + RHYTHM, cursor], :width => bounds.width - (INNER_MARGIN+RHYTHM)*2) do
  box_height = height_of_formatted(box_text, text_options)
end

start_new_page if cursor - box_height - RHYTHM * 2 < 0

which is not possible (start_new_page) to do inside bounding_box.

I have two questions here. Is that empty bounding_box may cause any issues? I expect its height to be zero, right?
And, is it worth to update #colored_box helper here?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.