Code Monkey home page Code Monkey logo

postmarkup's People

Contributors

willmcgugan avatar

postmarkup's Issues

OrderedListTag not in __all__

I tried to extend BBcode and found that OrderedListTag class not listed in 
__all__ import names.
is it a bug or a feauture? :)

Original issue reported on code.google.com by [email protected] on 11 Nov 2012 at 10:39

Line feeds are replaced with <br/> in CODE contents.

> What steps will reproduce the problem?
markup = postmarkup.create(use_pygments=False)
print markup('[code]foo\nbar[/code]')

> What is the expected output? What do you see instead?
I expect to see:
<div class="code"><pre>foo\nbar</pre></div>
but I see
<div class="code"><pre>foo<br/>bar</pre></div>


> What version of the product are you using? On what operating system?
trunk, rev. 14


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 20 Sep 2008 at 7:25

Adding table tags

Howdy,

Is it possible to have table tags added? I've created a code diff for what 
works already using your code as the example.

Example Using code diff below:
postmarkup.render_bbcode("[table][tr][td]Row 1, Col 1[/td][td]Row 1, Col 
2[/td][/tr][tr][td]Row 2, Col 1[/td][td]Row 2, Col 2[/td][/tr][/table]")

Code:
Index: postmarkup.py
--- postmarkup.py 
+++ postmarkup.py (unsaved) 
@@ -120,6 +120,11 @@
     add_tag(SizeTag, u"size")
     add_tag(ColorTag, u"color")
     add_tag(CenterTag, u"center")
+    
+    # Table information
+    add_tag(TableTag, u"table")
+    add_tag(TableRowTag, u"tr")
+    add_tag(TableDataTag, u"td")

     if use_pygments:
         assert pygments_available, "Install Pygments (http://pygments.org/) or call create with use_pygments=False"
@@ -314,6 +319,66 @@
         else:
             return u""

+class TableTag(TagBase):
+
+    def __init__(self, name, **kwargs):
+        TagBase.__init__(self, name, strip_first_newline=True)
+
+    def open(self, parser, *args):
+        TagBase.open(self, parser, *args)
+
+    def close(self, parser, *args):
+        TagBase.close(self, parser, *args)
+
+    def render_open(self, parser, node_index):
+        if self.params:
+            return u'<table>%s'%(PostMarkup.standard_replace(self.params))
+        else:
+            return u'<table>'
+
+    def render_close(self, parser, node_index):
+        return u"</table>"
+
+class TableRowTag(TagBase):
+
+    def __init__(self, name, **kwargs):
+        TagBase.__init__(self, name, strip_first_newline=True)
+
+    def open(self, parser, *args):
+        TagBase.open(self, parser, *args)
+
+    def close(self, parser, *args):
+        TagBase.close(self, parser, *args)
+
+    def render_open(self, parser, node_index):
+        if self.params:
+            return u'<tr>%s'%(PostMarkup.standard_replace(self.params))
+        else:
+            return u'<tr>'
+
+    def render_close(self, parser, node_index):
+        return u"</tr>"
+
+class TableDataTag(TagBase):
+
+    def __init__(self, name, **kwargs):
+        TagBase.__init__(self, name, strip_first_newline=True)
+
+    def open(self, parser, *args):
+        TagBase.open(self, parser, *args)
+
+    def close(self, parser, *args):
+        TagBase.close(self, parser, *args)
+
+    def render_open(self, parser, node_index):
+        if self.params:
+            return u'<td>%s'%(PostMarkup.standard_replace(self.params))
+        else:
+            return u'<td>'
+
+    def render_close(self, parser, node_index):
+        return u"</td>"
+    

 class QuoteTag(TagBase):


Thank you for your time and assistance,
- Kusinwolf

Original issue reported on code.google.com by [email protected] on 3 Feb 2011 at 9:45

Comma after URL with auto_urls=true

What steps will reproduce the problem?
1. Enable auto_urls
2. Markup text: "Test text http://yandex.ru/das/?para=dsa-11&dsa+42.html, 
blabalbal"

What is the expected output? What do you see instead?
Comma after url will have wrapped by [url] tag

What version of the product are you using? On what operating system?
postmarkup==1.2.2, Python 3.4.3

Probably the problem of _re_url.
Correctly regular expression: _re_url = 
re.compile(r"(https?):(//)+([\d\w:#@%/;$()~_?\+\-=\\\.&]*)", re.MULTILINE | 
re.UNICODE)

Original issue reported on code.google.com by [email protected] on 8 Aug 2015 at 1:47

Link and Image XSS

What steps will reproduce the problem?

import postmarkup
postmarkup.render_bbcode('[url=<script src="...">]Attack[/url]')
postmarkup.render_bbcode('[img]<script>Attack</script>[/img]')

What is the expected output? What do you see instead?

This should yield:

u'<a href="http://%3Cscript%3E">Attack</a> [&lt;script&gt;]'
u'<img src="&lt;script&gt;foo&lt;/script&gt;"></img><div
style="display:none">&lt;script&gt;foo&lt;/script&gt;</div>'

instead, it yields:

u'<a href="http://%3Cscript%3E">Attack</a> [<script>]'
u'<img src="<script>foo</script>"></img><div
style="display:none">&lt;script&gt;foo&lt;/script&gt;</div>'

What version of the product are you using? On what operating system?

postmarkup 1.0.7

Please provide any additional information below.

I've included a possible patch for the vulnerabilities, but you may wish to
test them, as I have not tested this patch extensively.

Original issue reported on code.google.com by [email protected] on 8 May 2008 at 11:35

Attachments:

1.2.1 release made in secret?

I noticed that Postmark version 1.2.1 appeared in PyPI recently, but the Google 
Code project only has 1.2.0 in downloads, nor have there been any commits to 
version control since 2012.

If there's a new "home" for Postmarkup then please update relevant links and 
add a notice to Google Code.

Original issue reported on code.google.com by [email protected] on 3 Jun 2014 at 3:38

Complete bbcode usage document

Would it be possible to provide a bit of documentation that could serve as
a BBCode usage guide or primer?  There are two cases for doing this:
 1.) Giving developers a list of all of the tags that are implemented and
