diff options
author | Jeffrey Armstrong <jeff@approximatrix.com> | 2020-06-09 09:29:27 -0400 |
---|---|---|
committer | Jeffrey Armstrong <jeff@approximatrix.com> | 2020-06-09 09:29:27 -0400 |
commit | fe3032d66691a01d0a970dda3fa33f39b2c4cf5b (patch) | |
tree | 9bef1ab5d3aa66286ca53a4acb35a72983d53b27 /dumb_render.f90 | |
parent | 52915ba4bcb8f82a7d8249df07130e4fc0e5bd32 (diff) | |
download | LR-87-fe3032d66691a01d0a970dda3fa33f39b2c4cf5b.tar.gz LR-87-fe3032d66691a01d0a970dda3fa33f39b2c4cf5b.zip |
Added support for quotes that are new in the spec. Looks pretty on Win32, untested in dumb renderer.
Diffstat (limited to 'dumb_render.f90')
-rw-r--r-- | dumb_render.f90 | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/dumb_render.f90 b/dumb_render.f90 index 23b991b..be911b7 100644 --- a/dumb_render.f90 +++ b/dumb_render.f90 @@ -29,6 +29,8 @@ implicit none character, parameter::bullet_character = '-' + integer, parameter::indent_margin = 3 + type, extends(renderer) :: dumb_renderer integer::link_index @@ -46,7 +48,7 @@ implicit none procedure :: text_height => dumb_text_height procedure :: is_text_visible => dumb_text_visible - procedure :: draw_porportional => dumb_text_draw + procedure :: draw_proportional => dumb_text_draw procedure :: preformatted_width => dumb_simple_width procedure :: preformatted_height => dumb_simple_height @@ -127,38 +129,38 @@ contains end function store_link - function dumb_text_width(self, text, heading, list_item) + function dumb_text_width(self, text, text_type) implicit none class(dumb_renderer)::self character(*), intent(in)::text - integer, intent(in), optional::heading - logical, intent(in), optional::list_item + integer, intent(in), optional::text_type integer::dumb_text_width dumb_text_width = len_trim(text) - if(present(list_item)) then - if(list_item) then - dumb_text_width = dumb_text_width + 3 + if(present(text_type)) then + if(text_type == proportional_type_list_item) then + dumb_text_width = dumb_text_width + indent_margin + else if(text_type == proportional_type_quotation) then + dumb_text_width = dumb_text_width + 2*indent_margin end if end if end function dumb_text_width - function dumb_text_height(self, text, heading, list_item) + function dumb_text_height(self, text, text_type) implicit none class(dumb_renderer)::self character(*), intent(in)::text - integer, intent(in), optional::heading - logical, intent(in), optional::list_item + integer, intent(in), optional::text_type integer::dumb_text_height dumb_text_height = 1 - if(present(heading)) then - if(heading > 0) then + if(present(text_type)) then + if(text_type > 0) then dumb_text_height = 2 end if end if @@ -222,21 +224,22 @@ contains end if end subroutine dumb_simple_draw - subroutine dumb_text_draw(self, text, heading, list_item) + subroutine dumb_text_draw(self, text, text_type) implicit none class(dumb_renderer)::self character(*), intent(in)::text - integer, intent(in), optional::heading - logical, intent(in), optional::list_item + integer, intent(in), optional::text_type integer::limit_x character(5)::formatting character(self%max_width)::heading_line ! Put a bullet for list items - if(present(list_item)) then - if(list_item) then + if(present(text_type)) then + if(text_type == proportional_type_list_item) then write(*, '(1X, A1, 1X)', advance='no') bullet_character + else if(text_type == proportional_type_quotation) then + write(*, '(3X)', advance='no') end if end if @@ -254,10 +257,10 @@ contains end if ! For headings, plop a second line as an underline - if(present(heading)) then - if(heading > 0) then + if(present(text_type)) then + if(text_type > 0) then if(limit_x > 0) then - if(heading == 1) then + if(text_type == proportional_type_heading_1) then heading_line = repeat("=", limit_x) else heading_line = repeat("-", limit_x) |