5 |
6 |
7 |
18 |
19 |
20 |
21 |
22 |
Capture any web page, or just part of it.
23 |
24 |
25 |
26 |
27 | frag2text examples
29 | | URL
30 | | stype
31 | | selector
32 | |
33 | A NYT Article:
34 | | http://nyti.ms/17qJGw4
35 | | CSS
36 | | article
37 | |
38 | A Wikipedia Infobox:
39 | | http://en.wikipedia.org/wiki/Amanita
40 | | CSS
41 | | .infobox
42 | |
43 | A specific paragraph:
44 | | http://en.wikipedia.org/wiki/Amanita
45 | | XPath
46 | | //p[13]
47 | |
48 |
49 |
50 |
51 |
52 | {% endblock %}
53 |
--------------------------------------------------------------------------------
/templates/delete.html:
--------------------------------------------------------------------------------
1 | {% extends "layout.html" %}
2 | {% block body %}
3 |
4 |
7 | {{entry.date_str}}
8 | {% if entry.tags %}
9 | {% for tag in entry.tags %}
10 |
#{{tag}}
11 | {% endfor %}
12 | {% endif %}
13 |
14 | {% endif %}
15 |
16 |
5 |
6 |
7 | {% if images %}
8 | {{entries|length()}}
#{{tag}}
9 | | gallery ({{images|length()}})
10 | {% else %}
11 | No images found in ({{entries|length()}})
12 | #
{{tag}} entries.
13 | {% endif %}
14 |
15 |
16 |
17 | {% set count = 1 %}
18 | {% for entry in entries %}
19 | {% if entry.img %}
20 |

22 | {% endif %}
23 | {% set count = count + 1 %}
24 | {% endfor %}
25 |
26 |
27 |
28 | {% endblock %}
29 |
--------------------------------------------------------------------------------
/templates/header.html:
--------------------------------------------------------------------------------
1 |
80 |
--------------------------------------------------------------------------------
/templates/help.html:
--------------------------------------------------------------------------------
1 | {% extends "layout.html" %}
2 | {% block body %}
3 | {% include "header.html" %}
4 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | latest
13 | {% if latest %}
14 | {% for entry in latest %}
15 | - {{entry.title}}
16 | {% endfor %}
17 | {% else %}
18 |
- Latest entries will be listed here.
19 | {% endif %}
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | pinned ({{pinned|length()}})
28 | {% if pinned %}
29 | {% for entry in pinned[:10] %}
30 | - {{entry.title}}
31 | {% endfor %}
32 | {% else %}
33 |
- Entries tagged "pinned" will be listed here.
34 | {% endif %}
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | readme ({{readme|length()}})
45 | {% if readme %}
46 | {% for entry in readme[:10] %}
47 | - {{entry.title}}
48 | {% endfor %}
49 | {% else %}
50 |
- Entries tagged "readme" will be listed here.
51 | {% endif %}
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | todo ({{todo|length()}})
60 | {% if todo %}
61 | {% for entry in todo[:10] %}
62 | - {{entry.title}}
63 | {% endfor %}
64 | {% else %}
65 |
- Entries tagged "todo" will be listed here.
66 | {% endif %}
67 |
68 |
69 |
70 |
71 | {% if tag_set %}
{% endif %}
72 |
73 |
74 |
75 | {% include "tag_set.html" %}
76 |
77 |
78 |
79 |
84 |
85 |
86 |
87 | {% endblock %}
88 |
--------------------------------------------------------------------------------
/templates/layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 | {% if entries %}
8 |
9 |
10 | {% if tag %}{{entries|length()}} #{{tag}}
11 | |
gallery{% endif %}
12 | {% if notag %}({{entries|length()}}) entries not tagged{% endif %}
13 | {% if terms %}found ({{entries|length()}}) matching "{{terms}}"{% endif %}
14 | {% if mediatype %}{{entries|length()}}
{{mediatype}} media{% endif %}
15 | {% if request.path=='/list' or request.path=='/updates'%}
16 | {{entries|length()}} entries by date
17 | {% endif %}
18 | {% if request.path=='/list' %}
19 | created |
updated
20 | {% endif %}
21 | {% if request.path=='/updates' %}
22 | updated |
created
23 | {% endif %}
24 |
25 |
26 |
27 |
28 | {% if not '/list' in request.path %}
{% endif %}
29 |
30 | {% for entry in entries %}
31 |
32 | {% if '/list' in request.path %}
33 | {% if not entry.month == last_month %}
34 | {% if last_month %}
{% endif %}
35 |
{{entry.month}} {{entry.year}}
36 | {% endif %}
37 | {% endif %}
38 |
39 | {% if request.path.startswith('/list') %}
40 | -
41 | {% else %}
42 |
-
43 | {% endif %}
44 | {{entry.title}}
45 | {% if entry.media %}- {{entry.media|safe}}{% endif %}
46 |
47 |
48 | {% set last_month = entry.month %}
49 | {% endfor %}
50 |
51 |
52 |
53 |
54 | {% else %}
55 |
56 |
57 | {% if terms %}No entries found matching "{{terms}}"{% endif %}
58 | {% if tag %}No entries tagged "{{tag}}"{% endif %}
59 |
60 |
61 | {% endif %}
62 |
63 |
64 |
65 | {% endblock %}
66 |
--------------------------------------------------------------------------------
/templates/media.html:
--------------------------------------------------------------------------------
1 | {% extends "layout.html" %}
2 | {% block body %}
3 | {% include "header.html" %}
4 |
5 |
5 |
6 |
12 |
13 | {% include "tag_set.html" %}
14 |
15 |
16 |
17 |
18 | {% endblock %}
19 |
20 |
--------------------------------------------------------------------------------
/templates/tag_set.html:
--------------------------------------------------------------------------------
1 |
6 |
7 |
{{tag_set|length()}} tags
8 |
9 | {% if tag_set %}
10 | {% include "tag_set.html" %}
11 | {% else %}
12 |
No tags yet!
13 | {% endif %}
14 |
15 |
16 |
17 | {% endblock %}
18 |
--------------------------------------------------------------------------------
/views.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from flask import request, redirect, url_for
4 | from flask.ext.bower import Bower
5 | from lib import Tanuki
6 | from tanuki import app, settings
7 |
8 | __author__ = "siznax"
9 | __date__ = "Jan 2015"
10 |
11 | app.config.from_object(settings.DefaultConfig)
12 | if '/var/www/' in os.getcwd():
13 | app.config.from_object(settings.ProductionConfig)
14 |
15 | Bower(app)
16 | applib = Tanuki(app.config)
17 |
18 |
19 | @app.before_request
20 | def before_request():
21 | if '/static' not in request.path:
22 | applib.db_connect()
23 | applib.get_status()
24 |
25 |
26 | @app.teardown_request
27 | def teardown_request(exception):
28 | if '/static' not in request.path:
29 | applib.db_disconnect()
30 |
31 |
32 | @app.route('/')
33 | def index():
34 | return applib.render_index()
35 |
36 |
37 | @app.route('/favicon.ico')
38 | def favicon():
39 | return app.send_static_file("favicon.ico")
40 |
41 |
42 | @app.route('/list')
43 | def list():
44 | return applib.render_list()
45 |
46 |
47 | @app.route('/updates')
48 | def updates():
49 | return applib.render_list_by_updated()
50 |
51 |
52 | @app.route('/media')
53 | def media_count():
54 | return applib.render_media_count()
55 |
56 |
57 | @app.route('/media/