Coder Social home page Coder Social logo

Comments (4)

kawahara-kunio avatar kawahara-kunio commented on August 29, 2024 1

Sorry, example above is not good.
Actually, it is a more complicated structure as shown below.
A blade file uses extends with layouts/test.blade.php

somePage.blade.php

@extends('layouts.test')

@section('title', 'This is title')

@section('content')
  <div class="someClass">
    This is content.
  </div>
@endsection

layouts/test.blade.php

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>@yield('title')</title>
</head>

<body>
  <div class='content'>
    @yield('content')
  </div>
</body>

</html>

With this situation, from 1.11.13, the blade file (somePage.blade.php) will be formatted as shown below.

@extends('layouts.test')

@section('title', 'This is title')

@section('content')
<div class="someClass">
  This is content.
</div>
@endsection

from blade-formatter.

shufo avatar shufo commented on August 29, 2024 1

Fixed by #331. Thanks @schelmo!
And release is at https://github.com/shufo/blade-formatter/releases/tag/v1.12.1

Thanks for reporting the issue @kawahara-kunio!

from blade-formatter.

schelmo avatar schelmo commented on August 29, 2024

but isnt your code invalid?
if the second parameter is filled, the section is already ended and you will get an exception:

InvalidArgumentException
Cannot end a section without first starting one.

from blade-formatter.

shufo avatar shufo commented on August 29, 2024

I also encountered an exception on Laravel v8.54.0

❯ composer show | grep laravel/framework
laravel/framework                  v8.54.0 The Laravel Framework.
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Laravel</title>

    <!-- Fonts -->
    <link href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap" rel="stylesheet">
~~~~
</body>
@section('content', 'title')
<div class="some-class">
</div>
@endsection

</html>

then

2021-08-15_23-55

Laravel 6.x also occured exception on above template.

2021-08-15_23-58

from blade-formatter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.