Skip to content

Commit af92225

Browse files
committed
README rendering test
1 parent a03e018 commit af92225

File tree

2 files changed

+59
-37
lines changed

2 files changed

+59
-37
lines changed

README.md

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ or
121121
USAGE
122122
=====
123123

124-
(See also the README file and several example scripts include with this module.)
124+
(See several example scripts include with this module.)
125125

126126
This module now provides an object-oriented interface that uses less memory and is easier to use than most of the previous procedural interfaces. It also still provides several exportable functions. We'll deal with these in ascending order of difficulty: `LCS`, `LCS_length`, `LCSidx`, OO interface, `prepare`, `diff`, `sdiff`, `traverse_sequences`, and `traverse_balanced`.
127127

@@ -204,7 +204,8 @@ $maxIdx = $obj.Max( $seqNum, [ $base ] );
204204

205205
Passing in an undefined value for an optional argument is always treated the same as if no argument were passed in.
206206

207-
* Next
207+
Next
208+
----
208209

209210
```raku
210211
$pos = $diff.Next; # Move forward 1 hunk
@@ -218,13 +219,15 @@ $pos = $diff.Next(-5); # Move backward 5 hunks
218219

219220
Actually, `Next` returns the object's new position, which is a number between 1 and the number of hunks (inclusive), or returns a false value.
220221

221-
* Prev
222+
Prev
223+
----
222224

223225
`Prev($N)` is almost identical to `Next(-$N)`; it moves to the $Nth previous hunk. On a 'reset' object, `Prev()` [and `Next(-1)`] move to the last hunk.
224226

225227
The position returned by `Prev` is relative to the *end* of the hunks; -1 for the last hunk, -2 for the second-to-last, etc.
226228

227-
* `Reset`
229+
`Reset`
230+
-------
228231

229232
```raku
230233
$diff.Reset; # Reset the object's position
@@ -235,7 +238,8 @@ $diff.Reset(-1); # Move to the last hunk
235238

236239
`Reset` returns the object, so, for example, you could use `$diff.Reset().Next(-1) ` to get the number of hunks.
237240

238-
* Copy
241+
Copy
242+
----
239243

240244
```raku
241245
$copy = $diff.Copy( $newPos, $newBase );
@@ -271,35 +275,38 @@ $copy = $diff.Copy(0);
271275
$copy = $diff.Copy.Reset;
272276
```
273277

274-
* Diff
278+
Diff
279+
----
275280

276281
```raku
277282
$bits = $obj.Diff;
278283
```
279284

280285
`Diff` returns a true value iff the current hunk contains items that are different between the two sequences. It actually returns one of the follow 4 values:
281286

282-
* 3
287+
### 3
283288

284289
`3==(1|2)`. This hunk contains items from @seq1 and the items from @seq2 that should replace them. Both sequence 1 and 2 contain changed items so both the 1 and 2 bits are set.
285290

286-
* 2
291+
### 2
287292

288293
This hunk only contains items from @seq2 that should be inserted (not items from @seq1). Only sequence 2 contains changed items so only the 2 bit is set.
289294

290-
* 1
295+
### 1
291296

292297
This hunk only contains items from @seq1 that should be deleted (not items from @seq2). Only sequence 1 contains changed items so only the 1 bit is set.
293298

294-
* 0
299+
### 0
295300

296301
This means that the items in this hunk are the same in both sequences. Neither sequence 1 nor 2 contain changed items so neither the 1 nor the 2 bits are set.
297302

298-
* Same
303+
Same
304+
----
299305

300306
`Same` returns a true value iff the current hunk contains items that are the same in both sequences. It actually returns the list of items if they are the same or an emty list if they aren't. In a scalar context, it returns the size of the list.
301307

302-
* Items
308+
Items
309+
-----
303310

304311
```raku
305312
$count = $diff.Items(2);
@@ -320,7 +327,8 @@ Otherwise, the hunk contains identical items and all of the following will retur
320327
@items = $diff.Same;
321328
```
322329

323-
* Range
330+
Range
331+
-----
324332

325333
```raku
326334
$count = $diff.Range( $seqNum );
@@ -342,7 +350,8 @@ You can also specify the base to use as the second argument. So the following tw
342350
@list = @seq1[ $diff.Range(1,0) ];
343351
```
344352

345-
* Base
353+
Base
354+
----
346355

347356
```raku
348357
$curBase = $diff.Base();
@@ -351,7 +360,8 @@ $oldBase = $diff.Base($newBase);
351360

352361
`Base` sets and/or returns the current base (usually 0 or 1) that is used when you request range information. The base defaults to 0 so that range information is returned as array indices. You can set the base to 1 if you want to report traditional line numbers instead.
353362

354-
* Min
363+
Min
364+
---
355365

356366
```raku
357367
$min1 = $diff.Min(1);
@@ -360,7 +370,8 @@ $min = $diff.Min( $seqNum, $base );
360370

361371
`Min` returns the first value that `Range` would return (given the same arguments) or returns `undef` if `Range` would return an empty list.
362372

363-
* Max
373+
Max
374+
---
364375

365376
`Max` returns the last value that `Range` would return or `Nil`.
366377

@@ -694,6 +705,8 @@ LICENSE
694705

695706
Parts Copyright (c) 2000-2004 Ned Konz. All rights reserved. Parts by Tye McQueen.
696707

708+
Copyright 2024 Raku Community
709+
697710
This program is free software; you can redistribute it and/or modify it under the same terms as Perl.
698711

699712
CREDITS

doc/Algorithm-Diff.rakudoc

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ a b c a x b y c z
162162

