Skip to content

Commit

Permalink
Add filter to absolutize img urls in API
Browse files Browse the repository at this point in the history
  • Loading branch information
Artaud committed Jan 9, 2019
1 parent aea579f commit d887e84
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 24 deletions.
9 changes: 9 additions & 0 deletions _plugins/absolutize_img_urls.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Jekyll
module AbsolutizeImgUrls
def absolutize_img_urls(text)
text.gsub(/src="\/assets\/img\//, 'src="https://dontkillmyapp.com/assets/img/')
end
end
end

Liquid::Template.register_filter(Jekyll::AbsolutizeImgUrls)
8 changes: 4 additions & 4 deletions _site/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
<meta property="og:locale" content="en_US" />
<meta name="description" content="Hey Android vendors, don’t kill my app!" />
<meta property="og:description" content="Hey Android vendors, don’t kill my app!" />
<link rel="canonical" href="http://localhost:4000/404.html" />
<meta property="og:url" content="http://localhost:4000/404.html" />
<link rel="canonical" href="https://dontkillmyapp.com/404.html" />
<meta property="og:url" content="https://dontkillmyapp.com/404.html" />
<meta property="og:site_name" content="Don’t kill my app!" />
<script type="application/ld+json">
{"description":"Hey Android vendors, don’t kill my app!","@type":"WebPage","url":"http://localhost:4000/404.html","headline":"Don’t kill my app!","@context":"http://schema.org"}</script>
{"description":"Hey Android vendors, don’t kill my app!","@type":"WebPage","url":"https://dontkillmyapp.com/404.html","headline":"Don’t kill my app!","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<link rel="stylesheet" href="/assets/main.css">
<link rel="stylesheet" href="/assets/css/style.css"><link type="application/atom+xml" rel="alternate" href="http://localhost:4000/feed.xml" title="Don't kill my app!" /></head>
<link rel="stylesheet" href="/assets/css/style.css"><link type="application/atom+xml" rel="alternate" href="https://dontkillmyapp.com/feed.xml" title="Don't kill my app!" /></head>
<body><header class="site-header" role="banner">

<div class="wrapper">
Expand Down
2 changes: 1 addition & 1 deletion _site/feed.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.8.5">Jekyll</generator><link href="http://localhost:4000/feed.xml" rel="self" type="application/atom+xml" /><link href="http://localhost:4000/" rel="alternate" type="text/html" /><updated>2019-01-09T06:18:19+01:00</updated><id>http://localhost:4000/feed.xml</id><title type="html">Don’t kill my app!</title><subtitle>Hey Android vendors, don't kill my app!</subtitle><entry><title type="html">Welcome to Jekyll my ass!</title><link href="http://localhost:4000/jekyll/update/2018/12/19/welcome-to-jekyll.html" rel="alternate" type="text/html" title="Welcome to Jekyll my ass!" /><published>2018-12-19T07:28:35+01:00</published><updated>2018-12-19T07:28:35+01:00</updated><id>http://localhost:4000/jekyll/update/2018/12/19/welcome-to-jekyll</id><content type="html" xml:base="http://localhost:4000/jekyll/update/2018/12/19/welcome-to-jekyll.html">&lt;p&gt;You’ll find this post in your &lt;code class=&quot;highlighter-rouge&quot;&gt;_posts&lt;/code&gt; directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run &lt;code class=&quot;highlighter-rouge&quot;&gt;jekyll serve&lt;/code&gt;, which launches a web server and auto-regenerates your site when a file is updated.&lt;/p&gt;
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.8.5">Jekyll</generator><link href="https://dontkillmyapp.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://dontkillmyapp.com/" rel="alternate" type="text/html" /><updated>2019-01-09T07:32:20+01:00</updated><id>https://dontkillmyapp.com/feed.xml</id><title type="html">Don’t kill my app!</title><subtitle>Hey Android vendors, don't kill my app!</subtitle><entry><title type="html">Welcome to Jekyll my ass!</title><link href="https://dontkillmyapp.com/jekyll/update/2018/12/19/welcome-to-jekyll.html" rel="alternate" type="text/html" title="Welcome to Jekyll my ass!" /><published>2018-12-19T07:28:35+01:00</published><updated>2018-12-19T07:28:35+01:00</updated><id>https://dontkillmyapp.com/jekyll/update/2018/12/19/welcome-to-jekyll</id><content type="html" xml:base="https://dontkillmyapp.com/jekyll/update/2018/12/19/welcome-to-jekyll.html">&lt;p&gt;You’ll find this post in your &lt;code class=&quot;highlighter-rouge&quot;&gt;_posts&lt;/code&gt; directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run &lt;code class=&quot;highlighter-rouge&quot;&gt;jekyll serve&lt;/code&gt;, which launches a web server and auto-regenerates your site when a file is updated.&lt;/p&gt;

&lt;p&gt;To add new posts, simply add a file in the &lt;code class=&quot;highlighter-rouge&quot;&gt;_posts&lt;/code&gt; directory that follows the convention &lt;code class=&quot;highlighter-rouge&quot;&gt;YYYY-MM-DD-name-of-post.ext&lt;/code&gt; and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.&lt;/p&gt;

Expand Down
8 changes: 4 additions & 4 deletions _site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
<meta property="og:locale" content="en_US" />
<meta name="description" content="Hey Android vendors, don’t kill my app!" />
<meta property="og:description" content="Hey Android vendors, don’t kill my app!" />
<link rel="canonical" href="http://localhost:4000/" />
<meta property="og:url" content="http://localhost:4000/" />
<link rel="canonical" href="https://dontkillmyapp.com/" />
<meta property="og:url" content="https://dontkillmyapp.com/" />
<meta property="og:site_name" content="Don’t kill my app!" />
<script type="application/ld+json">
{"description":"Hey Android vendors, don’t kill my app!","@type":"WebSite","name":"Don’t kill my app!","url":"http://localhost:4000/","headline":"Don’t kill my app!","@context":"http://schema.org"}</script>
{"description":"Hey Android vendors, don’t kill my app!","@type":"WebSite","name":"Don’t kill my app!","url":"https://dontkillmyapp.com/","headline":"Don’t kill my app!","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<link rel="stylesheet" href="/assets/main.css">
<link rel="stylesheet" href="/assets/css/style.css"><link type="application/atom+xml" rel="alternate" href="http://localhost:4000/feed.xml" title="Don't kill my app!" /></head>
<link rel="stylesheet" href="/assets/css/style.css"><link type="application/atom+xml" rel="alternate" href="https://dontkillmyapp.com/feed.xml" title="Don't kill my app!" /></head>
<body><header class="site-header" role="banner">

<div class="wrapper">
Expand Down
8 changes: 4 additions & 4 deletions _site/jekyll/update/2018/12/19/welcome-to-jekyll.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
<meta property="og:locale" content="en_US" />
<meta name="description" content="You’ll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run jekyll serve, which launches a web server and auto-regenerates your site when a file is updated." />
<meta property="og:description" content="You’ll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run jekyll serve, which launches a web server and auto-regenerates your site when a file is updated." />
<link rel="canonical" href="http://localhost:4000/jekyll/update/2018/12/19/welcome-to-jekyll.html" />
<meta property="og:url" content="http://localhost:4000/jekyll/update/2018/12/19/welcome-to-jekyll.html" />
<link rel="canonical" href="https://dontkillmyapp.com/jekyll/update/2018/12/19/welcome-to-jekyll.html" />
<meta property="og:url" content="https://dontkillmyapp.com/jekyll/update/2018/12/19/welcome-to-jekyll.html" />
<meta property="og:site_name" content="Don’t kill my app!" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2018-12-19T07:28:35+01:00" />
<script type="application/ld+json">
{"description":"You’ll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run jekyll serve, which launches a web server and auto-regenerates your site when a file is updated.","mainEntityOfPage":{"@type":"WebPage","@id":"http://localhost:4000/jekyll/update/2018/12/19/welcome-to-jekyll.html"},"@type":"BlogPosting","url":"http://localhost:4000/jekyll/update/2018/12/19/welcome-to-jekyll.html","headline":"Welcome to Jekyll my ass!","dateModified":"2018-12-19T07:28:35+01:00","datePublished":"2018-12-19T07:28:35+01:00","@context":"http://schema.org"}</script>
{"description":"You’ll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run jekyll serve, which launches a web server and auto-regenerates your site when a file is updated.","mainEntityOfPage":{"@type":"WebPage","@id":"https://dontkillmyapp.com/jekyll/update/2018/12/19/welcome-to-jekyll.html"},"@type":"BlogPosting","url":"https://dontkillmyapp.com/jekyll/update/2018/12/19/welcome-to-jekyll.html","headline":"Welcome to Jekyll my ass!","dateModified":"2018-12-19T07:28:35+01:00","datePublished":"2018-12-19T07:28:35+01:00","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<link rel="stylesheet" href="/assets/main.css">
<link rel="stylesheet" href="/assets/css/style.css"><link type="application/atom+xml" rel="alternate" href="http://localhost:4000/feed.xml" title="Don't kill my app!" /></head>
<link rel="stylesheet" href="/assets/css/style.css"><link type="application/atom+xml" rel="alternate" href="https://dontkillmyapp.com/feed.xml" title="Don't kill my app!" /></head>
<body><header class="site-header" role="banner">

<div class="wrapper">
Expand Down
8 changes: 4 additions & 4 deletions _site/problem/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
<meta property="og:locale" content="en_US" />
<meta name="description" content="Smartphones are turning back into dumbphones. We have to fight back! To squeeze a little extra battery out of your phone, Android device vendors listed below (with their pooper score) cripple apps and make them useless. Read more" />
<meta property="og:description" content="Smartphones are turning back into dumbphones. We have to fight back! To squeeze a little extra battery out of your phone, Android device vendors listed below (with their pooper score) cripple apps and make them useless. Read more" />
<link rel="canonical" href="http://localhost:4000/problem/" />
<meta property="og:url" content="http://localhost:4000/problem/" />
<link rel="canonical" href="https://dontkillmyapp.com/problem/" />
<meta property="og:url" content="https://dontkillmyapp.com/problem/" />
<meta property="og:site_name" content="Don’t kill my app!" />
<script type="application/ld+json">
{"description":"Smartphones are turning back into dumbphones. We have to fight back! To squeeze a little extra battery out of your phone, Android device vendors listed below (with their pooper score) cripple apps and make them useless. Read more","@type":"WebPage","url":"http://localhost:4000/problem/","headline":"Our mission","@context":"http://schema.org"}</script>
{"description":"Smartphones are turning back into dumbphones. We have to fight back! To squeeze a little extra battery out of your phone, Android device vendors listed below (with their pooper score) cripple apps and make them useless. Read more","@type":"WebPage","url":"https://dontkillmyapp.com/problem/","headline":"Our mission","@context":"http://schema.org"}</script>
<!-- End Jekyll SEO tag -->
<link rel="stylesheet" href="/assets/main.css">
<link rel="stylesheet" href="/assets/css/style.css"><link type="application/atom+xml" rel="alternate" href="http://localhost:4000/feed.xml" title="Don't kill my app!" /></head>
<link rel="stylesheet" href="/assets/css/style.css"><link type="application/atom+xml" rel="alternate" href="https://dontkillmyapp.com/feed.xml" title="Don't kill my app!" /></head>
<body><header class="site-header" role="banner">

<div class="wrapper">
Expand Down
3 changes: 1 addition & 2 deletions _vendors/xiaomi.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ user_solution: '
To let your app run successfully in the background, make sure your settings look like the following (here for example is Sleep as Android):
<img src="/assets/img/ss_xiaomi_1.png">
### Power management
Please enable:
Expand Down Expand Up @@ -54,4 +53,4 @@ When you open recent apps tray, drag your app downwards – it will be locked. S
'

developer_solution: "At the moment we don't know of any solution on dev end."
---
---
12 changes: 7 additions & 5 deletions api/v1/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
limit: 100
---
{"vendors": [
{% for vendor in site.vendors limit: page.limit %}
{% assign sorted_vendors = site.vendors | sort: "award" | reverse %}
{% for vendor in sorted_vendors limit: page.limit %}
{
"name": {{ vendor.name | jsonify }},
"name": {{ vendor.name | jsonify}},
"url": {{ vendor.url | jsonify }},
"explanation": {{ vendor.explanation | markdownify | jsonify }},
"user_solution": {{ vendor.user_solution | markdownify | jsonify }},
"developer_solution": {{ vendor.developer_solution | markdownify | jsonify }}
"award": {{ vendor.award | jsonify }},
"explanation": {{ vendor.explanation | markdownify | absolutize_img_urls | jsonify}},
"user_solution": {{ vendor.user_solution | markdownify | absolutize_img_urls | jsonify }},
"developer_solution": {{ vendor.developer_solution | markdownify | absolutize_img_urls | jsonify }}
}
{% unless forloop.last %},{% endunless %}
{% endfor %}
Expand Down

0 comments on commit d887e84

Please sign in to comment.