[
  {
    "path": ".bumpversion.cfg",
    "content": "[bumpversion]\nfiles = VERSION django_social_share/__init__.py\ncommit = True\ntag = True\ncurrent_version = 2.3.0\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "# These are supported funding model platforms\n\ngithub: @fcurella\npatreon: # Replace with a single Patreon username\nopen_collective: # Replace with a single Open Collective username\nko_fi: # Replace with a single Ko-fi username\ntidelift: pypi/django-social-hare\ncommunity_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry\nliberapay: # Replace with a single Liberapay username\nissuehunt: # Replace with a single IssueHunt username\notechie: # Replace with a single Otechie username\ncustom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']\n"
  },
  {
    "path": ".github/workflows/gh-release.yml",
    "content": "on:\n  push:\n    # Sequence of patterns matched against refs/tags\n    tags:\n      - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10\n\nname: Create Release\n\njobs:\n  build:\n    name: Create Release\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout code\n        uses: actions/checkout@v2\n      - name: Create Release\n        id: create_release\n        uses: actions/create-release@v1\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token\n        with:\n          tag_name: ${{ github.ref }}\n          release_name: Release ${{ github.ref }}\n          draft: false\n          prerelease: false\n"
  },
  {
    "path": ".github/workflows/pythonpackage.yml",
    "content": "name: Python build\n\non: [push]\n\njobs:\n  tests:\n\n    runs-on: ubuntu-latest\n    strategy:\n      max-parallel: 4\n      matrix:\n        python-version: [3.6, 3.7, 3.8]\n        django-version:\n          - \"Django>=2.0,<2.1\"\n          - \"Django>=2.1,<2.2\"\n          - \"Django>=2.2,<3.0\"\n          - \"Django>=3.0,<3.1\"\n\n    steps:\n    - uses: actions/checkout@v2\n    - name: Set up Python ${{ matrix.python-version }}\n      uses: actions/setup-python@v1\n      with:\n        python-version: ${{ matrix.python-version }}\n    - name: Install dependencies\n      run: |\n        python -m pip install --upgrade pip\n        pip install -q \"${{ matrix.django-version }}\"\n        pip install -e .\n        pip install coveralls\n    - name: Test with pytest\n      env:\n        COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}\n      run: |\n        coverage run --source django_social_share setup.py test && coveralls\n"
  },
  {
    "path": ".gitignore",
    "content": "*.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/\nnode_modules/\ntests/coverage_html/\ntests/.coverage\nbuild/\ntests/report/\n.idea\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "content": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn 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.\n\n## Our Standards\n\nExamples of behavior that contributes to creating a positive environment include:\n\n* Using welcoming and inclusive language\n* Being respectful of differing viewpoints and experiences\n* Gracefully accepting constructive criticism\n* Focusing on what is best for the community\n* Showing empathy towards other community members\n\nExamples of unacceptable behavior by participants include:\n\n* The use of sexualized language or imagery and unwelcome sexual attention or advances\n* Trolling, insulting/derogatory comments, and personal or political attacks\n* Public or private harassment\n* Publishing others' private information, such as a physical or electronic address, without explicit permission\n* Other conduct which could reasonably be considered inappropriate in a professional setting\n\n## Our Responsibilities\n\nProject 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.\n\nProject 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.\n\n## Scope\n\nThis 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.\n\n## Enforcement\n\nInstances 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.\n\nProject 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.\n\n## Attribution\n\nThis Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]\n\n[homepage]: http://contributor-covenant.org\n[version]: http://contributor-covenant.org/version/1/4/\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright (C) 2011 by Flavio Curella\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE."
  },
  {
    "path": "MANIFEST.in",
    "content": "include README.rst\ninclude LICENSE\ninclude VERSION\nrecursive-include tests *.py\nrecursive-include django_social_share/templates *\n"
  },
  {
    "path": "Makefile",
    "content": "release:\n\trm -rf dist\n\tpython setup.py sdist bdist_wheel\n\ttwine upload dist/*\n"
  },
  {
    "path": "README.rst",
    "content": "Django Social Share\n======================================\n\n.. image:: https://github.com/fcurella/django-social-share/workflows/Python%20build/badge.svg\n\n.. image:: https://coveralls.io/repos/github/fcurella/django-social-share/badge.svg?branch=master\n    :target: https://coveralls.io/github/fcurella/django-social-share?branch=master\n\nProvides templatetags for:\n\n* 'Tweet This'\n* 'Share this on Facebook'\n* 'Share on Google+'\n* 'Share on LinkedIn'\n* 'Share on Telegram'\n* 'Share on WhatsApp'\n* 'mailto://'.\n* 'Save to Pinterest'\n* 'Copy to Clipboard'\n\nPlain HTML templates_ are provided for your convenience, but you can override them to provide your own look and feel.\n\nInstallation\n-------------\n\n::\n\n    $ python -m pip install django-social-share\n\nAdd the app to ``INSTALLED_APPS``::\n\n    INSTALLED_APPS += ['django_social_share']\n\nYou 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::\n\n    TEMPLATES=[\n        {\n            'BACKEND': 'django.template.backends.django.DjangoTemplates',\n            'DIRS': [\n                os.path.join(BASE_DIR, 'templates'),\n            ],\n            'OPTIONS': {\n                'context_processors': [\n                    'django.template.context_processors.request',\n                ],\n            }\n        },\n    ]\n    \nNote 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``.\n\n.. _ngrok: https://ngrok.com/\n\nUsage\n-----\n\nFirst, add ``{% load social_share %}`` to your HTML template.\nThis tag should be placed at the top of most of your HTML document and should come before any other template tag unless otherwise.\n\n`django-social-share` provides two types of template tags: \"snippet\" tags and \"context\" tags.\n\nSnippet Tags\n~~~~~~~~~~~~\n\nSnippet tags returns HTML that you can just drop in your templates. This snippets are customizable, see templates_\n.\n\nAvailable Snippets Tags:\n\n::\n\n  {% post_to_facebook <object_or_url> <link_text> <link_class> %}\n  \n  {% post_to_gplus <object_or_url> <link_text> <link_class> %}\n  \n  {% post_to_twitter <text_to_post> <object_or_url> <link_text> <link_class> %}\n  \n  {% post_to_linkedin <object_or_url> <link_class> %}\n    \n  {% post_to_reddit <text_to_post> <object_or_url> <link_text> <link_class> %}\n\n  {% post_to_telegram <text_to_post> <object_or_url> <link_text>  <link_class> %}\n\n  {% post_to_whatsapp <object_or_url> <link_text> <link_class> %}\n\n  {% save_to_pinterest <object_or_url>  <link_class> %}\n\n  {% add_pinterest_script %}\n\n``<text_to_post>`` may contain any valid Django Template code. Note that Facebook does not support this anymore.\n\n``<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.\n\n``<link_text>`` is also optional. It defines the text used for the ``a`` element. Defaults to 'Post to Facebook' and 'Post to Twitter'.\n\nExample::\n\n  {% load social_share %}\n  \n  {% post_to_facebook object_or_url \"Post to Facebook!\" %}\n  {% post_to_twitter \"New Song: {{object.title}}. Check it out!\" object_or_url \"Post to Twitter\" %}\n  {% post_to_gplus object_or_url \"Post to Google+!\" %}\n  {% post_to_linkedin object_or_url %}\n  {% send_email object.title \"New Song: {{object.title}}. Check it out!\" object_or_url \"Share via email\" %}\n  {% post_to_reddit \"New Song: {{object.title}}\" <object_or_url> %}\n  {% post_to_telegram \"New Song: {{object.title}}\" <object_or_url> %}\n  {% post_to_whatsapp object_or_url \"Share via WhatsApp\" %}\n  {% save_to_pinterest object_or_url %}\n  {% add_pinterest_script %} // Required for save_to_pinterest. Add to the end of body tag.\n\n.. _templates:\n\nTemplates\n---------\n\nTemplates for snippet tags are in:\n\n* ``django_social_share/templatetags/post_to_twitter.html``\n* ``django_social_share/templatetags/post_to_facebook.html``\n* ``django_social_share/templatetags/post_to_gplus.html``\n* ``django_social_share/templatetags/send_email.html``\n* ``django_social_share/templatetags/post_to_linkedin.html``\n* ``django_social_share/templatetags/post_to_reddit.html``.\n* ``django_social_share/templatetags/post_to_telegram.html``.\n* ``django_social_share/templatetags/post_to_whatsapp.html``.\n* ``django_social_share/templatetags/save_to_pinterest.html``.\n* ``django_social_share/templatetags/pinterest_script.html``.\n* ``django_social_share/templatetags/copy_to_clipboard.html``.\n* ``django_social_share/templatetags/copy_script.html``.\n  \nYou can override them to suit your mileage.\n\nContext Tags\n~~~~~~~~~~~~\n\nContext 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.\n\nAvailable Context Tags:\n\n============================================================================= =================\nTag example                                                                   Variable name\n============================================================================= =================\n``{% post_to_twitter_url <text_to_post> <object_or_url> %}``                  ``tweet_url``\n``{% post_to_facebook_url <object_or_url> %}``                                ``facebook_url``\n``{% post_to_gplus_url <object_or_url> %}``                                   ``gplus_url``\n``{% send_email_url <subject> <text_to_post> <object_or_url> <link_text> %}`` ``mailto_url``\n``{% post_to_reddit_url <text> <object_or_url> %}``                           ``reddit_url``\n``{% post_to_telegram <text> <object_or_url> %}``                             ``telegram_url``\n``{% post_to_whatsapp_url <object_or_url> %}``                                ``whatsapp_url``\n``{% save_to_pinterest_url <object_or_url> %}``                               ``pinterest_url``\n``{% copy_to_clipboard <object_or_url> <link_text> <link_class> %}``          ``copy_url``\n\n``<text_to_post>`` may contain any valid Django Template code. Note that Facebook does not support this anymore.\n\n``<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.\n\n``<link_text>`` is also optional. It defines the text used for the ``a`` element. Defaults to 'Post to Facebook' and 'Post to Twitter'.\n\nExample::\n\n  {% load social_share %}\n  \n  {% post_to_facebook object_or_url \"Post to Facebook!\" %}\n  {% post_to_twitter \"New Song: {{object.title}}. Check it out!\" object_or_url \"Post to Twitter\" %}\n  {% post_to_gplus object_or_url \"Post to Google+!\" %}\n  {% post_to_linkedin object_or_url %}\n  {% send_email object.title \"New Song: {{object.title}}. Check it out!\" object_or_url \"Share via email\" %}\n  {% post_to_reddit \"New Song: {{object.title}}\" <object_or_url> %}\n  {% post_to_telegram \"New Song: {{object.title}}\" <object_or_url> %}\n  {% post_to_whatsapp object_or_url \"Share via WhatsApp\" %}\n  {% save_to_pinterest object_or_url %}\n  {% add_pinterest_script %} // Required for save_to_pinterest. Add to the end of body tag.\n  {% copy_to_clipboard object_or_url \"Copy to clipboard!\" %}\n  {% add_copy_script %} // Required for copy_to_clipboard. Add to the end of body tag.\n\nIssues\n------\n\nIf you have any issues, please use `GitHub's issues <https://github.com/fcurella/django-social-share/issues>`_.\nPlease refrain from emailing the author.\n"
  },
  {
    "path": "VERSION",
    "content": "2.3.0"
  },
  {
    "path": "django_social_share/__init__.py",
    "content": "VERSION = tuple(map(int, \"2.3.0\".split('.')))\n"
  },
  {
    "path": "django_social_share/models.py",
    "content": "from django.db import models\n"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/copy_script.html",
    "content": "<script>\n  function copyTextToClipboard(text) {\n    var textArea = document.createElement(\"textarea\");\n\n    // Place in the top-left corner of screen regardless of scroll position.\n    textArea.style.position = \"fixed\";\n    textArea.style.top = 0;\n    textArea.style.left = 0;\n\n    textArea.style.width = \"2em\";\n    textArea.style.height = \"2em\";\n\n    textArea.style.padding = 0;\n\n    // Clean up any borders.\n    textArea.style.border = \"none\";\n    textArea.style.outline = \"none\";\n    textArea.style.boxShadow = \"none\";\n\n    // Avoid flash of the white box if rendered for any reason.\n    textArea.style.background = \"transparent\";\n\n    textArea.value = text;\n\n    document.body.appendChild(textArea);\n    textArea.focus();\n    textArea.select();\n\n    try {\n      document.execCommand(\"copy\");\n    } catch (err) {\n      console.log(\"unable to copy\");\n    }\n\n    document.body.removeChild(textArea);\n  }\n\n  var copyBtn = document.querySelector('[data-copy-btn=\"buttonCopy\"]');\n\n  copyBtn.addEventListener(\"click\", function (event) {\n    var url = copyBtn.getAttribute(\"data-copy-url\");\n    copyTextToClipboard(url);\n  });\n</script>\n"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/copy_to_clipboard.html",
    "content": "<div class=\"copy-this\">\n    <button data-copy-btn=\"buttonCopy\" data-copy-url=\"{{ copy_url }}\" class=\"{{ link_class }}\">{{ link_text }}</button>\n</div>\n"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/pinterest_script.html",
    "content": "<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",
    "content": "<div class=\"facebook-this\">\n    <a href=\"{{ facebook_url }}\" class=\"{{ link_class }}\" target=\"_blank\">{{link_text}}</a>\n</div>\n"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/post_to_gplus.html",
    "content": "<div class=\"gplus-this\">\n    <a href=\"{{ gplus_url }}\" class=\"{{ link_class }}\" target=\"_blank\">{{link_text}}</a>\n</div>\n"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/post_to_linkedin.html",
    "content": "{% load i18n social_share %}{% get_current_language as LANGUAGE_CODE %}<div class=\"linkedin-this {{link_class}}\">\n  <script src=\"https://platform.linkedin.com/in.js\" type=\"text/javascript\">lang: {{ LANGUAGE_CODE|linkedin_locale }}</script>\n  <script type=\"IN/Share\" data-url=\"{{ linkedin_url }}\"></script>\n</div>\n"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/post_to_reddit.html",
    "content": "<div class=\"reddit-this\">\n    <a href=\"{{ reddit_url }}\" class=\"{{ link_class }}\" target=\"_blank\">{{link_text}}</a>\n</div>\n"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/post_to_telegram.html",
    "content": "<div class=\"telegram-this\">\n    <a href=\"{{ telegram_url }}\" class=\"{{ link_class }}\" target=\"_blank\">{{link_text}}</a>\n</div>\n"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/post_to_twitter.html",
    "content": "<div class=\"tweet-this\">\n    <a href=\"{{ tweet_url }}\" class=\"meta-act-link meta-tweet {{link_class}}\" target=\"_blank\">{{link_text}}</a>\n</div>\n"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/post_to_whatsapp.html",
    "content": "<div class=\"whatsapp-this\">\n    <a href=\"{{ whatsapp_url }}\" class=\"{{ link_class }}\" target=\"_blank\">{{link_text}}</a>\n</div>\n"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/save_to_pinterest.html",
    "content": "<div class=\"pinterest-this {{ link_class }}\">\n    <a data-pin-do=\"buttonPin\" {% if pin_count %}data-pin-count=\"beside\" {% endif %}href=\"{{ pinterest_url }}\" target=\"_blank\"></a>\n</div>\n"
  },
  {
    "path": "django_social_share/templates/django_social_share/templatetags/send_email.html",
    "content": "<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",
    "content": ""
  },
  {
    "path": "django_social_share/templatetags/social_share.py",
    "content": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nimport re\n\nfrom django import template\n\nfrom django.db.models import Model\nfrom django.template.defaultfilters import urlencode\nfrom django.utils.safestring import mark_safe\n\ntry:\n    from django_bitly.templatetags.bitly import bitlify\n    DJANGO_BITLY = True\nexcept ImportError:\n    DJANGO_BITLY = False\n\n\nregister = template.Library()\n\n\nTWITTER_ENDPOINT = 'https://twitter.com/intent/tweet?text=%s'\nFACEBOOK_ENDPOINT = 'https://www.facebook.com/sharer/sharer.php?u=%s'\nGPLUS_ENDPOINT = 'https://plus.google.com/share?url=%s'\nMAIL_ENDPOINT = 'mailto:?subject=%s&body=%s'\nLINKEDIN_ENDPOINT = 'https://www.linkedin.com/shareArticle?mini=true&title=%s&url=%s'\nREDDIT_ENDPOINT = 'https://www.reddit.com/submit?title=%s&url=%s'\nTELEGRAM_ENDPOINT = 'https://t.me/share/url?text=%s&url=%s'\nWHATSAPP_ENDPOINT = 'https://api.whatsapp.com/send?text=%s'\nPINTEREST_ENDPOINT = 'https://www.pinterest.com/pin/create/button/?url=%s'\n\n\nBITLY_REGEX = re.compile(r'^https?://bit\\.ly/')\n\n\ndef compile_text(context, text):\n    ctx = template.context.Context(context)\n    return template.Template(text).render(ctx)\n\n\ndef _build_url(request, obj_or_url):\n    if obj_or_url is not None:\n        if isinstance(obj_or_url, Model):\n            if DJANGO_BITLY:\n                url = bitlify(obj_or_url)  # type: str\n                if not BITLY_REGEX.match(url):\n                    return request.build_absolute_uri(\n                        obj_or_url.get_absolute_url()\n                    )\n                else:\n                    return url\n            else:\n                return request.build_absolute_uri(obj_or_url.get_absolute_url())\n        else:\n            return request.build_absolute_uri(obj_or_url)\n    return ''\n\n\ndef _compose_tweet(text, url=None):\n    TWITTER_MAX_NUMBER_OF_CHARACTERS = 140\n    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.\n\n    # Compute length of the tweet\n    url_length = len(' ') + TWITTER_LINK_LENGTH if url else 0\n    total_length = len(text) + url_length\n\n    # Check that the text respects the max number of characters for a tweet\n    if total_length > TWITTER_MAX_NUMBER_OF_CHARACTERS:\n        text = text[:(TWITTER_MAX_NUMBER_OF_CHARACTERS - url_length - 1)] + \"…\"  # len(\"…\") == 1\n\n    return \"%s %s\" % (text, url) if url else text\n\n\n@register.simple_tag(takes_context=True)\ndef post_to_twitter_url(context, text, obj_or_url=None):\n    text = compile_text(context, text)\n    request = context['request']\n\n    url = _build_url(request, obj_or_url)\n\n    tweet = _compose_tweet(text, url)\n    context['tweet_url'] = TWITTER_ENDPOINT % urlencode(tweet)\n    return context\n\n\n@register.inclusion_tag('django_social_share/templatetags/post_to_twitter.html', takes_context=True)\ndef post_to_twitter(context, text, obj_or_url=None, link_text='',link_class=\"\"):\n    context = post_to_twitter_url(context, text, obj_or_url)\n\n    request = context['request']\n    url = _build_url(request, obj_or_url)\n    tweet = _compose_tweet(text, url)\n\n    context['link_class'] = link_class \n    context['link_text'] = link_text or 'Post to Twitter'\n    context['full_text'] = tweet\n    return context\n\n\n@register.simple_tag(takes_context=True)\ndef post_to_facebook_url(context, obj_or_url=None):\n    request = context['request']\n    url = _build_url(request, obj_or_url)\n    context['facebook_url'] = FACEBOOK_ENDPOINT % urlencode(url)\n    return context\n\n\n@register.inclusion_tag('django_social_share/templatetags/post_to_facebook.html', takes_context=True)\ndef post_to_facebook(context, obj_or_url=None, link_text='',link_class=''):\n    context = post_to_facebook_url(context, obj_or_url)\n    context['link_class'] = link_class  or ''\n    context['link_text'] = link_text or 'Post to Facebook'\n    return context\n\n\n@register.simple_tag(takes_context=True)\ndef post_to_gplus_url(context, obj_or_url=None):\n    request = context['request']\n    url = _build_url(request, obj_or_url)\n    context['gplus_url'] = GPLUS_ENDPOINT % urlencode(url)\n    return context\n\n\n@register.inclusion_tag('django_social_share/templatetags/post_to_gplus.html', takes_context=True)\ndef post_to_gplus(context, obj_or_url=None, link_text='',link_class=''):\n    context = post_to_gplus_url(context, obj_or_url)\n    context['link_class'] = link_class \n    context['link_text'] = link_text or 'Post to Google+'\n    return context\n\n\n@register.simple_tag(takes_context=True)\ndef send_email_url(context, subject, text, obj_or_url=None):\n    text = compile_text(context, text)\n    subject = compile_text(context, subject)\n    request = context['request']\n    url = _build_url(request, obj_or_url)\n    full_text = \"%s %s\" % (text, url)\n    context['mailto_url'] = MAIL_ENDPOINT % (urlencode(subject), urlencode(full_text))\n    return context\n\n\n@register.inclusion_tag('django_social_share/templatetags/send_email.html', takes_context=True)\ndef send_email(context, subject, text, obj_or_url=None, link_text='',link_class=''):\n    context = send_email_url(context, subject, text, obj_or_url)\n    context['link_class'] = link_class \n    context['link_text'] = link_text or 'Share via email'\n    return context\n\n\n@register.filter(name='linkedin_locale')\ndef linkedin_locale(value):\n    if \"-\" not in value:\n        return value\n\n    lang, country = value.split('-')\n    return '_'.join([lang, country.upper()])\n\n\n@register.simple_tag(takes_context=True)\ndef post_to_linkedin_url(context, obj_or_url=None):\n    request = context['request']\n    url = _build_url(request, obj_or_url)\n    context['linkedin_url'] = url\n    return context\n\n\n@register.inclusion_tag('django_social_share/templatetags/post_to_linkedin.html', takes_context=True)\ndef post_to_linkedin(context, obj_or_url=None,link_class=''):\n    context = post_to_linkedin_url(context, obj_or_url)\n    context['link_class'] = link_class \n    return context\n\n\n@register.simple_tag(takes_context=True)\ndef post_to_reddit_url(context, title, obj_or_url=None):\n    request = context['request']\n    title = compile_text(context, title)\n    url = _build_url(request, obj_or_url)\n    context['reddit_url'] = mark_safe(REDDIT_ENDPOINT % (urlencode(title), urlencode(url)))\n    return context\n\n\n@register.inclusion_tag('django_social_share/templatetags/post_to_reddit.html', takes_context=True)\ndef post_to_reddit(context, title, obj_or_url=None, link_text='',link_class=''):\n    context = post_to_reddit_url(context, title, obj_or_url)\n    context['link_class'] = link_class \n    context['link_text'] = link_text or 'Post to Reddit' \n    return context\n\n\n@register.simple_tag(takes_context=True)\ndef post_to_telegram_url(context, title, obj_or_url):\n    request = context['request']\n    title = compile_text(context, title)\n    url = _build_url(request, obj_or_url)\n    context['telegram_url'] = mark_safe(TELEGRAM_ENDPOINT % (urlencode(title), urlencode(url)))\n    return context\n\n\n@register.inclusion_tag('django_social_share/templatetags/post_to_telegram.html', takes_context=True)\ndef post_to_telegram(context, title, obj_or_url=None, link_text='',link_class=''):\n    context = post_to_telegram_url(context, title, obj_or_url)\n    context['link_class'] = link_class \n    context['link_text'] = link_text or 'Post to Telegram'\n    return context\n\n\n@register.simple_tag(takes_context=True)\ndef post_to_whatsapp_url(context, obj_or_url=None):\n    request = context['request']\n    url = _build_url(request, obj_or_url)\n    context['whatsapp_url'] = WHATSAPP_ENDPOINT % urlencode(url)\n    return context\n\n\n@register.inclusion_tag('django_social_share/templatetags/post_to_whatsapp.html', takes_context=True)\ndef post_to_whatsapp(context, obj_or_url=None, link_text='',link_class=''):\n    context = post_to_whatsapp_url(context, obj_or_url)\n    context['link_class'] = link_class \n    context['link_text'] = link_text or 'Post to WhatsApp'\n    return context\n\n\n@register.simple_tag(takes_context=True)\ndef save_to_pinterest_url(context, obj_or_url=None):\n    request = context['request']\n    url = _build_url(request, obj_or_url)\n    context['pinterest_url'] = PINTEREST_ENDPOINT % urlencode(url)\n    return context\n\n\n@register.inclusion_tag('django_social_share/templatetags/save_to_pinterest.html', takes_context=True)\ndef save_to_pinterest(context, obj_or_url=None, pin_count=False, link_class=''):\n    context = save_to_pinterest_url(context, obj_or_url)\n    context['link_class'] = link_class \n    context['pin_count'] = pin_count\n    return context\n\n\n@register.inclusion_tag('django_social_share/templatetags/pinterest_script.html', takes_context=False)\ndef add_pinterest_script():\n    pass\n\n@register.simple_tag(takes_context=True)\ndef copy_to_clipboard_url(context, obj_or_url=None):\n    request = context['request']\n    url = _build_url(request, obj_or_url)\n    context['copy_url'] = url\n    return context\n\n@register.inclusion_tag('django_social_share/templatetags/copy_to_clipboard.html', takes_context=True)\ndef copy_to_clipboard(context, obj_or_url, link_text='', link_class=''):\n    context = copy_to_clipboard_url(context, obj_or_url)\n    \n    context['link_class'] = link_class\n    context['link_text'] = link_text or 'Copy to clipboard'\n    return context\n\n@register.inclusion_tag('django_social_share/templatetags/copy_script.html', takes_context=False)\ndef add_copy_script():\n    pass"
  },
  {
    "path": "django_social_share/tests/__init__.py",
    "content": "from .tests import *"
  },
  {
    "path": "django_social_share/tests/runtests.py",
    "content": "#!/usr/bin/env python\nimport sys\nimport os\n\nfrom django.conf import settings\n\n# Build paths inside the project like this: os.path.join(BASE_DIR, ...)\nBASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\n\nsettings.configure(\n    SITE_ID=1,\n    DATABASES={\n        'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory;'}\n    },\n    INSTALLED_APPS=[\n        'django.contrib.auth',\n        'django.contrib.sessions',\n        'django.contrib.contenttypes',\n        'django_social_share',\n        'django_social_share.tests',\n    ],\n    TEMPLATES=[\n        {\n            'BACKEND': 'django.template.backends.django.DjangoTemplates',\n            'DIRS': [\n                os.path.join(BASE_DIR, 'templates'),\n            ],\n            'OPTIONS': {\n                'context_processors': [\n                    'django.template.context_processors.request',\n                ],\n            }\n        },\n    ]\n)\n\n\ndef runtests(*test_args):\n    import django\n    try:\n        django.setup()  # Django 1.7+\n    except AttributeError:\n        pass\n    import django.test.utils\n    runner_class = django.test.utils.get_runner(settings)\n    test_runner = runner_class(verbosity=1, interactive=True)\n    failures = test_runner.run_tests(['django_social_share'])\n    sys.exit(failures)\n\n\nif __name__ == '__main__':\n    runtests()\n"
  },
  {
    "path": "django_social_share/tests/tests.py",
    "content": "from django.template import Context, Template\nfrom django.test import TestCase, RequestFactory\n\n\nclass TemplateTagsTest(TestCase):\n\n    def setUp(self):\n        self.factory = RequestFactory()\n        self.context = Context({\n            'url': 'http://example.com',\n            'text': 'example',\n            'subject': 'Example Domain',\n            'link_text':'',\n            'link_class': 'example_class',\n            'request': self.factory.get('/')\n        })\n\n\n    def test_twitter(self):\n        template = Template(\"{% load social_share %} {% post_to_twitter text url %}\")\n        result = template.render(self.context)\n        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'\n        self.assertEqual(result, expected)\n\n    def test_facebook(self):\n        template = Template(\"{% load social_share %} {% post_to_facebook url text %}\")\n        result = template.render(self.context)\n        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'\n        self.assertEqual(result, expected)\n\n    def test_gplus(self):\n        template = Template(\"{% load social_share %} {% post_to_gplus url text %}\")\n        result = template.render(self.context)\n        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'\n        self.assertEqual(result, expected)\n\n    def test_mail_url(self):\n        template = Template(\"{% load social_share %} {% send_email_url subject text url %}\")\n        template.render(self.context)\n        expected = 'mailto:?subject=Example%20Domain&body=example%20http%3A//example.com'\n        self.assertEqual(self.context['mailto_url'], expected)\n\n    def test_mail(self):\n        template = Template(\"{% load social_share %} {% send_email subject text url %}\")\n        result = template.render(self.context)\n        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'\n        self.assertEqual(result, expected)\n\n    def test_linkedin(self):\n        template = Template(\"{% load social_share %} {% post_to_linkedin url %}\")\n        result = template.render(self.context)\n        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'\n        self.assertEqual(result, expected)\n\n    def test_reddit(self):\n        template = Template(\"{% load social_share %} {% post_to_reddit text url text %}\")\n        result = template.render(self.context)\n        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'\n        self.assertEqual(result, expected)\n\n    def test_telegram(self):\n        template = Template(\"{% load social_share %} {% post_to_telegram text url text %}\")\n        result = template.render(self.context)\n        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'\n        self.assertEqual(result, expected)\n\n    def test_whatsapp(self):\n        template = Template(\"{% load social_share %} {% post_to_whatsapp url text %}\")\n        result = template.render(self.context)\n        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'\n        self.assertEqual(result, expected)\n\n    def test_pinterest(self):\n        template = Template(\"{% load social_share %} {% save_to_pinterest url %}\")\n        result = template.render(self.context)\n        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'\n        self.assertEqual(result, expected)\n\n    def test_pinterest_script(self):\n        template = Template(\"{% load social_share %} {% add_pinterest_script %}\")\n        result = template.render(self.context)\n        expected = ' <script async defer src=\"https://assets.pinterest.com/js/pinit.js\"></script>\\n'\n        self.assertEqual(result, expected)\n\n    def test_clipboard(self):\n        template = Template(\"{% load social_share %} {% copy_to_clipboard url %}\")\n        result = template.render(self.context)\n        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'\n        self.assertEqual(result, expected)\n\n    def test_twitter_with_class(self):\n        template = Template(\"{% load social_share %} {% post_to_twitter text url  link_text link_class %}\")\n        result = template.render(self.context)\n        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'\n        self.assertEqual(result, expected)\n\n    def test_facebook_with_class(self):\n        template = Template(\"{% load social_share %} {% post_to_facebook url text link_class %}\")\n        result = template.render(self.context)\n        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'\n        self.assertEqual(result, expected)\n\n    def test_gplus_with_class(self):\n        template = Template(\"{% load social_share %} {% post_to_gplus url text link_class %}\")\n        result = template.render(self.context)\n        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'\n        self.assertEqual(result, expected)\n\n    def test_mail_with_class(self):\n        template = Template(\"{% load social_share %} {% send_email subject text url link_text link_class %}\")\n        result = template.render(self.context)\n        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'\n        self.assertEqual(result, expected)\n\n    def test_linkedin_with_class(self):\n        template = Template(\"{% load social_share %} {% post_to_linkedin url link_class %}\")\n        result = template.render(self.context)\n        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'\n        self.assertEqual(result, expected)\n\n    def test_reddit_with_class(self):\n        template = Template(\"{% load social_share %} {% post_to_reddit text url text link_class %}\")\n        result = template.render(self.context)\n        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'\n        self.assertEqual(result, expected)\n\n    def test_telegram_with_class(self):\n        template = Template(\"{% load social_share %} {% post_to_telegram text url text link_class %}\")\n        result = template.render(self.context)\n        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'\n        self.assertEqual(result, expected)\n\n    def test_whatsapp_with_class(self):\n        template = Template(\"{% load social_share %} {% post_to_whatsapp url text link_class %}\")\n        result = template.render(self.context)\n        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'\n        self.assertEqual(result, expected)\n\n    def test_pinterest_with_class(self):\n        template = Template(\"{% load social_share %} {% save_to_pinterest url  False link_class %}\")\n        result = template.render(self.context)\n        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'\n        self.assertEqual(result, expected)\n\n    def test_clipboard_with_class(self):\n        template = Template(\"{% load social_share %} {% copy_to_clipboard url text link_class %}\")\n        result = template.render(self.context)\n        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'\n        self.assertEqual(result, expected)"
  },
  {
    "path": "django_social_share/views.py",
    "content": "#  Views.py\n"
  },
  {
    "path": "setup.cfg",
    "content": "[nosetests]\nwith-coverage = true\ncover-package = recommends\ncover-html = true\ncover-erase = true\ncover-inclusive = true\n\n[metadata]\nlicense_file = LICENSE\n\n[wheel]\nuniversal = 1\n"
  },
  {
    "path": "setup.py",
    "content": "import io\nimport os\nfrom setuptools import setup, find_packages\n\n\nhere = os.path.abspath(os.path.dirname(__file__))\n\nwith io.open(os.path.join(here, 'README.rst'), encoding='utf-8') as fp:\n    README = fp.read()\n\nwith open(os.path.join(here, 'VERSION')) as version_file:\n    version = version_file.read().strip()\n\nrequirements = []\ntest_requirements = [\n    \"Django>=2.0\",\n]\n\nsetup(\n    name=\"django-social-share\",\n    version=version,\n    description=\"Templatetags for 'tweet this' and 'share on facebook'\",\n    long_description=README,\n    url='https://github.com/fcurella/django-social-share',\n    license='MIT',\n    author='Flavio Curella',\n    author_email='flavio.curella@curella.org',\n    packages=find_packages(exclude=['tests']),\n    include_package_data=True,\n    classifiers=[\n        'Development Status :: 3 - Alpha',\n        'Environment :: Console',\n        'Intended Audience :: Developers',\n        'Intended Audience :: Information Technology',\n        'License :: OSI Approved :: MIT License',\n        'Operating System :: OS Independent',\n        'Programming Language :: Python',\n        'Framework :: Django',\n    ],\n    install_requires=requirements,\n    tests_require=test_requirements,\n    test_suite='django_social_share.tests.runtests.runtests'\n)\n"
  }
]