MobileBlur

Diff
Login

Diff

Differences From Artifact [4b3f535252]:

To Artifact [b5f7ebf604]:


1

2
3
4
5
6
7
8
#!/usr/bin/env python                                                                                                        # created my Massimo Di Pierro

# license MIT/BSD/GPL
import re
import cgi

__all__ = ['render', 'markmin2html']

__doc__ = """
|
>







1
2
3
4
5
6
7
8
9
#!/usr/bin/env python 
# created my Massimo Di Pierro
# license MIT/BSD/GPL
import re
import cgi

__all__ = ['render', 'markmin2html']

__doc__ = """
393
394
395
396
397
398
399

400

401
402
403
404
405
406
407
    #############################################################
    # deal with paragraphs (trick <<ul, <<ol, <<table, <<h1, etc)
    # the << indicates that there should NOT be a new paragraph
    # META indicates a code block therefore no new paragraph
    #############################################################
    items = [item.strip() for item in text.split('\n\n')]
    if sep=='p':

        text = ''.join(p[:2]!='<<' and p!=META and '<p>%s</p>'%p or '%s'%p for p in items if p)

    elif sep=='br':
        text = '<br />'.join(items)

    #############################################################
    # finally get rid of <<
    #############################################################
    text=text.replace('<<','<')







>
|
>







394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
    #############################################################
    # deal with paragraphs (trick <<ul, <<ol, <<table, <<h1, etc)
    # the << indicates that there should NOT be a new paragraph
    # META indicates a code block therefore no new paragraph
    #############################################################
    items = [item.strip() for item in text.split('\n\n')]
    if sep=='p':
        text = ''.join(
            (p[:2]!='<<' and p!=META and '<p>%s</p>'%p or '%s'%p) \
                for p in items if p.strip())
    elif sep=='br':
        text = '<br />'.join(items)

    #############################################################
    # finally get rid of <<
    #############################################################
    text=text.replace('<<','<')
449
450
451
452
453
454
455

        fargv = open(sys.argv[1],'r')
        try:
            print '<html><body>'+markmin2html(fargv.read())+'</body></html>'
        finally:
            fargv.close()
    else:
        doctest.testmod()








>
452
453
454
455
456
457
458
459
        fargv = open(sys.argv[1],'r')
        try:
            print '<html><body>'+markmin2html(fargv.read())+'</body></html>'
        finally:
            fargv.close()
    else:
        doctest.testmod()