their semantics
 2.) Give something for end users to learn BBCode from (e.g. on a site that
uses Postmarkup, the developer could link to the document to instruct users
on how Postmarkup's BBCode works)

The only way I could see exactly which tags were implemented was to inspect
postmarkup.create().tags or look at the source code.  Using a general
purpose BBCode guide (like
http://www.phpbb.com/community/faq.php?mode=bbcode) isn't a good option
because it lists some tags which are not implemented in postmarkup or may
have different options / meanings.

I've attached a little script that generates such a page (pardon the
hackiness) as well as the output.  When new features / tags are implemented
you can easily add a new example or section to the doc generator.

Original issue reported on code.google.com by skryskalla on 29 Aug 2007 at 8:22

Attachments:

phpBB style tags?

Would it be possible to add the regexes to support the new phpBB style tags?

They use the initial tag, then a string, such as

This is a [i:3n12v252]test[/i:3n12v252]  rather than simply This is a 
[i]test[/i].

The string is a bbcode ID, which could be safely ignored, and just treat it as 
it it wasn't there.

Original issue reported on code.google.com by [email protected] on 26 Jan 2012 at 11:31

FEATURE: isolate the HTML from the tag generation logic

The basic idea is to allow overriding the HTML of tags easily without 
duplicating other logic like escaping harmful contents.

It is useful if you want to use a framework like jQuery to assign CSS rulesets 
(aka classes) as to than manipulate BBCode generated contents e.g. shrink 
pictures to fit page.

Here is an example for the ImgTag - html is isolated in the get_pattern() 
method.

  def get_pattern(self):
    return u'<div class="BBImage" ><img src="%%s" /></div>'
  def render_open(self, parser, node_index):

      contents = self.get_contents(parser)
      self.skip_contents(parser)

      # Validate url to avoid any XSS attacks
      if self.params:
          url = self.params.strip()
      else:
          url = postmarkup.strip_bbcode(contents)

      url = url.replace(u'"', "%22").strip()
      if not url:
          return u''
      scheme, netloc, path, params, query, fragment = urlparse(url)
      if not scheme:
          url = 'http://' + url
          scheme, netloc, path, params, query, fragment = urlparse(url)
      if scheme.lower() not in ('http', 'https', 'ftp'):
          return u''

      return self.get_pattern() % postmarkup.PostMarkup.standard_replace_no_break(url)  

Original issue reported on code.google.com by [email protected] on 6 Sep 2011 at 1:44

URL escaping bugs

Two bugs I've run into:

(1) A URL with a & (or &amp;) always ends up with a ; in the final URL -- that 
is, it ends up (as far as Firefox is concerned) as &;

(2) # gets escaped. This of course breaks it.

Original issue reported on code.google.com by [email protected] on 25 Dec 2011 at 9:39

urlencoded unicode string causes crash in urllib.quote

What steps will reproduce the problem?

test program:
from postmarkup import render_bbcode
test_str =
u'http://www.google.com/search?as_q=bbcode&btnG=%D0%9F%D0%BE%D0%B8%D1%81%D0%BA'
print render_bbcode(test_str)

What is the expected output? What do you see instead?

expected: a href="http://www.google.com/..." and so on
i see: 
<code>
andrey@panda:~/public_html/test$ python test.py
/usr/lib/python2.5/urllib.py:1205: UnicodeWarning: Unicode equal comparison
failed to convert both arguments to Unicode - interpreting them as being
unequal
  res = map(safe_map.__getitem__, s)
Traceback (most recent call last):
  File "test.py", line 5, in <module>
    print render_bbcode(test_str)
  File "/home/andrey/public_html/test/postmarkup.py", line 149, in
render_bbcode
    return _postmarkup(bbcode, encoding, exclude_tags=exclude_tags,
auto_urls=auto_urls)
  File "/home/andrey/public_html/test/postmarkup.py", line 997, in
render_to_html
    node_text = node_text(i)
  File "/home/andrey/public_html/test/postmarkup.py", line 867, in call
    return tag.render_open(parser, node_index)
  File "/home/andrey/public_html/test/postmarkup.py", line 291, in render_open
    self.url= unicode( urlunparse([quote(component, safe='/=&?:+') for
component in url_parsed]) )
  File "/usr/lib/python2.5/urllib.py", line 1205, in quote
    res = map(safe_map.__getitem__, s)
KeyError: u'\xd0'
</code>

What version of the product are you using? On what operating system?
postmarkup-1.1.0.zip    Postmarkup 1.1.0 source    Featured
python 2.5, Linux version 2.6.24-19-generic (buildd@terranova) (gcc version
4.2.3 (Ubuntu 4.2.3-2ubuntu7))


Please provide any additional information below.
The input is a valid urlencoded link, with non-ascii characters though.

Original issue reported on code.google.com by [email protected] on 22 Sep 2008 at 6:43

AssertionError in render_bbcode('[center][img]url[/center]')

from postmarkup import render_bbcode
print render_bbcode('[center][img]url[/center]')

Traceback (most recent call last):
  File "D:\test_pm.py", line 2, in <module>
    print render_bbcode('[center][img]url[/center]')
  File "D:\postmarkup.py", line 1214, in render_bbcode
    tag_data=tag_data)
  File "D:\postmarkup.py", line 1170, in render_to_html
    node_text = node_text(i)
  File "D:\postmarkup.py", line 1034, in call
    return tag.render_open(parser, node_index)
  File "D:\postmarkup.py", line 413, in render_open
    self.skip_contents(parser)
  File "D:\postmarkup.py", line 186, in skip_contents
    parser.skip_to_node(self.close_node_index)
  File "D:\postmarkup.py", line 697, in skip_to_node
    assert node_index is not None, "Node index must be non-None"
