mirror of
https://github.com/abapGit/abapGit.git
synced 2025-04-30 11:46:38 +08:00
Fix indent of <pre>
tags in HTML
`<pre>...</pre>` sections do not render correctly since the HTML is indented, which leads to extra whitespace. abapGit is not impacted but tooling on top of abapGit is.
This commit is contained in:
parent
e16e3d3ac6
commit
80da05fd6a
|
@ -48,6 +48,7 @@ CLASS zcl_abapgit_html DEFINITION
|
|||
within_style TYPE abap_bool,
|
||||
within_js TYPE abap_bool,
|
||||
within_textarea TYPE abap_bool,
|
||||
within_pre TYPE abap_bool,
|
||||
indent TYPE i,
|
||||
indent_str TYPE string,
|
||||
END OF ty_indent_context .
|
||||
|
@ -59,6 +60,8 @@ CLASS zcl_abapgit_html DEFINITION
|
|||
script_close TYPE abap_bool,
|
||||
textarea_open TYPE abap_bool,
|
||||
textarea_close TYPE abap_bool,
|
||||
pre_open TYPE abap_bool,
|
||||
pre_close TYPE abap_bool,
|
||||
tag_close TYPE abap_bool,
|
||||
curly_close TYPE abap_bool,
|
||||
openings TYPE i,
|
||||
|
@ -85,7 +88,7 @@ ENDCLASS.
|
|||
|
||||
|
||||
|
||||
CLASS ZCL_ABAPGIT_HTML IMPLEMENTATION.
|
||||
CLASS zcl_abapgit_html IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD checkbox.
|
||||
|
@ -120,10 +123,6 @@ CLASS ZCL_ABAPGIT_HTML IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD set_debug_mode.
|
||||
gv_debug_mode = iv_mode.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD create.
|
||||
CREATE OBJECT ri_instance TYPE zcl_abapgit_html.
|
||||
IF iv_initial_chunk IS NOT INITIAL.
|
||||
|
@ -134,11 +133,11 @@ CLASS ZCL_ABAPGIT_HTML IMPLEMENTATION.
|
|||
|
||||
METHOD icon.
|
||||
|
||||
DATA: lv_hint TYPE string,
|
||||
lv_name TYPE string,
|
||||
lv_color TYPE string,
|
||||
lv_class TYPE string,
|
||||
lv_onclick TYPE string.
|
||||
DATA: lv_hint TYPE string,
|
||||
lv_name TYPE string,
|
||||
lv_color TYPE string,
|
||||
lv_class TYPE string,
|
||||
lv_onclick TYPE string.
|
||||
|
||||
SPLIT iv_name AT '/' INTO lv_name lv_color.
|
||||
|
||||
|
@ -181,6 +180,17 @@ CLASS ZCL_ABAPGIT_HTML IMPLEMENTATION.
|
|||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
" No indent for pre tags
|
||||
IF ls_study-pre_open = abap_true.
|
||||
cs_context-within_pre = abap_true.
|
||||
RETURN.
|
||||
ELSEIF ls_study-pre_close = abap_true.
|
||||
cs_context-within_pre = abap_false.
|
||||
RETURN.
|
||||
ELSEIF cs_context-within_pre = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
" First closing tag - shift back exceptionally
|
||||
IF ( ls_study-script_close = abap_true
|
||||
OR ls_study-style_close = abap_true
|
||||
|
@ -239,6 +249,11 @@ CLASS ZCL_ABAPGIT_HTML IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD set_debug_mode.
|
||||
gv_debug_mode = iv_mode.
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD study_line.
|
||||
|
||||
DATA: lv_line TYPE string,
|
||||
|
@ -309,6 +324,16 @@ CLASS ZCL_ABAPGIT_HTML IMPLEMENTATION.
|
|||
ENDIF.
|
||||
ENDIF.
|
||||
|
||||
" Pre (same assumptions as above)
|
||||
IF is_context-within_pre = abap_true AND lv_len >= 5 AND lv_line(5) = '</PRE'.
|
||||
rs_result-pre_close = abap_true.
|
||||
ELSEIF is_context-within_pre = abap_false AND lv_len >= 4 AND lv_line(4) = '<PRE'.
|
||||
FIND FIRST OCCURRENCE OF '</PRE' IN lv_line.
|
||||
IF sy-subrc > 0. " Not found
|
||||
rs_result-pre_open = abap_true.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
|
@ -564,10 +589,10 @@ CLASS ZCL_ABAPGIT_HTML IMPLEMENTATION.
|
|||
DATA lv_close_tag TYPE string.
|
||||
DATA ls_data_attr LIKE LINE OF it_data_attrs.
|
||||
|
||||
DATA: lv_class TYPE string,
|
||||
lv_id TYPE string,
|
||||
DATA: lv_class TYPE string,
|
||||
lv_id TYPE string,
|
||||
lv_data_attr TYPE string,
|
||||
lv_title TYPE string.
|
||||
lv_title TYPE string.
|
||||
|
||||
IF iv_id IS NOT INITIAL.
|
||||
lv_id = | id="{ iv_id }"|.
|
||||
|
|
Loading…
Reference in New Issue
Block a user