pirave / postmarkup

Automatically exported from code.google.com/p/postmarkup
0 stars 0 forks source link

Wrong detection of closed tag? #21

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi. I use postmarkup-1.1.4. And it seems ti do not detects close tag in some 
cases.

I have BBCode:

[code]
# CREATE FIFO
if test -e "$dir_out"/audio.wav; then rm "$dir_out"/audio.wav; fi
mkfifo "$dir_out"/audio.wav

# CONVERTING TO AAC
echo -e '\033[37;44m' '\n' '\t\t'"CONVERTING TO AAC" '\n' '\033[0m'

for i in `find "$in_dir" -maxdepth 1 -name \*.mp3 | sort`
do
  name_aac=$(basename "$i")
  `"$ncp"/neroAacEnc -ignorelength -if "$dir_out"/audio.wav -of "$dir_out"/"${name_aac%%mp3}aac"` &\
 mplayer -nocorrect-pts -vo null -vc null -ao pcm:fast:file="$dir_out"/audio.wav "$i"

  echo -e '\033[34;45m' '\n' '\033[0m'
done
[/code]

[code]
This simple code text.
[/code]

When it processed by postmarkup output is:
<div class="code"><pre>
# CREATE FIFO
if test -e "$dir_out"/audio.wav; then rm "$dir_out"/audio.wav; fi
mkfifo "$dir_out"/audio.wav

# CONVERTING TO AAC
echo -e '\033[37;44m' '\n' '\t\t'"CONVERTING TO AAC" '\n' '\033[0m'

for i in `find "$in_dir" -maxdepth 1 -name \*.mp3 | sort`
do
  name_aac=$(basename "$i")
  `"$ncp"/neroAacEnc -ignorelength -if "$dir_out"/audio.wav -of "$dir_out"/"${name_aac%%mp3}aac"` &amp;\
 mplayer -nocorrect-pts -vo null -vc null -ao pcm:fast:file="$dir_out"/audio.wav "$i"

  echo -e '\033[34;45m' '\n' '\033[0m'
done
[/code]

[code]
This is italic text
[/code]
</pre></div>

As you see: end tag was not detected and it process whole text as one code tag.

If remove line containing "echo -e '\033[37;44m' '\n' '\t\t'"CONVERTING TO AAC" 
'\n' '\033[0m'" all works fine. 

But following text process normally:
[code]
echo -e '\033[37;44m' '\n' '\t\t'"CONVERTING TO AAC" '\n' '\033[0m'
[/code]

[code]
This is italic text
[/code]

Original issue reported on code.google.com by brez...@gmail.com on 4 Jan 2011 at 2:26

GoogleCodeExporter commented 8 years ago
The problem is that the '[' in the code is matching with the ']' in the code 
end tag. Generally this doesn't occur, because in most code every '[' has a 
corresponding ']'.

I'll think about an alternative solution for allowing square brackets inside 
code tags, in the meantime you can escape square brackets by enclosing them in 
a second set of square brackets. i.e. replace '[' with '[[]'

Original comment by willmcgugan on 4 Jan 2011 at 3:54

GoogleCodeExporter commented 8 years ago
Thanks for the reply :)

Original comment by brez...@gmail.com on 4 Jan 2011 at 4:06

GoogleCodeExporter commented 8 years ago
Just pushed a change that makes negates the need to escape square brackets in 
the code tag. Seems to work with your example.

Original comment by willmcgugan on 4 Jan 2011 at 6:49

GoogleCodeExporter commented 8 years ago
Thanks. I test and it seems all worked fine.

Thank you for library and for your work! :)

Original comment by brez...@gmail.com on 4 Jan 2011 at 7:35