This repository has been archived by the owner on Feb 27, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c7e0a0
commit 547ddcf
Showing
9 changed files
with
151 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
namespace ProtoneMedia\SpladeCore\View; | ||
|
||
use Illuminate\View\Compilers\ComponentTagCompiler as BaseComponentTagCompiler; | ||
|
||
class ComponentTagCompiler extends BaseComponentTagCompiler | ||
{ | ||
protected function compileOpeningTags(string $value) | ||
{ | ||
return $value = parent::compileOpeningTags($value); | ||
|
||
if (! str_contains($value, '<?php $component->withAttributes')) { | ||
return $value; | ||
} | ||
|
||
if (str_contains($value, '<template #default>')) { | ||
dd($value); | ||
} | ||
|
||
return collect(explode("\n", $value))->map(function ($line) { | ||
if (trim($line) === '<?php $component->withAttributes([]); ?>') { | ||
return $line.'<template #default>'; | ||
} | ||
|
||
if (trim($line) === '<?php $component->withAttributes([\'@incremented\' => \'layoutCounter++\']); ?>') { | ||
return $line.'<template #default>'; | ||
} | ||
|
||
if (str_contains($line, '<?php $component->withAttributes')) { | ||
dd($line); | ||
} | ||
|
||
return $line; | ||
})->implode("\n"); | ||
} | ||
|
||
protected function compileClosingTags(string $value) | ||
{ | ||
return $value = parent::compileClosingTags($value); | ||
|
||
return collect(explode("\n", $value))->map(function ($line) { | ||
if (str_contains($line, '</template>')) { | ||
return $line; | ||
} | ||
|
||
if (trim($line) === '@endComponentClass##END-COMPONENT-CLASS##') { | ||
return $line.'</template>'; | ||
} | ||
|
||
return $line; | ||
})->implode("\n"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters