<html>
<script>
const regex = /!\[(.*?)\]\((.*?)\)/g;
const str = `# Created by Jerry Wang, last modified on Jun 24, 2014
User parameter里只要BSPWD_USER_LEVEL 值大于5 即可在webclient UI上显示error message的technical information:
![clipboard1](https://user-images.githubusercontent.com/5669954/28164017-f102028c-67ff-11e7-81f0-a4e8b0e48fd0.png)
![clipboard2](https://user-images.githubusercontent.com/5669954/28164011-f0781176-67ff-11e7-8779-6db53bb01be6.png)
![clipboard3](https://user-images.githubusercontent.com/5669954/28164013-f094ce10-67ff-11e7-9b47-d26fa4413599.png)
![clipboard4](https://user-images.githubusercontent.com/5669954/28164014-f0998676-67ff-11e7-9126-8c0d609b0607.png)
这里决定用什么icon来在UI上显示message:
![clipboard5](https://user-images.githubusercontent.com/5669954/28164019-f16258f8-67ff-11e7-9aec-43538d1ce54f.png)
message level > 5的判断:
![clipboard6](https://user-images.githubusercontent.com/5669954/28164015-f09c7570-67ff-11e7-9c06-da380d4a0c06.png)
![clipboard7](https://user-images.githubusercontent.com/5669954/28164018-f15fee1a-67ff-11e7-9ef0-ea44b3e3a049.png)
![clipboard8](https://user-images.githubusercontent.com/5669954/28164016-f0d067e0-67ff-11e7-9445-baf3af4c1494.png)`;
let m;
var printResult = ( array) => {
var url = array[2];
var splited = url.split(".");
console.log("local file: " + array[1] + "." + splited[splited.length-1]);
console.log("url: " + url);
};
while ((m = regex.exec(str)) !== null) {
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
printResult(m);
}
</script>
</html>
class CL_ABAP_GIT_ISSUE_IMAGE_TOOL definition
public
final
create public .
public section.
types:
BEGIN OF ty_image_reference,
image_name TYPE string,
image_url TYPE string,
END OF ty_image_reference .
types:
tt_image_reference TYPE TABLE OF ty_image_reference with key image_name .
class-methods GET_IMAGE_REFERENCE
importing
!IV_ISSUE_SOURCE_CODE type STRING
returning
value(RT_IMAGE) type TT_IMAGE_REFERENCE .
protected section.
private section.
class-data SV_IMAGE_PATTERN type STRING value '(!\[.*\]\(.*\))' ##NO_TEXT.
ENDCLASS.
CLASS CL_ABAP_GIT_ISSUE_IMAGE_TOOL IMPLEMENTATION.
METHOD get_image_reference.
DATA: lv_reg_pattern TYPE string,
lt_result_tab TYPE match_result_tab.
FIND ALL OCCURRENCES OF '![' IN iv_issue_source_code MATCH COUNT DATA(lv_count).
CHECK lv_count > 0.
lv_reg_pattern = sv_image_pattern.
IF lv_count > 1.
DO lv_count - 1 TIMES.
lv_reg_pattern = lv_reg_pattern && '.*' && sv_image_pattern.
ENDDO.
ENDIF.
TRY.
FIND ALL OCCURRENCES OF REGEX lv_reg_pattern
IN iv_issue_source_code
RESULTS lt_result_tab.
CATCH cx_root INTO DATA(cx_root).
WRITE:/ cx_root->get_text( ).
RETURN.
ENDTRY.
READ TABLE lt_result_tab ASSIGNING FIELD-SYMBOL(<result>) INDEX 1.
CHECK sy-subrc = 0.
LOOP AT <result>-submatches ASSIGNING FIELD-SYMBOL(<match>).
WRITE:/ 'Match...........'.
WRITE:/ iv_issue_source_code+<match>-offset(<match>-length).
ENDLOOP.
ENDMETHOD.
ENDCLASS.
SELECT SINGLE * INTO @DATA(ls) FROM crmd_git_issue WHERE repo_name = 'KM' AND
issue_num = 282.
cl_abap_git_issue_image_tool=>get_image_reference( ls-issue_body ).
SELECT SINGLE * INTO @DATA(ls) FROM crmd_git_issue WHERE repo_name = 'KM' AND issue_num = 282.
DATA(lt_image) = cl_abap_git_issue_image_tool=>get_image_ref_via_js_service( ls-issue_body ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
17 | |
14 | |
13 | |
10 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 |