163163
=head1 USAGE
164164

165-
(See also the README file and several example
166-
scripts include with this module.)
165+
(See several example scripts include with this module.)
167166

168167
This module now provides an object-oriented interface that uses less
169168
memory and is easier to use than most of the previous procedural
@@ -273,7 +272,7 @@ $maxIdx = $obj.Max( $seqNum, [ $base ] );
273272
Passing in an undefined value for an optional argument is always treated the
274273
same as if no argument were passed in.
275274

276-
=item Next
275+
=head2 Next
277276

278277
=begin code :lang<raku>
279278

@@ -293,7 +292,7 @@ So C<Next(0)> will return true iff the object is not reset.
293292
Actually, C<Next> returns the object's new position, which is a number
294293
between 1 and the number of hunks (inclusive), or returns a false value.
295294

296-
=item Prev
295+
=head2 Prev
297296

298297
C<Prev($N)> is almost identical to C<Next(-$N)>; it moves to the $Nth
299298
previous hunk. On a 'reset' object, C<Prev()> [and C<Next(-1)>] move
@@ -302,7 +301,7 @@ to the last hunk.
302301
The position returned by C<Prev> is relative to the I<end> of the
303302
hunks; -1 for the last hunk, -2 for the second-to-last, etc.
304303

305-
=item C<Reset>
304+
=head2 C<Reset>
306305

307306
=begin code :lang<raku>
308307

@@ -316,7 +315,7 @@ $diff.Reset(-1); # Move to the last hunk
316315
C<Reset> returns the object, so, for example, you could use
317316
C<< $diff.Reset().Next(-1) >> to get the number of hunks.
318317

319-
=item Copy
318+
=head2 Copy
320319

321320
=begin code :lang<raku>
322321

@@ -368,7 +367,7 @@ $copy = $diff.Copy.Reset;
368367

369368
=end code
370369

371-
=item Diff
370+
=head2 Diff
372371

373372
=begin code :lang<raku>
374373

@@ -380,38 +379,38 @@ C<Diff> returns a true value iff the current hunk contains items that are
380379
different between the two sequences. It actually returns one of the
381380
follow 4 values:
382381

383-
=item 3
382+
=head3 3
384383

385384
C<3==(1|2)>. This hunk contains items from @seq1 and the items
386385
from @seq2 that should replace them. Both sequence 1 and 2
387386
contain changed items so both the 1 and 2 bits are set.
388387

389-
=item 2
388+
=head3 2
390389

391390
This hunk only contains items from @seq2 that should be inserted (not
392391
items from @seq1). Only sequence 2 contains changed items so only the 2
393392
bit is set.
394393

395-
=item 1
394+
=head3 1
396395

397396
This hunk only contains items from @seq1 that should be deleted (not
398397
items from @seq2). Only sequence 1 contains changed items so only the 1
399398
bit is set.
400399

401-
=item 0
400+
=head3 0
402401

403402
This means that the items in this hunk are the same in both sequences.
404403
Neither sequence 1 nor 2 contain changed items so neither the 1 nor the
405404
2 bits are set.
406405

407-
=item Same
406+
=head2 Same
408407

409408
C<Same> returns a true value iff the current hunk contains items that
410409
are the same in both sequences. It actually returns the list of items
411410
if they are the same or an emty list if they aren't. In a scalar
412411
context, it returns the size of the list.
413412

414-
=item Items
413+
=head2 Items
415414

416415
=begin code :lang<raku>
417416

@@ -442,7 +441,7 @@ will return the same lists:
442441

443442
=end code
444443

445-
=item Range
444+
=head2 Range
446445

447446
=begin code :lang<raku>
448447

@@ -475,7 +474,7 @@ following two snippets I<always> return the same lists:
475474

476475
=end code
477476

478-
=item Base
477+
=head2 Base
479478

480479
=begin code :lang<raku>
481480

@@ -489,7 +488,7 @@ used when you request range information. The base defaults to 0 so
489488
that range information is returned as array indices. You can set the
490489
base to 1 if you want to report traditional line numbers instead.
491490

492-
=item Min
491+
=head2 Min
493492

494493
=begin code :lang<raku>
495494

@@ -502,7 +501,7 @@ C<Min> returns the first value that C<Range> would return (given the
502501
same arguments) or returns C<undef> if C<Range> would return an empty
503502
list.
504503

505-
=item Max
504+
=head2 Max
506505

507506
C<Max> returns the last value that C<Range> would return or C<Nil>.
508507

@@ -560,8 +559,12 @@ empty.
560559

561560
Here is an example. Calling C<diff> for the following two sequences:
562561

563-
a b c e h j l m n p
564-
b c d e f j k l m r s t
562+
=begin output
563+
564+
a b c e h j l m n p
565+
b c d e f j k l m r s t
566+
567+
=end output
565568

566569
would produce the following list:
567570

@@ -628,8 +631,12 @@ be displayed side-by-side.
628631

629632
An C<sdiff> of the following two sequences:
630633

631-
a b c e h j l m n p
632-
b c d e f j k l m r s t
634+
=begin output
635+
636+
a b c e h j l m n p
637+
b c d e f j k l m r s t
638+
639+
=end output
633640

634641
results in
635642

@@ -986,6 +993,8 @@ Further procedural porting and object interface port by Steve Schulze.
986993
Parts Copyright (c) 2000-2004 Ned Konz. All rights reserved.
987994
Parts by Tye McQueen.
988995

996+
Copyright 2024 Raku Community
997+
989998
This program is free software; you can redistribute it and/or modify it
990999
under the same terms as Perl.
9911000

0 commit comments

Comments
 (0)