Skip to content

Commit 95b71d2

Browse files
authored
Update README.md
1 parent 9ac5129 commit 95b71d2

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

README.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ lv_modified = '\n'
6868
REPLACE ALL OCCURRENCES OF '\n' IN lv_original WITH cl_abap_char_utilities=>newline.
6969
REPLACE ALL OCCURRENCES OF '\n' IN lv_modified WITH cl_abap_char_utilities=>newline.
7070
71-
CREATE OBJECT li_htmldiff TYPE zcl_htmldiff.
71+
li_htmldiff = zcl_htmldiff=>create( ).
7272
7373
lv_diff = li_htmldiff->htmldiff(
7474
iv_before = lv_original
@@ -111,7 +111,7 @@ Result:
111111
<span>This is some <del>interesting</del><ins>new</ins> text.</span>
112112
```
113113

114-
There are a few other options you can set in the `constructor`:
114+
There are a few other options you can set in the `constructor`/`create` statement:
115115

116116
- `iv_inserts`: Show `<ins>` tags (default: on)
117117
- `iv_deletes`: Show `<del>` tags (default: on)
@@ -124,15 +124,31 @@ See the [test classes](https://github.com/Marc-Bernard-Tools/ABAP-HTML-Diff/blob
124124

125125
### Diffing Text
126126

127-
todo
127+
The following produces the diff of two example text snippets:
128128

129129
```abap
130+
DATA:
131+
lv_original TYPE string,
132+
lv_modified TYPE string,
133+
lv_diff TYPE string,
134+
li_htmldiff TYPE REF TO zif_htmldiff.
135+
136+
lv_original = 'a c'.
137+
138+
lv_modified = 'a b c'.
139+
130140
lv_diff = li_htmldiff->textdiff(
131141
iv_before = lv_original
132142
iv_after = lv_modified ).
133143
```
134144

135-
**Styling**
145+
Result:
146+
147+
```text
148+
a <ins>b </ins>c
149+
```
150+
151+
### Styling
136152

137153
Here's an examle for styling the insertions and deletions using CSS.
138154

0 commit comments

Comments
 (0)