Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document mutations #180

Merged
merged 22 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
23e5259
`Markdown` improvements.
LastDragon-ru Aug 6, 2024
346daec
Added `Mutation`s to edit `Document`.
LastDragon-ru Aug 7, 2024
7ba13ab
`Mutation` moved to `Contracts`.
LastDragon-ru Aug 8, 2024
a00bb5e
`XmlRenderer` moved to `Nodes`.
LastDragon-ru Aug 8, 2024
dd60b74
`Move` mutation will expect that document and target paths are file p…
LastDragon-ru Aug 9, 2024
e208606
`Document::getTitle()` will use filename if it is known and no Header.
LastDragon-ru Aug 9, 2024
4bbc1a1
`Document::getSummary()` will return first paragraph even if no Header.
LastDragon-ru Aug 9, 2024
58a85e3
Added `Document::getBody()` (returns the text after the summary).
LastDragon-ru Aug 9, 2024
9539352
Xml `Renderer` rework (it will wrap other renderers).
LastDragon-ru Aug 10, 2024
83983ae
Footnotes location detection.
LastDragon-ru Aug 10, 2024
81cac11
Added `Utils::getLocation()` helper.
LastDragon-ru Aug 10, 2024
cfed4d9
More tests for Footnotes.
LastDragon-ru Aug 10, 2024
7f8628e
More accurate `TableCell` coordinates.
LastDragon-ru Aug 10, 2024
6e7c528
`Footnode` location detection.
LastDragon-ru Aug 11, 2024
d0473ed
`FootnotesRemove` mutation.
LastDragon-ru Aug 11, 2024
7999ab4
`ReferencesInline` mutation.
LastDragon-ru Aug 11, 2024
628de3d
`Document::mutate()` accept multiple mutations.
LastDragon-ru Aug 11, 2024
a780838
`Editor::getText()`/`Document::getText()` will accept `Coordinate`.
LastDragon-ru Aug 13, 2024
4503023
`FootnotesPrefix` mutation.
LastDragon-ru Aug 13, 2024
524c9b8
`ReferencesInline` mutation will remove `References` nodes.
LastDragon-ru Aug 13, 2024
2c32f72
`ReferencesPrefix` mutation.
LastDragon-ru Aug 13, 2024
dcf573d
Added `Document::toInlinable()`/`Document::toSplittable()`.
LastDragon-ru Aug 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/documentator/src/Markdown/Contracts/Mutation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php declare(strict_types = 1);

namespace LastDragon_ru\LaraASP\Documentator\Markdown\Contracts;

use LastDragon_ru\LaraASP\Documentator\Markdown\Document;
use LastDragon_ru\LaraASP\Documentator\Markdown\Location\Location;
use League\CommonMark\Node\Block\Document as DocumentNode;

interface Mutation {
/**
* @return array<array-key, array{Location, ?string}>
*/
public function __invoke(Document $document, DocumentNode $node): array;
}
22 changes: 22 additions & 0 deletions packages/documentator/src/Markdown/Data/BlockPadding.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php declare(strict_types = 1);

namespace LastDragon_ru\LaraASP\Documentator\Markdown\Data;

use Override;

/**
* @internal
* @implements Value<int>
*/
readonly class BlockPadding implements Value {
public function __construct(
private int $value,
) {
// empty
}

#[Override]
public function get(): mixed {
return $this->value;
}
}
22 changes: 22 additions & 0 deletions packages/documentator/src/Markdown/Data/Length.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php declare(strict_types = 1);

namespace LastDragon_ru\LaraASP\Documentator\Markdown\Data;

use Override;

/**
* @internal
* @implements Value<int>
*/
readonly class Length implements Value {
public function __construct(
private int $value,
) {
// empty
}

#[Override]
public function get(): mixed {
return $this->value;
}
}
Loading
Loading