Last active
June 21, 2017 05:27
-
-
Save pirafrank/e0db410304d6543a78bdf713b1f5c118 to your computer and use it in GitHub Desktop.
Pythonista script to replace custom domain urls with site.baseurl in jekyll posts.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! python2 | |
# | |
# Pythonista script to replace custom domain urls with site.baseurl in jekyll posts. | |
# Usage: from a text editor app, share text to this script. It will return 'jekyllfied' | |
# text in another share popup. See it in action: | |
# | |
# @Author | |
# Francesco Pira (dev at fpira dot com) | |
# | |
import sys | |
import appex | |
import console | |
import dialogs | |
# write here your domain | |
stable_url = 'https://fpira.com' | |
test_url = 'http://test.fpira.com' | |
# the actual script | |
if not appex.is_running_extension(): | |
console.hud_alert("Error: This script only runs as extension",'error',3) | |
sys.exit() | |
text = appex.get_text() | |
text = text.replace(stable_url,'{{ site.baseurl }}') | |
text = text.replace(test_url,'{{ site.baseurl }}') | |
dialogs.share_text(text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment