kzykhys / Ciconia

A New Markdown parser for PHP5.4
http://ciconia.kzykhys.com/
MIT License
355 stars 31 forks source link

add block quote level #14

Open mawi12345 opened 10 years ago

mawi12345 commented 10 years ago

Some render may need the level of the block quote.

coveralls commented 10 years ago

Coverage Status

Coverage increased (+0.01%) when pulling a93b0d5cde1e377b9a3af8d40dbf929ef105ad22 on mawi12345:master into b5521edbead5822524281c4023597e6ef32145cb on kzykhys:master.

kzykhys commented 10 years ago

Thank you for taking your time. I checked the passed arguments to processBlockQuote and found a problem. I'm looking for a way to solve this.

    /**
     * @param Text $text
     */
    public function processBlockQuote(Text $text, array $options = array(), $level = 1)
    {
        $args = func_get_args();
        var_dump($args);
        /...
$ bin/ciconia test.md

input:

> test
> > test
> > test
> > > test
> > > test

output:

array(2) {
  [0] =>
  class Ciconia\Common\Text#68 (1) {
    private $text =>
    string(50) "> test\n> > test\n> > test\n> > > test\n> > > test\n\n\n\n"
  }
  [1] =>
  array(3) {
    'tabWidth' =>
    int(4)
    'nestedTagLevel' =>
    int(3)
    'strict' =>
    bool(false)
  }
}
array(4) {
  [0] =>
  class Ciconia\Common\Text#76 (1) {
    private $text =>
    string(40) "test\n> test\n> test\n> > test\n> > test\n\n\n\n"
  }
  [1] =>
  array(3) {
    'tabWidth' =>
    int(4)
    'nestedTagLevel' =>
    int(3)
    'strict' =>
    bool(false)
  }
  [2] =>
  int(2)
  [3] =>
  array(3) {
    'tabWidth' =>
    int(4)
    'nestedTagLevel' =>
    int(3)
    'strict' =>
    bool(false)
  }
}
array(4) {
  [0] =>
  class Ciconia\Common\Text#79 (1) {
    private $text =>
    string(27) "test\ntest\n> test\n> test\n\n\n\n"
  }
  [1] =>
  array(3) {
    'tabWidth' =>
    int(4)
    'nestedTagLevel' =>
    int(3)
    'strict' =>
    bool(false)
  }
  [2] =>
  int(3)
  [3] =>
  array(3) {
    'tabWidth' =>
    int(4)
    'nestedTagLevel' =>
    int(3)
    'strict' =>
    bool(false)
  }
}
array(4) {
  [0] =>
  class Ciconia\Common\Text#82 (1) {
    private $text =>
    string(13) "test\ntest\n\n\n\n"
  }
  [1] =>
  array(3) {
    'tabWidth' =>
    int(4)
    'nestedTagLevel' =>
    int(3)
    'strict' =>
    bool(false)
  }
  [2] =>
  int(4)
  [3] =>
  array(3) {
    'tabWidth' =>
    int(4)
    'nestedTagLevel' =>
    int(3)
    'strict' =>
    bool(false)
  }
}
<blockquote>
<p>test</p>

<blockquote>
<p>test
test</p>

<blockquote>
<p>test
test</p>
</blockquote>
</blockquote>
</blockquote>%
coveralls commented 10 years ago

Coverage Status

Coverage increased (+0.01%) when pulling b4967160ba83b938cc421b2e1142fba4c59f8ae1 on mawi12345:master into b5521edbead5822524281c4023597e6ef32145cb on kzykhys:master.

mawi12345 commented 10 years ago

Thank you for your quick response. I have added an block quote extensions unit test. In my use case the extension works great. I suppose you expect level 1 on all nested quotes?

kzykhys commented 10 years ago

level 1: No probrem. level 2+: $options passed as 2nd and 4th argument is duplicated.

I want to solve this. I think the probrem is https://github.com/kzykhys/Ciconia/blob/master/src/Ciconia/Markdown.php#L133.

dereuromark commented 10 years ago

:+1: