Full Code of fcurella/django-social-share for AI

master 57834ed60f9f cached
33 files
38.1 KB
10.3k tokens
51 symbols
1 requests
Download .txt
Repository: fcurella/django-social-share
Branch: master
Commit: 57834ed60f9f
Files: 33
Total size: 38.1 KB

Directory structure:
gitextract_08i4p9oj/

├── .bumpversion.cfg
├── .github/
│   ├── FUNDING.yml
│   └── workflows/
│       ├── gh-release.yml
│       └── pythonpackage.yml
├── .gitignore
├── CODE_OF_CONDUCT.md
├── LICENSE
├── MANIFEST.in
├── Makefile
├── README.rst
├── VERSION
├── django_social_share/
│   ├── __init__.py
│   ├── models.py
│   ├── templates/
│   │   └── django_social_share/
│   │       └── templatetags/
│   │           ├── copy_script.html
│   │           ├── copy_to_clipboard.html
│   │           ├── pinterest_script.html
│   │           ├── post_to_facebook.html
│   │           ├── post_to_gplus.html
│   │           ├── post_to_linkedin.html
│   │           ├── post_to_reddit.html
│   │           ├── post_to_telegram.html
│   │           ├── post_to_twitter.html
│   │           ├── post_to_whatsapp.html
│   │           ├── save_to_pinterest.html
│   │           └── send_email.html
│   ├── templatetags/
│   │   ├── __init__.py
│   │   └── social_share.py
│   ├── tests/
│   │   ├── __init__.py
│   │   ├── runtests.py
│   │   └── tests.py
│   └── views.py
├── setup.cfg
└── setup.py

================================================
FILE CONTENTS
================================================

================================================
FILE: .bumpversion.cfg
================================================
[bumpversion]
files = VERSION django_social_share/__init__.py
commit = True
tag = True
current_version = 2.3.0


================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms

github: @fcurella
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: pypi/django-social-hare
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']


================================================
FILE: .github/workflows/gh-release.yml
================================================
on:
  push:
    # Sequence of patterns matched against refs/tags
    tags:
      - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Create Release

jobs:
  build:
    name: Create Release
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
        with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref }}
          draft: false
          prerelease: false


================================================
FILE: .github/workflows/pythonpackage.yml
================================================
name: Python build

on: [push]

jobs:
  tests:

    runs-on: ubuntu-latest
    strategy:
      max-parallel: 4
      matrix:
        python-version: [3.6, 3.7, 3.8]
        django-version:
          - "Django>=2.0,<2.1"
          - "Django>=2.1,<2.2"
          - "Django>=2.2,<3.0"
          - "Django>=3.0,<3.1"

    steps:
    - uses: actions/checkout@v2
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v1
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -q "${{ matrix.django-version }}"
        pip install -e .
        pip install coveralls
    - name: Test with pytest
      env:
        COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
      run: |
        coverage run --source django_social_share setup.py test && coveralls


================================================
FILE: .gitignore
================================================
*.egg-info
*.pot
*.py[co]
*.out
.eggs
.cache
.coverage
parsetab.py
__pycache__
MANIFEST
dist/
docs/_build/
docs/locale/
node_modules/
tests/coverage_html/
tests/.coverage
build/
tests/report/
.idea


================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at community@curella.org. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/


================================================
FILE: LICENSE
================================================
Copyright (C) 2011 by Flavio Curella

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

================================================
FILE: MANIFEST.in
================================================
include README.rst
include LICENSE
include VERSION
recursive-include tests *.py
recursive-include django_social_share/templates *


================================================
FILE: Makefile
================================================
release:
	rm -rf dist
	python setup.py sdist bdist_wheel
	twine upload dist/*


================================================
FILE: README.rst
================================================
Django Social Share
======================================

.. image:: https://github.com/fcurella/django-social-share/workflows/Python%20build/badge.svg

.. image:: https://coveralls.io/repos/github/fcurella/django-social-share/badge.svg?branch=master
    :target: https://coveralls.io/github/fcurella/django-social-share?branch=master

Provides templatetags for:

* 'Tweet This'
* 'Share this on Facebook'
* 'Share on Google+'
* 'Share on LinkedIn'
* 'Share on Telegram'
* 'Share on WhatsApp'
* 'mailto://'.
* 'Save to Pinterest'
* 'Copy to Clipboard'

Plain HTML templates_ are provided for your convenience, but you can override them to provide your own look and feel.

Installation
-------------

::

    $ python -m pip install django-social-share

Add the app to ``INSTALLED_APPS``::

    INSTALLED_APPS += ['django_social_share']

You will also have to add ``django.template.context_processors.request`` to your ``context_processors`` list. This way the templatetags will use the correct scheme and hostname::

    TEMPLATES=[
        {
            'BACKEND': 'django.template.backends.django.DjangoTemplates',
            'DIRS': [
                os.path.join(BASE_DIR, 'templates'),
            ],
            'OPTIONS': {
                'context_processors': [
                    'django.template.context_processors.request',
                ],
            }
        },
    ]
    
Note in most cases sharing will not work if you are using ``localhost`` or your domain is otherwise not accessible from the public internet. For testing local development, you can use a service like ngrok_, and set your `Site instance <https://docs.djangoproject.com/en/3.0/ref/contrib/sites/>`_'s ``domain`` to the hostname provided by ``ngrok``.

.. _ngrok: https://ngrok.com/

Usage
-----

First, add ``{% load social_share %}`` to your HTML template.
This tag should be placed at the top of most of your HTML document and should come before any other template tag unless otherwise.

`django-social-share` provides two types of template tags: "snippet" tags and "context" tags.

Snippet Tags
~~~~~~~~~~~~

Snippet tags returns HTML that you can just drop in your templates. This snippets are customizable, see templates_
.

Available Snippets Tags:

::

  {% post_to_facebook <object_or_url> <link_text> <link_class> %}
  
  {% post_to_gplus <object_or_url> <link_text> <link_class> %}
  
  {% post_to_twitter <text_to_post> <object_or_url> <link_text> <link_class> %}
  
  {% post_to_linkedin <object_or_url> <link_class> %}
    
  {% post_to_reddit <text_to_post> <object_or_url> <link_text> <link_class> %}

  {% post_to_telegram <text_to_post> <object_or_url> <link_text>  <link_class> %}

  {% post_to_whatsapp <object_or_url> <link_text> <link_class> %}

  {% save_to_pinterest <object_or_url>  <link_class> %}

  {% add_pinterest_script %}

``<text_to_post>`` may contain any valid Django Template code. Note that Facebook does not support this anymore.

``<object_or_url>`` is optional (except Telegram). If you pass a django model instance, it will use its ``get_absolute_url`` method. Additionally, if you have ``django_bitly`` installed, it will use its shortUrl on Twitter.

``<link_text>`` is also optional. It defines the text used for the ``a`` element. Defaults to 'Post to Facebook' and 'Post to Twitter'.

Example::

  {% load social_share %}
  
  {% post_to_facebook object_or_url "Post to Facebook!" %}
  {% post_to_twitter "New Song: {{object.title}}. Check it out!" object_or_url "Post to Twitter" %}
  {% post_to_gplus object_or_url "Post to Google+!" %}
  {% post_to_linkedin object_or_url %}
  {% send_email object.title "New Song: {{object.title}}. Check it out!" object_or_url "Share via email" %}
  {% post_to_reddit "New Song: {{object.title}}" <object_or_url> %}
  {% post_to_telegram "New Song: {{object.title}}" <object_or_url> %}
  {% post_to_whatsapp object_or_url "Share via WhatsApp" %}
  {% save_to_pinterest object_or_url %}
  {% add_pinterest_script %} // Required for save_to_pinterest. Add to the end of body tag.

.. _templates:

Templates
---------

Templates for snippet tags are in:

* ``django_social_share/templatetags/post_to_twitter.html``
* ``django_social_share/templatetags/post_to_facebook.html``
* ``django_social_share/templatetags/post_to_gplus.html``
* ``django_social_share/templatetags/send_email.html``
* ``django_social_share/templatetags/post_to_linkedin.html``
* ``django_social_share/templatetags/post_to_reddit.html``.
* ``django_social_share/templatetags/post_to_telegram.html``.
* ``django_social_share/templatetags/post_to_whatsapp.html``.
* ``django_social_share/templatetags/save_to_pinterest.html``.
* ``django_social_share/templatetags/pinterest_script.html``.
* ``django_social_share/templatetags/copy_to_clipboard.html``.
* ``django_social_share/templatetags/copy_script.html``.
  
You can override them to suit your mileage.

Context Tags
~~~~~~~~~~~~

Context Tags work by adding a variable to your template's context. This variable will containg just the URL to service's share feature, which you can use into your template as you wish.

Available Context Tags:

============================================================================= =================
Tag example                                                                   Variable name
============================================================================= =================
``{% post_to_twitter_url <text_to_post> <object_or_url> %}``                  ``tweet_url``
``{% post_to_facebook_url <object_or_url> %}``                                ``facebook_url``
``{% post_to_gplus_url <object_or_url> %}``                                   ``gplus_url``
``{% send_email_url <subject> <text_to_post> <object_or_url> <link_text> %}`` ``mailto_url``
``{% post_to_reddit_url <text> <object_or_url> %}``                           ``reddit_url``
``{% post_to_telegram <text> <object_or_url> %}``                             ``telegram_url``
``{% post_to_whatsapp_url <object_or_url> %}``                                ``whatsapp_url``
``{% save_to_pinterest_url <object_or_url> %}``                               ``pinterest_url``
``{% copy_to_clipboard <object_or_url> <link_text> <link_class> %}``          ``copy_url``

``<text_to_post>`` may contain any valid Django Template code. Note that Facebook does not support this anymore.

``<object_or_url>`` is optional (except Telegram). If you pass a django model instance, it will use its ``get_absolute_url`` method. Additionally, if you have ``django_bitly`` installed, it will use its shortUrl on Twitter.

``<link_text>`` is also optional. It defines the text used for the ``a`` element. Defaults to 'Post to Facebook' and 'Post to Twitter'.

Example::

  {% load social_share %}
  
  {% post_to_facebook object_or_url "Post to Facebook!" %}
  {% post_to_twitter "New Song: {{object.title}}. Check it out!" object_or_url "Post to Twitter" %}
  {% post_to_gplus object_or_url "Post to Google+!" %}
  {% post_to_linkedin object_or_url %}
  {% send_email object.title "New Song: {{object.title}}. Check it out!" object_or_url "Share via email" %}
  {% post_to_reddit "New Song: {{object.title}}" <object_or_url> %}
  {% post_to_telegram "New Song: {{object.title}}" <object_or_url> %}
  {% post_to_whatsapp object_or_url "Share via WhatsApp" %}
  {% save_to_pinterest object_or_url %}
  {% add_pinterest_script %} // Required for save_to_pinterest. Add to the end of body tag.
  {% copy_to_clipboard object_or_url "Copy to clipboard!" %}
  {% add_copy_script %} // Required for copy_to_clipboard. Add to the end of body tag.

Issues
------

If you have any issues, please use `GitHub's issues <https://github.com/fcurella/django-social-share/issues>`_.
Please refrain from emailing the author.


================================================
FILE: VERSION
================================================
2.3.0

================================================
FILE: django_social_share/__init__.py
================================================
VERSION = tuple(map(int, "2.3.0".split('.')))


================================================
FILE: django_social_share/models.py
================================================
from django.db import models


================================================
FILE: django_social_share/templates/django_social_share/templatetags/copy_script.html
================================================
<script>
  function copyTextToClipboard(text) {
    var textArea = document.createElement("textarea");

    // Place in the top-left corner of screen regardless of scroll position.
    textArea.style.position = "fixed";
    textArea.style.top = 0;
    textArea.style.left = 0;

    textArea.style.width = "2em";
    textArea.style.height = "2em";

    textArea.style.padding = 0;

    // Clean up any borders.
    textArea.style.border = "none";
    textArea.style.outline = "none";
    textArea.style.boxShadow = "none";

    // Avoid flash of the white box if rendered for any reason.
    textArea.style.background = "transparent";

    textArea.value = text;

    document.body.appendChild(textArea);
    textArea.focus();
    textArea.select();

    try {
      document.execCommand("copy");
    } catch (err) {
      console.log("unable to copy");
    }

    document.body.removeChild(textArea);
  }

  var copyBtn = document.querySelector('[data-copy-btn="buttonCopy"]');

  copyBtn.addEventListener("click", function (event) {
    var url = copyBtn.getAttribute("data-copy-url");
    copyTextToClipboard(url);
  });
</script>


================================================
FILE: django_social_share/templates/django_social_share/templatetags/copy_to_clipboard.html
================================================
<div class="copy-this">
    <button data-copy-btn="buttonCopy" data-copy-url="{{ copy_url }}" class="{{ link_class }}">{{ link_text }}</button>
</div>


================================================
FILE: django_social_share/templates/django_social_share/templatetags/pinterest_script.html
================================================
<script async defer src="https://assets.pinterest.com/js/pinit.js"></script>


================================================
FILE: django_social_share/templates/django_social_share/templatetags/post_to_facebook.html
================================================
<div class="facebook-this">
    <a href="{{ facebook_url }}" class="{{ link_class }}" target="_blank">{{link_text}}</a>
</div>


================================================
FILE: django_social_share/templates/django_social_share/templatetags/post_to_gplus.html
================================================
<div class="gplus-this">
    <a href="{{ gplus_url }}" class="{{ link_class }}" target="_blank">{{link_text}}</a>
</div>


================================================
FILE: django_social_share/templates/django_social_share/templatetags/post_to_linkedin.html
================================================
{% load i18n social_share %}{% get_current_language as LANGUAGE_CODE %}<div class="linkedin-this {{link_class}}">
  <script src="https://platform.linkedin.com/in.js" type="text/javascript">lang: {{ LANGUAGE_CODE|linkedin_locale }}</script>
  <script type="IN/Share" data-url="{{ linkedin_url }}"></script>
</div>


================================================
FILE: django_social_share/templates/django_social_share/templatetags/post_to_reddit.html
================================================
<div class="reddit-this">
    <a href="{{ reddit_url }}" class="{{ link_class }}" target="_blank">{{link_text}}</a>
</div>


================================================
FILE: django_social_share/templates/django_social_share/templatetags/post_to_telegram.html
================================================
<div class="telegram-this">
    <a href="{{ telegram_url }}" class="{{ link_class }}" target="_blank">{{link_text}}</a>
</div>


================================================
FILE: django_social_share/templates/django_social_share/templatetags/post_to_twitter.html
================================================
<div class="tweet-this">
    <a href="{{ tweet_url }}" class="meta-act-link meta-tweet {{link_class}}" target="_blank">{{link_text}}</a>
</div>


================================================
FILE: django_social_share/templates/django_social_share/templatetags/post_to_whatsapp.html
================================================
<div class="whatsapp-this">
    <a href="{{ whatsapp_url }}" class="{{ link_class }}" target="_blank">{{link_text}}</a>
</div>


================================================
FILE: django_social_share/templates/django_social_share/templatetags/save_to_pinterest.html
================================================
<div class="pinterest-this {{ link_class }}">
    <a data-pin-do="buttonPin" {% if pin_count %}data-pin-count="beside" {% endif %}href="{{ pinterest_url }}" target="_blank"></a>
</div>


================================================
FILE: django_social_share/templates/django_social_share/templatetags/send_email.html
================================================
<div class="mail-this">
    <a href="{{ mailto_url|safe }}" class="{{ link_class }}">{{link_text}}</a>
</div>


================================================
FILE: django_social_share/templatetags/__init__.py
================================================


================================================
FILE: django_social_share/templatetags/social_share.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import re

from django import template

from django.db.models import Model
from django.template.defaultfilters import urlencode
from django.utils.safestring import mark_safe

try:
    from django_bitly.templatetags.bitly import bitlify
    DJANGO_BITLY = True
except ImportError:
    DJANGO_BITLY = False


register = template.Library()


TWITTER_ENDPOINT = 'https://twitter.com/intent/tweet?text=%s'
FACEBOOK_ENDPOINT = 'https://www.facebook.com/sharer/sharer.php?u=%s'
GPLUS_ENDPOINT = 'https://plus.google.com/share?url=%s'
MAIL_ENDPOINT = 'mailto:?subject=%s&body=%s'
LINKEDIN_ENDPOINT = 'https://www.linkedin.com/shareArticle?mini=true&title=%s&url=%s'
REDDIT_ENDPOINT = 'https://www.reddit.com/submit?title=%s&url=%s'
TELEGRAM_ENDPOINT = 'https://t.me/share/url?text=%s&url=%s'
WHATSAPP_ENDPOINT = 'https://api.whatsapp.com/send?text=%s'
PINTEREST_ENDPOINT = 'https://www.pinterest.com/pin/create/button/?url=%s'


BITLY_REGEX = re.compile(r'^https?://bit\.ly/')


def compile_text(context, text):
    ctx = template.context.Context(context)
    return template.Template(text).render(ctx)


def _build_url(request, obj_or_url):
    if obj_or_url is not None:
        if isinstance(obj_or_url, Model):
            if DJANGO_BITLY:
                url = bitlify(obj_or_url)  # type: str
                if not BITLY_REGEX.match(url):
                    return request.build_absolute_uri(
                        obj_or_url.get_absolute_url()
                    )
                else:
                    return url
            else:
                return request.build_absolute_uri(obj_or_url.get_absolute_url())
        else:
            return request.build_absolute_uri(obj_or_url)
    return ''


def _compose_tweet(text, url=None):
    TWITTER_MAX_NUMBER_OF_CHARACTERS = 140
    TWITTER_LINK_LENGTH = 23  # "A URL of any length will be altered to 23 characters, even if the link itself is less than 23 characters long.

    # Compute length of the tweet
    url_length = len(' ') + TWITTER_LINK_LENGTH if url else 0
    total_length = len(text) + url_length

    # Check that the text respects the max number of characters for a tweet
    if total_length > TWITTER_MAX_NUMBER_OF_CHARACTERS:
        text = text[:(TWITTER_MAX_NUMBER_OF_CHARACTERS - url_length - 1)] + "…"  # len("…") == 1

    return "%s %s" % (text, url) if url else text


@register.simple_tag(takes_context=True)
def post_to_twitter_url(context, text, obj_or_url=None):
    text = compile_text(context, text)
    request = context['request']

    url = _build_url(request, obj_or_url)

    tweet = _compose_tweet(text, url)
    context['tweet_url'] = TWITTER_ENDPOINT % urlencode(tweet)
    return context


@register.inclusion_tag('django_social_share/templatetags/post_to_twitter.html', takes_context=True)
def post_to_twitter(context, text, obj_or_url=None, link_text='',link_class=""):
    context = post_to_twitter_url(context, text, obj_or_url)

    request = context['request']
    url = _build_url(request, obj_or_url)
    tweet = _compose_tweet(text, url)

    context['link_class'] = link_class 
    context['link_text'] = link_text or 'Post to Twitter'
    context['full_text'] = tweet
    return context


@register.simple_tag(takes_context=True)
def post_to_facebook_url(context, obj_or_url=None):
    request = context['request']
    url = _build_url(request, obj_or_url)
    context['facebook_url'] = FACEBOOK_ENDPOINT % urlencode(url)
    return context


@register.inclusion_tag('django_social_share/templatetags/post_to_facebook.html', takes_context=True)
def post_to_facebook(context, obj_or_url=None, link_text='',link_class=''):
    context = post_to_facebook_url(context, obj_or_url)
    context['link_class'] = link_class  or ''
    context['link_text'] = link_text or 'Post to Facebook'
    return context


@register.simple_tag(takes_context=True)
def post_to_gplus_url(context, obj_or_url=None):
    request = context['request']
    url = _build_url(request, obj_or_url)
    context['gplus_url'] = GPLUS_ENDPOINT % urlencode(url)
    return context


@register.inclusion_tag('django_social_share/templatetags/post_to_gplus.html', takes_context=True)
def post_to_gplus(context, obj_or_url=None, link_text='',link_class=''):
    context = post_to_gplus_url(context, obj_or_url)
    context['link_class'] = link_class 
    context['link_text'] = link_text or 'Post to Google+'
    return context


@register.simple_tag(takes_context=True)
def send_email_url(context, subject, text, obj_or_url=None):
    text = compile_text(context, text)
    subject = compile_text(context, subject)
    request = context['request']
    url = _build_url(request, obj_or_url)
    full_text = "%s %s" % (text, url)
    context['mailto_url'] = MAIL_ENDPOINT % (urlencode(subject), urlencode(full_text))
    return context


@register.inclusion_tag('django_social_share/templatetags/send_email.html', takes_context=True)
def send_email(context, subject, text, obj_or_url=None, link_text='',link_class=''):
    context = send_email_url(context, subject, text, obj_or_url)
    context['link_class'] = link_class 
    context['link_text'] = link_text or 'Share via email'
    return context


@register.filter(name='linkedin_locale')
def linkedin_locale(value):
    if "-" not in value:
        return value

    lang, country = value.split('-')
    return '_'.join([lang, country.upper()])


@register.simple_tag(takes_context=True)
def post_to_linkedin_url(context, obj_or_url=None):
    request = context['request']
    url = _build_url(request, obj_or_url)
    context['linkedin_url'] = url
    return context


@register.inclusion_tag('django_social_share/templatetags/post_to_linkedin.html', takes_context=True)
def post_to_linkedin(context, obj_or_url=None,link_class=''):
    context = post_to_linkedin_url(context, obj_or_url)
    context['link_class'] = link_class 
    return context


@register.simple_tag(takes_context=True)
def post_to_reddit_url(context, title, obj_or_url=None):
    request = context['request']
    title = compile_text(context, title)
    url = _build_url(request, obj_or_url)
    context['reddit_url'] = mark_safe(REDDIT_ENDPOINT % (urlencode(title), urlencode(url)))
    return context


@register.inclusion_tag('django_social_share/templatetags/post_to_reddit.html', takes_context=True)
def post_to_reddit(context, title, obj_or_url=None, link_text='',link_class=''):
    context = post_to_reddit_url(context, title, obj_or_url)
    context['link_class'] = link_class 
    context['link_text'] = link_text or 'Post to Reddit' 
    return context


@register.simple_tag(takes_context=True)
def post_to_telegram_url(context, title, obj_or_url):
    request = context['request']
    title = compile_text(context, title)
    url = _build_url(request, obj_or_url)
    context['telegram_url'] = mark_safe(TELEGRAM_ENDPOINT % (urlencode(title), urlencode(url)))
    return context


@register.inclusion_tag('django_social_share/templatetags/post_to_telegram.html', takes_context=True)
def post_to_telegram(context, title, obj_or_url=None, link_text='',link_class=''):
    context = post_to_telegram_url(context, title, obj_or_url)
    context['link_class'] = link_class 
    context['link_text'] = link_text or 'Post to Telegram'
    return context


@register.simple_tag(takes_context=True)
def post_to_whatsapp_url(context, obj_or_url=None):
    request = context['request']
    url = _build_url(request, obj_or_url)
    context['whatsapp_url'] = WHATSAPP_ENDPOINT % urlencode(url)
    return context


@register.inclusion_tag('django_social_share/templatetags/post_to_whatsapp.html', takes_context=True)
def post_to_whatsapp(context, obj_or_url=None, link_text='',link_class=''):
    context = post_to_whatsapp_url(context, obj_or_url)
    context['link_class'] = link_class 
    context['link_text'] = link_text or 'Post to WhatsApp'
    return context


@register.simple_tag(takes_context=True)
def save_to_pinterest_url(context, obj_or_url=None):
    request = context['request']
    url = _build_url(request, obj_or_url)
    context['pinterest_url'] = PINTEREST_ENDPOINT % urlencode(url)
    return context


@register.inclusion_tag('django_social_share/templatetags/save_to_pinterest.html', takes_context=True)
def save_to_pinterest(context, obj_or_url=None, pin_count=False, link_class=''):
    context = save_to_pinterest_url(context, obj_or_url)
    context['link_class'] = link_class 
    context['pin_count'] = pin_count
    return context


@register.inclusion_tag('django_social_share/templatetags/pinterest_script.html', takes_context=False)
def add_pinterest_script():
    pass

@register.simple_tag(takes_context=True)
def copy_to_clipboard_url(context, obj_or_url=None):
    request = context['request']
    url = _build_url(request, obj_or_url)
    context['copy_url'] = url
    return context

@register.inclusion_tag('django_social_share/templatetags/copy_to_clipboard.html', takes_context=True)
def copy_to_clipboard(context, obj_or_url, link_text='', link_class=''):
    context = copy_to_clipboard_url(context, obj_or_url)
    
    context['link_class'] = link_class
    context['link_text'] = link_text or 'Copy to clipboard'
    return context

@register.inclusion_tag('django_social_share/templatetags/copy_script.html', takes_context=False)
def add_copy_script():
    pass

================================================
FILE: django_social_share/tests/__init__.py
================================================
from .tests import *

================================================
FILE: django_social_share/tests/runtests.py
================================================
#!/usr/bin/env python
import sys
import os

from django.conf import settings

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

settings.configure(
    SITE_ID=1,
    DATABASES={
        'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory;'}
    },
    INSTALLED_APPS=[
        'django.contrib.auth',
        'django.contrib.sessions',
        'django.contrib.contenttypes',
        'django_social_share',
        'django_social_share.tests',
    ],
    TEMPLATES=[
        {
            'BACKEND': 'django.template.backends.django.DjangoTemplates',
            'DIRS': [
                os.path.join(BASE_DIR, 'templates'),
            ],
            'OPTIONS': {
                'context_processors': [
                    'django.template.context_processors.request',
                ],
            }
        },
    ]
)


def runtests(*test_args):
    import django
    try:
        django.setup()  # Django 1.7+
    except AttributeError:
        pass
    import django.test.utils
    runner_class = django.test.utils.get_runner(settings)
    test_runner = runner_class(verbosity=1, interactive=True)
    failures = test_runner.run_tests(['django_social_share'])
    sys.exit(failures)


if __name__ == '__main__':
    runtests()


================================================
FILE: django_social_share/tests/tests.py
================================================
from django.template import Context, Template
from django.test import TestCase, RequestFactory


class TemplateTagsTest(TestCase):

    def setUp(self):
        self.factory = RequestFactory()
        self.context = Context({
            'url': 'http://example.com',
            'text': 'example',
            'subject': 'Example Domain',
            'link_text':'',
            'link_class': 'example_class',
            'request': self.factory.get('/')
        })


    def test_twitter(self):
        template = Template("{% load social_share %} {% post_to_twitter text url %}")
        result = template.render(self.context)
        expected = ' <div class="tweet-this">\n    <a href="https://twitter.com/intent/tweet?text=example%20http%3A//example.com" class="meta-act-link meta-tweet " target="_blank">Post to Twitter</a>\n</div>\n'
        self.assertEqual(result, expected)

    def test_facebook(self):
        template = Template("{% load social_share %} {% post_to_facebook url text %}")
        result = template.render(self.context)
        expected = ' <div class="facebook-this">\n    <a href="https://www.facebook.com/sharer/sharer.php?u=http%3A//example.com" class="" target="_blank">example</a>\n</div>\n'
        self.assertEqual(result, expected)

    def test_gplus(self):
        template = Template("{% load social_share %} {% post_to_gplus url text %}")
        result = template.render(self.context)
        expected = ' <div class="gplus-this">\n    <a href="https://plus.google.com/share?url=http%3A//example.com" class="" target="_blank">example</a>\n</div>\n'
        self.assertEqual(result, expected)

    def test_mail_url(self):
        template = Template("{% load social_share %} {% send_email_url subject text url %}")
        template.render(self.context)
        expected = 'mailto:?subject=Example%20Domain&body=example%20http%3A//example.com'
        self.assertEqual(self.context['mailto_url'], expected)

    def test_mail(self):
        template = Template("{% load social_share %} {% send_email subject text url %}")
        result = template.render(self.context)
        expected = ' <div class="mail-this">\n    <a href="mailto:?subject=Example%20Domain&body=example%20http%3A//example.com" class="">Share via email</a>\n</div>\n'
        self.assertEqual(result, expected)

    def test_linkedin(self):
        template = Template("{% load social_share %} {% post_to_linkedin url %}")
        result = template.render(self.context)
        expected = ' <div class="linkedin-this ">\n  <script src="https://platform.linkedin.com/in.js" type="text/javascript">lang: en_US</script>\n  <script type="IN/Share" data-url="http://example.com"></script>\n</div>\n'
        self.assertEqual(result, expected)

    def test_reddit(self):
        template = Template("{% load social_share %} {% post_to_reddit text url text %}")
        result = template.render(self.context)
        expected = ' <div class="reddit-this">\n    <a href="https://www.reddit.com/submit?title=example&url=http%3A//example.com" class="" target="_blank">example</a>\n</div>\n'
        self.assertEqual(result, expected)

    def test_telegram(self):
        template = Template("{% load social_share %} {% post_to_telegram text url text %}")
        result = template.render(self.context)
        expected = ' <div class="telegram-this">\n    <a href="https://t.me/share/url?text=example&url=http%3A//example.com" class="" target="_blank">example</a>\n</div>\n'
        self.assertEqual(result, expected)

    def test_whatsapp(self):
        template = Template("{% load social_share %} {% post_to_whatsapp url text %}")
        result = template.render(self.context)
        expected = ' <div class="whatsapp-this">\n    <a href="https://api.whatsapp.com/send?text=http%3A//example.com" class="" target="_blank">example</a>\n</div>\n'
        self.assertEqual(result, expected)

    def test_pinterest(self):
        template = Template("{% load social_share %} {% save_to_pinterest url %}")
        result = template.render(self.context)
        expected = ' <div class="pinterest-this ">\n    <a data-pin-do="buttonPin" href="https://www.pinterest.com/pin/create/button/?url=http%3A//example.com" target="_blank"></a>\n</div>\n'
        self.assertEqual(result, expected)

    def test_pinterest_script(self):
        template = Template("{% load social_share %} {% add_pinterest_script %}")
        result = template.render(self.context)
        expected = ' <script async defer src="https://assets.pinterest.com/js/pinit.js"></script>\n'
        self.assertEqual(result, expected)

    def test_clipboard(self):
        template = Template("{% load social_share %} {% copy_to_clipboard url %}")
        result = template.render(self.context)
        expected = ' <div class="copy-this">\n    <button data-copy-btn="buttonCopy" data-copy-url="http://example.com" class="">Copy to clipboard</button>\n</div>\n'
        self.assertEqual(result, expected)

    def test_twitter_with_class(self):
        template = Template("{% load social_share %} {% post_to_twitter text url  link_text link_class %}")
        result = template.render(self.context)
        expected = ' <div class="tweet-this">\n    <a href="https://twitter.com/intent/tweet?text=example%20http%3A//example.com" class="meta-act-link meta-tweet example_class" target="_blank">Post to Twitter</a>\n</div>\n'
        self.assertEqual(result, expected)

    def test_facebook_with_class(self):
        template = Template("{% load social_share %} {% post_to_facebook url text link_class %}")
        result = template.render(self.context)
        expected = ' <div class="facebook-this">\n    <a href="https://www.facebook.com/sharer/sharer.php?u=http%3A//example.com" class="example_class" target="_blank">example</a>\n</div>\n'
        self.assertEqual(result, expected)

    def test_gplus_with_class(self):
        template = Template("{% load social_share %} {% post_to_gplus url text link_class %}")
        result = template.render(self.context)
        expected = ' <div class="gplus-this">\n    <a href="https://plus.google.com/share?url=http%3A//example.com" class="example_class" target="_blank">example</a>\n</div>\n'
        self.assertEqual(result, expected)

    def test_mail_with_class(self):
        template = Template("{% load social_share %} {% send_email subject text url link_text link_class %}")
        result = template.render(self.context)
        expected = ' <div class="mail-this">\n    <a href="mailto:?subject=Example%20Domain&body=example%20http%3A//example.com" class="example_class">Share via email</a>\n</div>\n'
        self.assertEqual(result, expected)

    def test_linkedin_with_class(self):
        template = Template("{% load social_share %} {% post_to_linkedin url link_class %}")
        result = template.render(self.context)
        expected = ' <div class="linkedin-this example_class">\n  <script src="https://platform.linkedin.com/in.js" type="text/javascript">lang: en_US</script>\n  <script type="IN/Share" data-url="http://example.com"></script>\n</div>\n'
        self.assertEqual(result, expected)

    def test_reddit_with_class(self):
        template = Template("{% load social_share %} {% post_to_reddit text url text link_class %}")
        result = template.render(self.context)
        expected = ' <div class="reddit-this">\n    <a href="https://www.reddit.com/submit?title=example&url=http%3A//example.com" class="example_class" target="_blank">example</a>\n</div>\n'
        self.assertEqual(result, expected)

    def test_telegram_with_class(self):
        template = Template("{% load social_share %} {% post_to_telegram text url text link_class %}")
        result = template.render(self.context)
        expected = ' <div class="telegram-this">\n    <a href="https://t.me/share/url?text=example&url=http%3A//example.com" class="example_class" target="_blank">example</a>\n</div>\n'
        self.assertEqual(result, expected)

    def test_whatsapp_with_class(self):
        template = Template("{% load social_share %} {% post_to_whatsapp url text link_class %}")
        result = template.render(self.context)
        expected = ' <div class="whatsapp-this">\n    <a href="https://api.whatsapp.com/send?text=http%3A//example.com" class="example_class" target="_blank">example</a>\n</div>\n'
        self.assertEqual(result, expected)

    def test_pinterest_with_class(self):
        template = Template("{% load social_share %} {% save_to_pinterest url  False link_class %}")
        result = template.render(self.context)
        expected = ' <div class="pinterest-this example_class">\n    <a data-pin-do="buttonPin" href="https://www.pinterest.com/pin/create/button/?url=http%3A//example.com" target="_blank"></a>\n</div>\n'
        self.assertEqual(result, expected)

    def test_clipboard_with_class(self):
        template = Template("{% load social_share %} {% copy_to_clipboard url text link_class %}")
        result = template.render(self.context)
        expected = ' <div class="copy-this">\n    <button data-copy-btn="buttonCopy" data-copy-url="http://example.com" class="example_class">example</button>\n</div>\n'
        self.assertEqual(result, expected)

================================================
FILE: django_social_share/views.py
================================================
#  Views.py


================================================
FILE: setup.cfg
================================================
[nosetests]
with-coverage = true
cover-package = recommends
cover-html = true
cover-erase = true
cover-inclusive = true

[metadata]
license_file = LICENSE

[wheel]
universal = 1


================================================
FILE: setup.py
================================================
import io
import os
from setuptools import setup, find_packages


here = os.path.abspath(os.path.dirname(__file__))

with io.open(os.path.join(here, 'README.rst'), encoding='utf-8') as fp:
    README = fp.read()

with open(os.path.join(here, 'VERSION')) as version_file:
    version = version_file.read().strip()

requirements = []
test_requirements = [
    "Django>=2.0",
]

setup(
    name="django-social-share",
    version=version,
    description="Templatetags for 'tweet this' and 'share on facebook'",
    long_description=README,
    url='https://github.com/fcurella/django-social-share',
    license='MIT',
    author='Flavio Curella',
    author_email='flavio.curella@curella.org',
    packages=find_packages(exclude=['tests']),
    include_package_data=True,
    classifiers=[
        'Development Status :: 3 - Alpha',
        'Environment :: Console',
        'Intended Audience :: Developers',
        'Intended Audience :: Information Technology',
        'License :: OSI Approved :: MIT License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Framework :: Django',
    ],
    install_requires=requirements,
    tests_require=test_requirements,
    test_suite='django_social_share.tests.runtests.runtests'
)
Download .txt
gitextract_08i4p9oj/

├── .bumpversion.cfg
├── .github/
│   ├── FUNDING.yml
│   └── workflows/
│       ├── gh-release.yml
│       └── pythonpackage.yml
├── .gitignore
├── CODE_OF_CONDUCT.md
├── LICENSE
├── MANIFEST.in
├── Makefile
├── README.rst
├── VERSION
├── django_social_share/
│   ├── __init__.py
│   ├── models.py
│   ├── templates/
│   │   └── django_social_share/
│   │       └── templatetags/
│   │           ├── copy_script.html
│   │           ├── copy_to_clipboard.html
│   │           ├── pinterest_script.html
│   │           ├── post_to_facebook.html
│   │           ├── post_to_gplus.html
│   │           ├── post_to_linkedin.html
│   │           ├── post_to_reddit.html
│   │           ├── post_to_telegram.html
│   │           ├── post_to_twitter.html
│   │           ├── post_to_whatsapp.html
│   │           ├── save_to_pinterest.html
│   │           └── send_email.html
│   ├── templatetags/
│   │   ├── __init__.py
│   │   └── social_share.py
│   ├── tests/
│   │   ├── __init__.py
│   │   ├── runtests.py
│   │   └── tests.py
│   └── views.py
├── setup.cfg
└── setup.py
Download .txt
SYMBOL INDEX (51 symbols across 3 files)

FILE: django_social_share/templatetags/social_share.py
  function compile_text (line 36) | def compile_text(context, text):
  function _build_url (line 41) | def _build_url(request, obj_or_url):
  function _compose_tweet (line 59) | def _compose_tweet(text, url=None):
  function post_to_twitter_url (line 75) | def post_to_twitter_url(context, text, obj_or_url=None):
  function post_to_twitter (line 87) | def post_to_twitter(context, text, obj_or_url=None, link_text='',link_cl...
  function post_to_facebook_url (line 101) | def post_to_facebook_url(context, obj_or_url=None):
  function post_to_facebook (line 109) | def post_to_facebook(context, obj_or_url=None, link_text='',link_class=''):
  function post_to_gplus_url (line 117) | def post_to_gplus_url(context, obj_or_url=None):
  function post_to_gplus (line 125) | def post_to_gplus(context, obj_or_url=None, link_text='',link_class=''):
  function send_email_url (line 133) | def send_email_url(context, subject, text, obj_or_url=None):
  function send_email (line 144) | def send_email(context, subject, text, obj_or_url=None, link_text='',lin...
  function linkedin_locale (line 152) | def linkedin_locale(value):
  function post_to_linkedin_url (line 161) | def post_to_linkedin_url(context, obj_or_url=None):
  function post_to_linkedin (line 169) | def post_to_linkedin(context, obj_or_url=None,link_class=''):
  function post_to_reddit_url (line 176) | def post_to_reddit_url(context, title, obj_or_url=None):
  function post_to_reddit (line 185) | def post_to_reddit(context, title, obj_or_url=None, link_text='',link_cl...
  function post_to_telegram_url (line 193) | def post_to_telegram_url(context, title, obj_or_url):
  function post_to_telegram (line 202) | def post_to_telegram(context, title, obj_or_url=None, link_text='',link_...
  function post_to_whatsapp_url (line 210) | def post_to_whatsapp_url(context, obj_or_url=None):
  function post_to_whatsapp (line 218) | def post_to_whatsapp(context, obj_or_url=None, link_text='',link_class=''):
  function save_to_pinterest_url (line 226) | def save_to_pinterest_url(context, obj_or_url=None):
  function save_to_pinterest (line 234) | def save_to_pinterest(context, obj_or_url=None, pin_count=False, link_cl...
  function add_pinterest_script (line 242) | def add_pinterest_script():
  function copy_to_clipboard_url (line 246) | def copy_to_clipboard_url(context, obj_or_url=None):
  function copy_to_clipboard (line 253) | def copy_to_clipboard(context, obj_or_url, link_text='', link_class=''):
  function add_copy_script (line 261) | def add_copy_script():

FILE: django_social_share/tests/runtests.py
  function runtests (line 38) | def runtests(*test_args):

FILE: django_social_share/tests/tests.py
  class TemplateTagsTest (line 5) | class TemplateTagsTest(TestCase):
    method setUp (line 7) | def setUp(self):
    method test_twitter (line 19) | def test_twitter(self):
    method test_facebook (line 25) | def test_facebook(self):
    method test_gplus (line 31) | def test_gplus(self):
    method test_mail_url (line 37) | def test_mail_url(self):
    method test_mail (line 43) | def test_mail(self):
    method test_linkedin (line 49) | def test_linkedin(self):
    method test_reddit (line 55) | def test_reddit(self):
    method test_telegram (line 61) | def test_telegram(self):
    method test_whatsapp (line 67) | def test_whatsapp(self):
    method test_pinterest (line 73) | def test_pinterest(self):
    method test_pinterest_script (line 79) | def test_pinterest_script(self):
    method test_clipboard (line 85) | def test_clipboard(self):
    method test_twitter_with_class (line 91) | def test_twitter_with_class(self):
    method test_facebook_with_class (line 97) | def test_facebook_with_class(self):
    method test_gplus_with_class (line 103) | def test_gplus_with_class(self):
    method test_mail_with_class (line 109) | def test_mail_with_class(self):
    method test_linkedin_with_class (line 115) | def test_linkedin_with_class(self):
    method test_reddit_with_class (line 121) | def test_reddit_with_class(self):
    method test_telegram_with_class (line 127) | def test_telegram_with_class(self):
    method test_whatsapp_with_class (line 133) | def test_whatsapp_with_class(self):
    method test_pinterest_with_class (line 139) | def test_pinterest_with_class(self):
    method test_clipboard_with_class (line 145) | def test_clipboard_with_class(self):
Condensed preview — 33 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (43K chars).
[
  {
    "path": ".bumpversion.cfg",
    "chars": 111,
    "preview": "[bumpversion]\nfiles = VERSION django_social_share/__init__.py\ncommit = True\ntag = True\ncurrent_version = 2.3.0\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "chars": 591,
    "preview": "# These are supported funding model platforms\n\ngithub: @fcurella\npatreon: # Replace with a single Patreon username\nopen_"
  },
  {
    "path": ".github/workflows/gh-release.yml",
    "chars": 694,
    "preview": "on:\n  push:\n    # Sequence of patterns matched against refs/tags\n    tags:\n      - 'v*' # Push events to matching v*, i."
  },
  {
    "path": ".github/workflows/pythonpackage.yml",
    "chars": 908,
    "preview": "name: Python build\n\non: [push]\n\njobs:\n  tests:\n\n    runs-on: ubuntu-latest\n    strategy:\n      max-parallel: 4\n      mat"
  },
  {
    "path": ".gitignore",
    "chars": 198,
    "preview": "*.egg-info\n*.pot\n*.py[co]\n*.out\n.eggs\n.cache\n.coverage\nparsetab.py\n__pycache__\nMANIFEST\ndist/\ndocs/_build/\ndocs/locale/\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "chars": 3218,
    "preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, w"
  },
  {
    "path": "LICENSE",
    "chars": 1060,
    "preview": "Copyright (C) 2011 by Flavio Curella\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof th"
  },
  {
    "path": "MANIFEST.in",
    "chars": 130,
    "preview": "include README.rst\ninclude LICENSE\ninclude VERSION\nrecursive-include tests *.py\nrecursive-include django_social_share/te"
  },
  {
    "path": "Makefile",
    "chars": 78,
    "preview": "release:\n\trm -rf dist\n\tpython setup.py sdist bdist_wheel\n\ttwine upload dist/*\n"
  },
  {
    "path": "README.rst",
    "chars": 7789,
    "preview": "Django Social Share\n======================================\n\n.. image:: https://github.com/fcurella/django-social-share/w"
  },
  {
    "path": "VERSION",
    "chars": 5,
    "preview": "2.3.0"
  },
  {
    "path": "django_social_share/__init__.py",
    "chars": 46,
    "preview": "VERSION = tuple(map(int, \"2.3.0\".split('.')))\n"
  },
  {
    "path": "django_social_share/models.py",
    "chars": 29,
    "preview": "from django.db import models\n"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/copy_script.html",
    "chars": 1133,
    "preview": "<script>\n  function copyTextToClipboard(text) {\n    var textArea = document.createElement(\"textarea\");\n\n    // Place in "
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/copy_to_clipboard.html",
    "chars": 151,
    "preview": "<div class=\"copy-this\">\n    <button data-copy-btn=\"buttonCopy\" data-copy-url=\"{{ copy_url }}\" class=\"{{ link_class }}\">{"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/pinterest_script.html",
    "chars": 77,
    "preview": "<script async defer src=\"https://assets.pinterest.com/js/pinit.js\"></script>\n"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/post_to_facebook.html",
    "chars": 127,
    "preview": "<div class=\"facebook-this\">\n    <a href=\"{{ facebook_url }}\" class=\"{{ link_class }}\" target=\"_blank\">{{link_text}}</a>\n"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/post_to_gplus.html",
    "chars": 121,
    "preview": "<div class=\"gplus-this\">\n    <a href=\"{{ gplus_url }}\" class=\"{{ link_class }}\" target=\"_blank\">{{link_text}}</a>\n</div>"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/post_to_linkedin.html",
    "chars": 313,
    "preview": "{% load i18n social_share %}{% get_current_language as LANGUAGE_CODE %}<div class=\"linkedin-this {{link_class}}\">\n  <scr"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/post_to_reddit.html",
    "chars": 123,
    "preview": "<div class=\"reddit-this\">\n    <a href=\"{{ reddit_url }}\" class=\"{{ link_class }}\" target=\"_blank\">{{link_text}}</a>\n</di"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/post_to_telegram.html",
    "chars": 127,
    "preview": "<div class=\"telegram-this\">\n    <a href=\"{{ telegram_url }}\" class=\"{{ link_class }}\" target=\"_blank\">{{link_text}}</a>\n"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/post_to_twitter.html",
    "chars": 144,
    "preview": "<div class=\"tweet-this\">\n    <a href=\"{{ tweet_url }}\" class=\"meta-act-link meta-tweet {{link_class}}\" target=\"_blank\">{"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/post_to_whatsapp.html",
    "chars": 127,
    "preview": "<div class=\"whatsapp-this\">\n    <a href=\"{{ whatsapp_url }}\" class=\"{{ link_class }}\" target=\"_blank\">{{link_text}}</a>\n"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/save_to_pinterest.html",
    "chars": 185,
    "preview": "<div class=\"pinterest-this {{ link_class }}\">\n    <a data-pin-do=\"buttonPin\" {% if pin_count %}data-pin-count=\"beside\" {"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/send_email.html",
    "chars": 110,
    "preview": "<div class=\"mail-this\">\n    <a href=\"{{ mailto_url|safe }}\" class=\"{{ link_class }}\">{{link_text}}</a>\n</div>\n"
  },
  {
    "path": "django_social_share/templatetags/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "django_social_share/templatetags/social_share.py",
    "chars": 9378,
    "preview": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nimport re\n\nfrom django import template\n\nfrom django.db."
  },
  {
    "path": "django_social_share/tests/__init__.py",
    "chars": 20,
    "preview": "from .tests import *"
  },
  {
    "path": "django_social_share/tests/runtests.py",
    "chars": 1345,
    "preview": "#!/usr/bin/env python\nimport sys\nimport os\n\nfrom django.conf import settings\n\n# Build paths inside the project like this"
  },
  {
    "path": "django_social_share/tests/tests.py",
    "chars": 9226,
    "preview": "from django.template import Context, Template\nfrom django.test import TestCase, RequestFactory\n\n\nclass TemplateTagsTest("
  },
  {
    "path": "django_social_share/views.py",
    "chars": 12,
    "preview": "#  Views.py\n"
  },
  {
    "path": "setup.cfg",
    "chars": 178,
    "preview": "[nosetests]\nwith-coverage = true\ncover-package = recommends\ncover-html = true\ncover-erase = true\ncover-inclusive = true\n"
  },
  {
    "path": "setup.py",
    "chars": 1274,
    "preview": "import io\nimport os\nfrom setuptools import setup, find_packages\n\n\nhere = os.path.abspath(os.path.dirname(__file__))\n\nwit"
  }
]

About this extraction

This page contains the full source code of the fcurella/django-social-share GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 33 files (38.1 KB), approximately 10.3k tokens, and a symbol index with 51 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!