Git Product home page Git Product logo

Comments (6)

thunderer avatar thunderer commented on June 19, 2024

Hi @xuannghia, can you post the code to reproduce the issues reported above?

from shortcode.

xuannghia avatar xuannghia commented on June 19, 2024

Hi @thunderer
This is my example code

<?php
require_once 'vendor/autoload.php';

use Thunder\Shortcode\HandlerContainer\HandlerContainer;
use Thunder\Shortcode\Parser\RegularParser;
use Thunder\Shortcode\Processor\Processor;
use Thunder\Shortcode\Shortcode\ShortcodeInterface;
use Thunder\Shortcode\Syntax\Syntax;

function shortcode($text) {
    $handlers = new HandlerContainer();
    $handlers->add('container', function(ShortcodeInterface $s) {
        return '<div class="container">'.$s->getContent().'</div>';
    });
    $defaultSyntax = new Syntax('[', ']', '/', '=', '"');
    $processor = new Processor(new RegularParser($defaultSyntax), $handlers);
    return $processor->process($text);
}

$case_1 = '[container][Tiêu đề][/container]';
$case_2 = '[container][][/container]';

echo shortcode($case_1); // I get <div class="container"></div>[Tiêu đề][/container]
echo shortcode($case_2); // I get <div class="container"></div>[][/container]

P/s: I use PHP 7.3 and thunderer/shortcode version 0.6.5 (I install with composer)

Thank you.

from shortcode.

xuannghia avatar xuannghia commented on June 19, 2024

Oh, sorry for my mistake. These issues have been resolved in version 0.7.2.
But file README.md instructing me for installing version 0.6.5. Can you change it so that those who come later do not have to meet the situation like me?

from shortcode.

thunderer avatar thunderer commented on June 19, 2024

@xuannghia are both issues resolved by upgrading to v0.7? I will update the README shortly.

from shortcode.

thunderer avatar thunderer commented on June 19, 2024

@xuannghia can you confirm that the upgrade you mentioned above resolved both problems? If so, can we close this issue?

from shortcode.

xuannghia avatar xuannghia commented on June 19, 2024

@thunderer Yes, upgrading to v0.7.2 can fix both issues. Sorry for the late reply.

from shortcode.

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.