AssertionError: Node index must be non-None2. 

patch fixes this problem, but breaks one of the tests:
'[b]bold [u]both[/b] underline[/u]' == '<strong>bold <u>both</u></strong> 
underline'
instead
'[b]bold [u]both[/b] underline[/u]' == '<strong>bold <u>both</u></
strong><u> underline</u>'

Original issue reported on code.google.com by [email protected] on 23 Dec 2009 at 6:39

Attachments:

[url] inside [code]

What steps will reproduce the problem?
1. xhtml = render_bbcode('[code]http://bla.com[/code]'
2. xhtml will be <div class="code"><pre>[url]http://bla.com[/url]</pre></div>
3. [url]http://bla.com[/url] should be <a 
href="http://bla.com">http://bla.com</a>

What is the expected output? What do you see instead?
Expected output is <div class="code"><pre><a 
href="http://bla.com">http://bla.com</a></pre></div>

What version of the product are you using? On what operating system?
python 2.7, postmarkup 1.1.4

Please provide any additional information below.

n/a

Original issue reported on code.google.com by [email protected] on 8 Apr 2011 at 6:01

ImgTag is vulnerable on XSS attacks

What steps will reproduce the problem?
ImgTag class doesn't validate the url.
Here are some examples of IMG xss attacks http://ha.ckers.org/xss.html

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?
1.1.5dev

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 19 Feb 2009 at 12:55

Big performance problem

What steps will reproduce the problem?
1. render_bbcode with big string (i.e. 200Kb)

What is the expected output? What do you see instead?
I expect rendering 200Kb string for 0.2s, but it rendering for 42s. I have a 
patch, here is the test results:

In [1]: from postmarkup import parser
In [2]: from poetry.models import BookContent
In [3]: content = BookContent.objects.get(id=156).content
In [4]: %timeit parser.render_bbcode(content)
1 loops, best of 3: 41.8 s per loop

In [5]: parser.TEST = False
In [6]: %timeit parser.render_bbcode(content)                                   


10 loops, best of 3: 156 ms per loop

In [7]: len(content)
Out[7]: 238660

In [8]: test2 = parser.render_bbcode(content)                                   

In [9]: parser.TEST = True
In [10]: test1 = parser.render_bbcode(content)                                  


In [11]: test1 == test2
Out[11]: True



What version of the product are you using? On what operating system?
postmarkup 1.2.0

Please provide any additional information below.

Original issue reported on code.google.com by frolvlad on 7 Jan 2012 at 10:02

Attachments:

Whitespace in attributes breaks some tags

vBulletin allows whitespace in screen names, so [QUOTE=Joe Foo] can occur.

Postmarkup checks for attributes by first splitting spaces, then equal signs, 
so this gets tokenized as a "quote=joe" tag with a "Foo" attribute and 
therefore isn't rendered as intended.

This patch reverses the order. I'm not aware of any tags this would break:


--- a/src/postmarkup.py
+++ b/src/postmarkup.py
@@ -1164,16 +1164,15 @@ class PostMarkup(object):

             elif tag_type == TOKEN_TAG:
                 tag_token = tag_token[1:-1].lstrip()
-                if ' ' in tag_token:
+                if '=' in tag_token:
+                    tag_name, tag_attribs = tag_token.split(u'=', 1)
+                    tag_attribs = tag_attribs.strip()
+                elif ' ' in tag_token:
                     tag_name, tag_attribs = tag_token.split(u' ', 1)
                     tag_attribs = tag_attribs.strip()
                 else:
-                    if '=' in tag_token:
-                        tag_name, tag_attribs = tag_token.split(u'=', 1)
-                        tag_attribs = tag_attribs.strip()
-                    else:
-                        tag_name = tag_token
-                        tag_attribs = u""
+                    tag_name = tag_token
+                    tag_attribs = u""
             else:
                 tag_token = tag_token[1:-1].lstrip()
                 tag_name, tag_attribs = tag_token.split(u'=', 1)

Original issue reported on code.google.com by [email protected] on 17 Jul 2010 at 1:44

PygmentsCodeTag returns <br>'ed values on ClassNotFound

in v1.1.4:

>>> import postmarkup
>>> postmarkup.render_bbcode('[code]asd\nasd[/code]')
u'<div class="code"><pre>asd<br/>asd</pre></div>'

expected output:
u'<div class="code"><pre>asd\nasd</pre></div>'

Behaviour is wrong and also inconsistent with CodeTag. patch attached.

Original issue reported on code.google.com by [email protected] on 25 Sep 2009 at 9:47

Attachments:

Attribute error when parsing malformed URL

What steps will reproduce the problem?
1. Feed some plain text with an invalid URL of the form: http:\\something.com 
(i.e. use the wrong slashes) to postmarkup. 

What is the expected output? What do you see instead?

I would expect postmarkup to not try to produce an <a> tag for bad URL. However 
it does, and an AttributeError is seen instead. Here is the bottom part of a 
stack trace (the first level shown is my code calling postmarkup):

  ...
  File "legacy/management/commands/import_old_posts.py", line 103, in to_html
    return self.bb_parser.render_to_html(unphpbb(s), cosmetic_replace=False)
  File "/home/brian/coding/python/django/3rdparty/postmarkup.py", line 1259, in render_to_html
    node_text = node_text(i)
  File "/home/brian/coding/python/django/3rdparty/postmarkup.py", line 1120, in call
    return tag.render_open(parser, node_index)
  File "/home/brian/coding/python/django/3rdparty/postmarkup.py", line 285, in render_open
    domain = self._re_domain.search(uri.lower()).group(1)
AttributeError: 'NoneType' object has no attribute 'group'

What version of the product are you using? On what operating system?

SVN version, revision 66 on Ubuntu 10.04.

Please provide any additional information below.

I fixed it by applying the following diff to postmarkup.py

283a284,287
>         match = self._re_domain.search(uri.lower())
>         if match is None:
>             return u''
> 
285c289
<             domain = self._re_domain.search(uri.lower()).group(1)

---
>             domain = match.group(1)

Thanks for this great program!

Original issue reported on code.google.com by [email protected] on 31 Dec 2010 at 5:47

Color tag issue

>>> from postmarkup import render_bbcode
>>> render_bbcode("[color]For the lazy, use the render_bbcode function.")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python25\lib\postmarkup.py", line 149, in render_bbcode
    return _postmarkup(bbcode, encoding, exclude_tags=exclude_tags,
auto_urls=au
to_urls)
  File "C:\Python25\lib\postmarkup.py", line 997, in render_to_html
    node_text = node_text(i)
  File "C:\Python25\lib\postmarkup.py", line 867, in call
    return tag.render_open(parser, node_index)
  File "C:\Python25\lib\postmarkup.py", line 535, in render_open
    color = self.params.split()[0:1][0].lower()
IndexError: list index out of range

Issue occurs if you have not specified the color - "[code]", not
"[code=somecolor]".

Best regards,
Krzysztof Jagiello

Original issue reported on code.google.com by [email protected] on 19 Jan 2009 at 4:07

Support [img=] syntax, currently raises AssertionError

What steps will reproduce the problem?

postmarkup.render_bbcode('[url=http://www.google.com/][img=http://google.com/ima
ges/logo.gif][/url]')

What is the expected output? What do you see instead?

Expeced: <a href="http://www.google.com/"><img 
src="http://google.com/images/logo.gif"></img></a> [google.com]

AssertionError: Node index must be non-None

What version of the product are you using? On what operating system?

1.1.4

Please provide any additional information below.

I came across this issue while importing bbcode previously parsed by a 
different bbcode lib (in Ruby).

Original issue reported on code.google.com by [email protected] on 12 Dec 2010 at 9:41

Wrong detection of closed tag?

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 [email protected] on 4 Jan 2011 at 2:26

Improve right alignment tag

What steps will reproduce the problem?

from postmarkup import render_bbcode
render_bbcode("[right]text[/right]")

What is the expected output? What do you see instead?
Expected output: '<div style="text-align: right">text</div>'.
I see: 'text'.

What version of the product are you using? On what operating system?
1.1.5dev, Kubuntu 11.04.

Please provide any additional information below.
This is feature request.


Original issue reported on code.google.com by frolvlad on 6 Mar 2011 at 9:11

Let's develop at github?

Any patch here takes about than a half of hour instead of simple git push.
All my changes stored at https://github.com/frol/postmarkup

Original issue reported on code.google.com by frolvlad on 21 Jan 2012 at 6:16

Link gets messed up by the parser

What steps will reproduce the problem?
1. Get the BBCode parser to run this:
[url=http://www.google.com/coop/cse?cx=006850030468302103399%3Amqxv78bdfdo]CakeP
HP
Google Groups[/url]
2. the link does not work after postmarkup renders it
3.

What is the expected output? What do you see instead?
A working link to
http://www.google.com/coop/cse?cx=006850030468302103399%3Amqxv78bdfdo

What version of the product are you using? On what operating system?
1.0.5, tested on Windows XP and Ubuntu 

Please provide any additional information below.
If I comment out this link, it works like I want---
self.url="http:"+urlunparse( map(quote, (u"",)+url_parsed[1:]) )

Original issue reported on code.google.com by [email protected] on 16 Aug 2007 at 4:11

Make postmarkup support python3

I'd love to see a version of this that supports Python3.

I did a very crude "port" at https://github.com/e1ven/py3-postmarkup

It works well enough for my basic needs.

Threepwood:libs e1ven$ python3
Python 3.2.1 (default, Dec  7 2011, 12:17:14) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import postmarkup
>>> xhtml = postmarkup.render_bbcode("[b]For the lazy, use the render_bbcode 
function.[/b]")
>>> print(xhtml)
<strong>For the lazy, use the render_bbcode function.</strong>
>>> exit



Original issue reported on code.google.com by [email protected] on 7 Dec 2011 at 7:17

Graceful handling of invalid [img] URLs / schemas

What steps will reproduce the problem?

from postmarkup import render_bbcode
render_bbcode('[img]foo[/img')  # or '[img]fo[o[/img]'

What is the expected output? What do you see instead?

Output: ValueError: Invalid IPv6 URL

Expected: u'' (or u'foo' / u'fo[o')

What version of the product are you using? On what operating system?

1.2.0

Original issue reported on code.google.com by [email protected] on 14 Nov 2012 at 3:45

HTML entities

I prefer not to substitute html entities so I changed:

standard_replace = MultiReplace({'<':'&lt;', '>':'&gt;', '&':'&amp;',
'\n':'<br/>'})

with:

standard_replace = MultiReplace({'<':'&lt;', '>':'&gt;', '&(?!#)':'&amp;',
'\n':'<br/>'})

Ciao.
Marco.

Original issue reported on code.google.com by [email protected] on 10 Jul 2008 at 4:31

Quote, color and text

I have a problem with using quote, color and text tags in one document.

Here it is my code:
import postmarkup

value = """
[quote][color=#499de8]test color[/color]

some quote text[/quote]
"""
print postmarkup.render_bbcode(value)

I have in result:
<br/><blockquote><span style="color:#499de8">test color</span>some quote
text</blockquote>

I expect <br /> between "test color" and "some quote text".

Try to remove color tag or quote tag - everything is fine. Postmarkup will
add a <br />.

I have tested it on 1.1.4 and 1.1.5dev.

Thanks.

Original issue reported on code.google.com by [email protected] on 19 Oct 2009 at 1:30

Cleaning tags with spaces

What steps will reproduce the problem?
1. render_bbcode('[i]one[/i][i]   [/i][i]two[/i][i] [/i][i]three[/i]')

What is the expected output? What do you see instead?
Expected: <em>one</em><em>   </em><em>two</em><em> </em><em>three</em>
or: <em>one</em> <em>two</em> <em>three</em>
but I see: <em>one</em><em>two</em><em>three</em>

What version of the product are you using? On what operating system?
postmarkup 1.2.0

Please provide any additional information below.

Original issue reported on code.google.com by frolvlad on 7 Jan 2012 at 7:34

Support local links

What steps will reproduce the problem?
1. [link=/photos/]See photos here[/link]

What is the expected output? What do you see instead?
Expected: <a href="/photos/">See photos here</a>
I see instead: See photos here

What version of the product are you using? On what operating system?


Please provide any additional information below.

Patch in attachment

Original issue reported on code.google.com by frolvlad on 21 Jan 2012 at 6:12

Attachments:

cirilic url bug

if i have in text:

http://fly-fishing.ru/shop/search/?q=подсачек

it converts to 

http://fly-fishing.ru/shop/search/?q=CFCEC4D1C0D7C5CA

but it must converts to 

http://fly-fishing.ru/shop/search/?q=%D0%BF%D0%BE%D0%B4%D1%81%D0%B0%D1%87%D0%B5%
D0%BA

test it bug in 1.2.0 and 1.2.1

Original issue reported on code.google.com by [email protected] on 3 Oct 2014 at 12:08

Code duplicate

The use of the [code] tags causes the code to be duplicated, once for the
pygmented version, and then one in a non-displayed div. I'm using this in
an rss feed and it's showing up twice :(

Is there any way to prevent it from producing the duplicate?

Original issue reported on code.google.com by davy.wybiral on 14 Jun 2008 at 1:28

Do not insert <br> within <pre> tag

What steps will reproduce the problem?
1. Write a BBCode document that includes [code] block
2. Convert to XHTML
3. Not <br> tags inside <pre> tags.

What is the expected output? What do you see instead?

Expected output is verbatim copy of the text within the [code] tags.


What version of the product are you using? On what operating system?

Python 2.7.1 / postmarkup 1.1.4


Please provide any additional information below.

n/a

Original issue reported on code.google.com by [email protected] on 15 Jan 2011 at 1:57

support for [color=] and [size=]

This is an enhancement request, not a bug.

postmarkup doesn't support [color=] or [size=] tags.  I've written a simple
ColorTag implementation that seems to work.  The implementation of size is
probably exactly the same.

class ColorTag(TagBase):
    def __init__(self, name):
        TagBase.__init__(self, name)        

    def open(self, open_pos):
        """Called to render the opened tag."""
        if self.params:
            return u'<span style="color:%s">' % self.params
        else:
            return u''

    def close(self, close_pos, content):
        """Called to render the closed tag."""
        if self.params:
            return u'</span>'
        else:
            return u''


Some validation should probably be done on the params to prevent unwanted
styles from sneaking into the span.

Original issue reported on code.google.com by [email protected] on 29 Aug 2007 at 6:28

render unsupported tags as text

It would be nice to have an option to not swallow unsupported tags. For 
instance, if someone put [REDACTED] in a comment, it would disappear for no 
apparent reason. I've attached a patch that modifies the tokenizer to check 
for supported tags, and yield TOKEN_TEXT instead of TOKEN_TAG if a tag is not 
supported. The code could be refactored a bit, and be made an option, but it 
gets the job done.

The patch also allows you to pass tag_factory through create. My first 
approach was to use a custom tag factory, which didn't work, but it would 
probably still be a good addition.

Original issue reported on code.google.com by [email protected] on 26 Aug 2009 at 5:36

Attachments:

Unnecessary extra tags

What steps will reproduce the problem?
1. Render text: "[center]text[/center]" with option paragraphs=True

What is the expected output? What do you see instead?
I expected:
<div style="text-align:center;">text</div>
But I see:
<p><div style="text-align:center;">text</div></p><p></p>

What version of the product are you using? On what operating system?
svn-trunk, linux

Please provide any additional information below.

I have other similar issue, but I don't know if this is a bug:

1. Render text: "text1[center]text[/center]" with option paragraphs=True

I expected:
<p>text1</p><div style="text-align:center;">text</div>
But I see:
<p>text1<div style="text-align:center;">text</div></p><p></p>

Original issue reported on code.google.com by frolvlad on 14 Feb 2012 at 9:41

\n in code tag

What steps will reproduce the problem?
[code]
print 1



print 2
[/code]


result will be html with only 2 <br></br>

postmarkup droping new lines in code tag

Original issue reported on code.google.com by [email protected] on 6 Feb 2013 at 12:52

URL not properly escaped

If the HREF of an anchor contains & instead of &amp; most X(HT)ML parsers will 
die.

309c309
<             return u'<a href="%s">'%self.url

---
>             return u'<a href="%s">'%PostMarkup.standard_replace(self.url)

Original issue reported on code.google.com by [email protected] on 1 Jul 2010 at 12:04

Annotate link docs

Hey, if it's not too much trouble, can you give a small example of how to
override annotate link in the wiki? Either way, thanks for this module,
it's been very helpful.

Original issue reported on code.google.com by [email protected] on 26 Aug 2007 at 7:15

Suggestion: Relative URL option

It would be nice if Postmarkup could allow the specification of a base URL. 
Instead of relative URLs failing, then, they would be relative to a specified 
URL.

Original issue reported on code.google.com by [email protected] on 25 Dec 2011 at 9:45

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.