Exemplo n.º 1
0
def typogrify(data):
    if typo is None:
        req_missing(['typogrify'], 'use the typogrify filter')

    data = typo.amp(data)
    data = typo.widont(data)
    data = typo.smartypants(data)
    # Disabled because of typogrify bug where it breaks <title>
    # data = typo.caps(data)
    data = typo.initial_quotes(data)
    return data
Exemplo n.º 2
0
def typogrify(data):
    global typogrify_filter
    if typo is None:
        raise Exception("To use the typogrify filter, you need to install typogrify.")
    data = typo.amp(data)
    data = typo.widont(data)
    data = typo.smartypants(data)
    # Disabled because of typogrify bug where it breaks <title>
    #data = typo.caps(data)
    data = typo.initial_quotes(data)
    return data
Exemplo n.º 3
0
def typogrify_sans_widont(data):
    # typogrify with widont disabled because it caused broken headline
    # wrapping, see issue #1465
    if typo is None:
        req_missing(['typogrify'], 'use the typogrify_sans_widont filter')

    data = typo.amp(data)
    data = typo.smartypants(data)
    # Disabled because of typogrify bug where it breaks <title>
    # data = typo.caps(data)
    data = typo.initial_quotes(data)
    return data
Exemplo n.º 4
0
def typogrify(data):
    """Prettify text with typogrify."""
    if typo is None:
        req_missing(["typogrify"], "use the typogrify filter")

    data = typo.amp(data)
    data = typo.widont(data)
    data = typo.smartypants(data)
    # Disabled because of typogrify bug where it breaks <title>
    # data = typo.caps(data)
    data = typo.initial_quotes(data)
    return data
Exemplo n.º 5
0
def applyfilters(text):
    """Applies the following filters: smartypants, caps, amp, initial_quotes

    >>> typogrify('<h2>"Jayhawks" & KU fans act extremely obnoxiously</h2>')
    '<h2><span class="dquo">&#8220;</span>Jayhawks&#8221; <span class="amp">&amp;</span> <span class="caps">KU</span> fans act extremely&nbsp;obnoxiously</h2>'
    """
    text = amp(text)
    text = smartypants(text)
    text = caps(text)
    text = initial_quotes(text)

    return text
Exemplo n.º 6
0
def typogrify_sans_widont(data):
    """Prettify text with typogrify, skipping the widont filter."""
    # typogrify with widont disabled because it caused broken headline
    # wrapping, see issue #1465
    if typo is None:
        req_missing(["typogrify"], "use the typogrify_sans_widont filter")

    data = typo.amp(data)
    data = typo.smartypants(data)
    # Disabled because of typogrify bug where it breaks <title>
    # data = typo.caps(data)
    data = typo.initial_quotes(data)
    return data
Exemplo n.º 7
0
def typogrify(data):
    """Prettify text with typogrify."""
    if typo is None:
        req_missing(['typogrify'], 'use the typogrify filter', optional=True)
        return data

    data = _normalize_html(data)
    data = typo.amp(data)
    data = typo.widont(data)
    data = typo.smartypants(data)
    # Disabled because of typogrify bug where it breaks <title>
    # data = typo.caps(data)
    data = typo.initial_quotes(data)
    return data
Exemplo n.º 8
0
def typogrify_sans_widont(data):
    """Prettify text with typogrify, skipping the widont filter."""
    # typogrify with widont disabled because it caused broken headline
    # wrapping, see issue #1465
    if typo is None:
        req_missing(['typogrify'], 'use the typogrify_sans_widont filter')

    data = _normalize_html(data)
    data = typo.amp(data)
    data = typo.smartypants(data)
    # Disabled because of typogrify bug where it breaks <title>
    # data = typo.caps(data)
    data = typo.initial_quotes(data)
    return data
Exemplo n.º 9
0
def typogrify(data):
    """Prettify text with typogrify."""
    if typo is None:
        req_missing(['typogrify'], 'use the typogrify filter', optional=True)
        return data

    data = _normalize_html(data)
    data = typo.amp(data)
    data = typo.widont(data)
    data = typo.smartypants(data)
    # Disabled because of typogrify bug where it breaks <title>
    # data = typo.caps(data)
    data = typo.initial_quotes(data)
    return data
Exemplo n.º 10
0
def typogrify_no_widont(value):
    value = Typogrify.amp(value)
    value = Typogrify.smartypants(value)
    value = Typogrify.caps(value)
    value = Typogrify.initial_quotes(value)
    return value
Exemplo n.º 11
0
def typogrify_no_widont(value):
    value = Typogrify.amp(value)
    value = Typogrify.smartypants(value)
    value = Typogrify.caps(value)
    value = Typogrify.initial_quotes(value)
    return value