├── .gitignore
├── Procfile
├── README.md
├── blog
├── __init__.py
├── admin.py
├── apps.py
├── commons
│ ├── __init__.py
│ ├── cache_manager.py
│ ├── context_processors.py
│ └── utils.py
├── forms.py
├── models.py
├── search_indexes.py
├── templates
│ ├── blog
│ │ ├── page_detail.html
│ │ ├── post_detail.html
│ │ ├── post_draft_list.html
│ │ ├── post_edit.html
│ │ ├── post_list.html
│ │ └── post_search_list.html
│ └── search
│ │ ├── indexes
│ │ └── blog
│ │ │ └── post_text.txt
│ │ └── search.html
├── templatetags
│ ├── __init__.py
│ └── blog_tags.py
├── tests.py
├── urls.py
├── views.py
└── whoosh_cn_backend.py
├── locale
└── zh_CN
│ └── LC_MESSAGES
│ ├── django.mo
│ └── django.po
├── manage.py
├── mysite
├── __init__.py
├── settings.py
├── templates
│ ├── __init__.py
│ ├── mysite
│ │ └── base.html
│ └── registration
│ │ └── login.html
├── urls.py
└── wsgi.py
├── requirements.txt
├── runtime.txt
├── static
├── css
│ ├── blog.css
│ ├── bootstrap-theme.min.css
│ ├── bootstrap.min.css
│ └── login.css
├── fonts
│ ├── glyphicons-halflings-regular.eot
│ ├── glyphicons-halflings-regular.svg
│ ├── glyphicons-halflings-regular.ttf
│ └── glyphicons-halflings-regular.woff
├── img
│ ├── arrow.gif
│ ├── bg.jpg
│ ├── blockquote.gif
│ ├── box.gif
│ ├── box_1col.gif
│ ├── comment.gif
│ ├── comment_1col.gif
│ ├── commentpoint.png
│ ├── digg_bottom.gif
│ ├── digged_bottom.gif
│ ├── feeds.gif
│ ├── footer_990.jpg
│ ├── icons.gif
│ ├── light.gif
│ ├── main_shadow.gif
│ ├── menu.gif
│ ├── messagebox.gif
│ ├── messagebox_1col.gif
│ ├── postbox.gif
│ ├── postbox_1col.gif
│ ├── readers.gif
│ ├── searchbox.gif
│ ├── sidebar_shadow.gif
│ ├── sidesep.gif
│ ├── spinner.gif
│ ├── textfield.gif
│ ├── title.gif
│ ├── widgetsep.png
│ └── wp-logo.png
├── index.html
├── js
│ ├── base.js
│ ├── bootstrap.min.js
│ └── jquery-1.11.1.min.js
├── syntaxhighlighter
│ ├── compass
│ │ ├── _theme_template.scss
│ │ ├── config.rb
│ │ ├── shCore.scss
│ │ ├── shCoreDefault.scss
│ │ ├── shCoreDjango.scss
│ │ ├── shCoreEclipse.scss
│ │ ├── shCoreEmacs.scss
│ │ ├── shCoreFadeToGrey.scss
│ │ ├── shCoreMDUltra.scss
│ │ ├── shCoreMidnight.scss
│ │ ├── shCoreRDark.scss
│ │ ├── shThemeDefault.scss
│ │ ├── shThemeDjango.scss
│ │ ├── shThemeEclipse.scss
│ │ ├── shThemeEmacs.scss
│ │ ├── shThemeFadeToGrey.scss
│ │ ├── shThemeMDUltra.scss
│ │ ├── shThemeMidnight.scss
│ │ └── shThemeRDark.scss
│ ├── index.html
│ ├── scripts
│ │ ├── shAutoloader.js
│ │ ├── shBrushAS3.js
│ │ ├── shBrushAppleScript.js
│ │ ├── shBrushBash.js
│ │ ├── shBrushCSharp.js
│ │ ├── shBrushColdFusion.js
│ │ ├── shBrushCpp.js
│ │ ├── shBrushCss.js
│ │ ├── shBrushDelphi.js
│ │ ├── shBrushDiff.js
│ │ ├── shBrushErlang.js
│ │ ├── shBrushGroovy.js
│ │ ├── shBrushJScript.js
│ │ ├── shBrushJava.js
│ │ ├── shBrushJavaFX.js
│ │ ├── shBrushPerl.js
│ │ ├── shBrushPhp.js
│ │ ├── shBrushPlain.js
│ │ ├── shBrushPowerShell.js
│ │ ├── shBrushPython.js
│ │ ├── shBrushRuby.js
│ │ ├── shBrushSass.js
│ │ ├── shBrushScala.js
│ │ ├── shBrushSql.js
│ │ ├── shBrushVb.js
│ │ ├── shBrushXml.js
│ │ ├── shCore.js
│ │ └── shLegacy.js
│ ├── src
│ │ ├── shAutoloader.js
│ │ ├── shCore.js
│ │ └── shLegacy.js
│ └── styles
│ │ ├── shCore.css
│ │ ├── shCoreDefault.css
│ │ ├── shCoreDjango.css
│ │ ├── shCoreEclipse.css
│ │ ├── shCoreEmacs.css
│ │ ├── shCoreFadeToGrey.css
│ │ ├── shCoreMDUltra.css
│ │ ├── shCoreMidnight.css
│ │ ├── shCoreRDark.css
│ │ ├── shThemeDefault.css
│ │ ├── shThemeDjango.css
│ │ ├── shThemeEclipse.css
│ │ ├── shThemeEmacs.css
│ │ ├── shThemeFadeToGrey.css
│ │ ├── shThemeMDUltra.css
│ │ ├── shThemeMidnight.css
│ │ └── shThemeRDark.css
└── tinymce
│ ├── LICENSE.TXT
│ ├── changelog.txt
│ ├── js
│ ├── index.html
│ └── tinymce
│ │ ├── langs
│ │ └── readme.md
│ │ ├── license.txt
│ │ ├── plugins
│ │ ├── advlist
│ │ │ └── plugin.min.js
│ │ ├── anchor
│ │ │ └── plugin.min.js
│ │ ├── autolink
│ │ │ └── plugin.min.js
│ │ ├── autoresize
│ │ │ └── plugin.min.js
│ │ ├── autosave
│ │ │ └── plugin.min.js
│ │ ├── bbcode
│ │ │ └── plugin.min.js
│ │ ├── charmap
│ │ │ └── plugin.min.js
│ │ ├── code
│ │ │ └── plugin.min.js
│ │ ├── colorpicker
│ │ │ └── plugin.min.js
│ │ ├── contextmenu
│ │ │ └── plugin.min.js
│ │ ├── directionality
│ │ │ └── plugin.min.js
│ │ ├── emoticons
│ │ │ ├── img
│ │ │ │ ├── smiley-cool.gif
│ │ │ │ ├── smiley-cry.gif
│ │ │ │ ├── smiley-embarassed.gif
│ │ │ │ ├── smiley-foot-in-mouth.gif
│ │ │ │ ├── smiley-frown.gif
│ │ │ │ ├── smiley-innocent.gif
│ │ │ │ ├── smiley-kiss.gif
│ │ │ │ ├── smiley-laughing.gif
│ │ │ │ ├── smiley-money-mouth.gif
│ │ │ │ ├── smiley-sealed.gif
│ │ │ │ ├── smiley-smile.gif
│ │ │ │ ├── smiley-surprised.gif
│ │ │ │ ├── smiley-tongue-out.gif
│ │ │ │ ├── smiley-undecided.gif
│ │ │ │ ├── smiley-wink.gif
│ │ │ │ └── smiley-yell.gif
│ │ │ └── plugin.min.js
│ │ ├── example
│ │ │ ├── dialog.html
│ │ │ └── plugin.min.js
│ │ ├── example_dependency
│ │ │ └── plugin.min.js
│ │ ├── fullpage
│ │ │ └── plugin.min.js
│ │ ├── fullscreen
│ │ │ └── plugin.min.js
│ │ ├── hr
│ │ │ └── plugin.min.js
│ │ ├── image
│ │ │ └── plugin.min.js
│ │ ├── importcss
│ │ │ └── plugin.min.js
│ │ ├── insertdatetime
│ │ │ └── plugin.min.js
│ │ ├── layer
│ │ │ └── plugin.min.js
│ │ ├── legacyoutput
│ │ │ └── plugin.min.js
│ │ ├── link
│ │ │ └── plugin.min.js
│ │ ├── lists
│ │ │ └── plugin.min.js
│ │ ├── media
│ │ │ ├── moxieplayer.swf
│ │ │ └── plugin.min.js
│ │ ├── nonbreaking
│ │ │ └── plugin.min.js
│ │ ├── noneditable
│ │ │ └── plugin.min.js
│ │ ├── pagebreak
│ │ │ └── plugin.min.js
│ │ ├── paste
│ │ │ └── plugin.min.js
│ │ ├── preview
│ │ │ └── plugin.min.js
│ │ ├── print
│ │ │ └── plugin.min.js
│ │ ├── save
│ │ │ └── plugin.min.js
│ │ ├── searchreplace
│ │ │ └── plugin.min.js
│ │ ├── sh4tinymce
│ │ │ ├── fonts
│ │ │ │ ├── sh4tinymce.dev.svg
│ │ │ │ ├── sh4tinymce.eot
│ │ │ │ ├── sh4tinymce.svg
│ │ │ │ ├── sh4tinymce.ttf
│ │ │ │ └── sh4tinymce.woff
│ │ │ ├── langs
│ │ │ │ ├── en.js
│ │ │ │ └── fr_FR.js
│ │ │ ├── plugin.js
│ │ │ ├── plugin.min.js
│ │ │ └── style
│ │ │ │ └── style.css
│ │ ├── spellchecker
│ │ │ └── plugin.min.js
│ │ ├── tabfocus
│ │ │ └── plugin.min.js
│ │ ├── table
│ │ │ └── plugin.min.js
│ │ ├── template
│ │ │ └── plugin.min.js
│ │ ├── textcolor
│ │ │ └── plugin.min.js
│ │ ├── textpattern
│ │ │ └── plugin.min.js
│ │ ├── upload
│ │ │ ├── plugin.css
│ │ │ ├── plugin.min.js
│ │ │ └── upload_icon.png
│ │ ├── visualblocks
│ │ │ ├── css
│ │ │ │ └── visualblocks.css
│ │ │ └── plugin.min.js
│ │ ├── visualchars
│ │ │ └── plugin.min.js
│ │ └── wordcount
│ │ │ └── plugin.min.js
│ │ ├── skins
│ │ └── lightgray
│ │ │ ├── content.inline.min.css
│ │ │ ├── content.min.css
│ │ │ ├── fonts
│ │ │ ├── tinymce-small.eot
│ │ │ ├── tinymce-small.svg
│ │ │ ├── tinymce-small.ttf
│ │ │ ├── tinymce-small.woff
│ │ │ ├── tinymce.eot
│ │ │ ├── tinymce.svg
│ │ │ ├── tinymce.ttf
│ │ │ └── tinymce.woff
│ │ │ ├── img
│ │ │ ├── anchor.gif
│ │ │ ├── loader.gif
│ │ │ ├── object.gif
│ │ │ └── trans.gif
│ │ │ ├── skin.ie7.min.css
│ │ │ └── skin.min.css
│ │ ├── themes
│ │ └── modern
│ │ │ └── theme.min.js
│ │ └── tinymce.min.js
│ ├── langs
│ └── readme.md
│ ├── plugins
│ ├── addmore
│ │ └── plugin.min.js
│ ├── advlist
│ │ └── plugin.min.js
│ ├── anchor
│ │ └── plugin.min.js
│ ├── autolink
│ │ └── plugin.min.js
│ ├── autoresize
│ │ └── plugin.min.js
│ ├── autosave
│ │ └── plugin.min.js
│ ├── bbcode
│ │ └── plugin.min.js
│ ├── charmap
│ │ └── plugin.min.js
│ ├── code
│ │ └── plugin.min.js
│ ├── colorpicker
│ │ └── plugin.min.js
│ ├── contextmenu
│ │ └── plugin.min.js
│ ├── directionality
│ │ └── plugin.min.js
│ ├── emoticons
│ │ ├── img
│ │ │ ├── smiley-cool.gif
│ │ │ ├── smiley-cry.gif
│ │ │ ├── smiley-embarassed.gif
│ │ │ ├── smiley-foot-in-mouth.gif
│ │ │ ├── smiley-frown.gif
│ │ │ ├── smiley-innocent.gif
│ │ │ ├── smiley-kiss.gif
│ │ │ ├── smiley-laughing.gif
│ │ │ ├── smiley-money-mouth.gif
│ │ │ ├── smiley-sealed.gif
│ │ │ ├── smiley-smile.gif
│ │ │ ├── smiley-surprised.gif
│ │ │ ├── smiley-tongue-out.gif
│ │ │ ├── smiley-undecided.gif
│ │ │ ├── smiley-wink.gif
│ │ │ └── smiley-yell.gif
│ │ └── plugin.min.js
│ ├── example
│ │ ├── dialog.html
│ │ └── plugin.min.js
│ ├── example_dependency
│ │ └── plugin.min.js
│ ├── fullpage
│ │ └── plugin.min.js
│ ├── fullscreen
│ │ └── plugin.min.js
│ ├── hr
│ │ └── plugin.min.js
│ ├── image
│ │ └── plugin.min.js
│ ├── importcss
│ │ └── plugin.min.js
│ ├── insertdatetime
│ │ └── plugin.min.js
│ ├── layer
│ │ └── plugin.min.js
│ ├── legacyoutput
│ │ └── plugin.min.js
│ ├── link
│ │ └── plugin.min.js
│ ├── lists
│ │ └── plugin.min.js
│ ├── media
│ │ ├── moxieplayer.swf
│ │ └── plugin.min.js
│ ├── nonbreaking
│ │ └── plugin.min.js
│ ├── noneditable
│ │ └── plugin.min.js
│ ├── pagebreak
│ │ └── plugin.min.js
│ ├── paste
│ │ └── plugin.min.js
│ ├── preview
│ │ └── plugin.min.js
│ ├── print
│ │ └── plugin.min.js
│ ├── save
│ │ └── plugin.min.js
│ ├── searchreplace
│ │ └── plugin.min.js
│ ├── sh4tinymce
│ │ ├── fonts
│ │ │ ├── sh4tinymce.dev.svg
│ │ │ ├── sh4tinymce.eot
│ │ │ ├── sh4tinymce.svg
│ │ │ ├── sh4tinymce.ttf
│ │ │ └── sh4tinymce.woff
│ │ ├── langs
│ │ │ ├── en.js
│ │ │ └── fr_FR.js
│ │ ├── plugin.js
│ │ ├── plugin.min.js
│ │ └── style
│ │ │ └── style.css
│ ├── spellchecker
│ │ └── plugin.min.js
│ ├── tabfocus
│ │ └── plugin.min.js
│ ├── table
│ │ └── plugin.min.js
│ ├── template
│ │ └── plugin.min.js
│ ├── textcolor
│ │ └── plugin.min.js
│ ├── textpattern
│ │ └── plugin.min.js
│ ├── upload
│ │ ├── plugin.css
│ │ ├── plugin.min.js
│ │ └── upload_icon.png
│ ├── visualblocks
│ │ ├── css
│ │ │ └── visualblocks.css
│ │ └── plugin.min.js
│ ├── visualchars
│ │ └── plugin.min.js
│ └── wordcount
│ │ └── plugin.min.js
│ ├── skins
│ └── lightgray
│ │ ├── content.inline.min.css
│ │ ├── content.min.css
│ │ ├── fonts
│ │ ├── tinymce-small.eot
│ │ ├── tinymce-small.svg
│ │ ├── tinymce-small.ttf
│ │ ├── tinymce-small.woff
│ │ ├── tinymce.eot
│ │ ├── tinymce.svg
│ │ ├── tinymce.ttf
│ │ └── tinymce.woff
│ │ ├── img
│ │ ├── anchor.gif
│ │ ├── loader.gif
│ │ ├── object.gif
│ │ └── trans.gif
│ │ ├── skin.ie7.min.css
│ │ └── skin.min.css
│ ├── themes
│ └── modern
│ │ └── theme.min.js
│ └── tinymce.min.js
└── test
├── __init__.py
├── pg_dump.sql
└── redis_test.py
/.gitignore:
--------------------------------------------------------------------------------
1 | myvenv
2 | .idea/
3 | *.pyc
4 | __pycache__
5 | staticfiles
6 | local_settings.py
7 | db.sqlite3
8 | migrations
9 | whoosh_index/
10 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | web: gunicorn mysite.wsgi --log-file -
2 |
--------------------------------------------------------------------------------
/blog/__init__.py:
--------------------------------------------------------------------------------
1 | default_app_config = 'blog.apps.BlogAppConfig'
2 |
--------------------------------------------------------------------------------
/blog/admin.py:
--------------------------------------------------------------------------------
1 | from django.contrib import admin
2 | from .models import Tag, Category, Post, Comment, Evaluate, Page
3 |
4 | admin.site.register(Tag)
5 | admin.site.register(Category)
6 | admin.site.register(Post)
7 | admin.site.register(Comment)
8 | admin.site.register(Evaluate)
9 | admin.site.register(Page)
10 |
--------------------------------------------------------------------------------
/blog/apps.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- encoding: utf-8 -*-
3 | """
4 | Topic: sample
5 | Desc :
6 | """
7 | from django.apps import AppConfig
8 | from django.core.cache import cache
9 |
10 |
11 | class BlogAppConfig(AppConfig):
12 | name = 'blog'
13 | verbose_name = "Blog Application"
14 |
15 | def ready(self):
16 | # startup code here
17 | print('-------start app--------')
18 | cache.clear()
19 |
20 |
--------------------------------------------------------------------------------
/blog/commons/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- encoding: utf-8 -*-
3 | """
4 | Topic: sample
5 | Desc :
6 | """
7 |
8 |
--------------------------------------------------------------------------------
/blog/commons/cache_manager.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- encoding: utf-8 -*-
3 | """
4 | Topic: redis缓存管理器
5 | """
6 | from ..models import Post
7 | # from django.core.cache import cache
8 | # from apscheduler.schedulers.background import BackgroundScheduler
9 |
10 | RUNNING_TIMER = False
11 |
12 |
13 | def clear():
14 | # cache.clear()
15 | pass
16 |
17 |
18 | def update_click(post):
19 | # k = "CLICKS{:d}".format(post.id)
20 | # if cache.has_key(k):
21 | # cache.incr(k)
22 | # else:
23 | # cache.set(k, post.click + 1)
24 | # run_timer()
25 | pass
26 |
27 |
28 | def get_click(post):
29 | # k = "CLICKS{:d}".format(post.id)
30 | # if cache.has_key(k):
31 | # return cache.get(k)
32 | # else:
33 | # cache.set(k, post.click)
34 | # return post.click
35 | pass
36 |
37 |
38 | def run_timer():
39 | # global RUNNING_TIMER
40 | # if not RUNNING_TIMER:
41 | # RUNNING_TIMER = True
42 | # # 30分钟同步一次文章点击率
43 | # scheduler = BackgroundScheduler()
44 | # scheduler.add_job(sync_click, 'interval', minutes=30)
45 | # scheduler.start()
46 | pass
47 |
48 |
49 | def sync_click():
50 | """同步文章点击数"""
51 | # print('同步文章点击数start....')
52 | # for k in cache.keys():
53 | # try:
54 | # p = Post.objects.get(pk=int(k[6:]))
55 | # cache_click = get_click(p)
56 | # if cache_click != p.click:
57 | # p.click = get_click(p)
58 | # p.save()
59 | # except:
60 | # pass
61 | # print('同步文章点击数end....')
62 | # global RUNNING_TIMER
63 | # RUNNING_TIMER = False
64 | pass
65 |
--------------------------------------------------------------------------------
/blog/commons/context_processors.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- encoding: utf-8 -*-
3 | """
4 | Topic: 全局处理器
5 | Desc :
6 | """
7 | from .. import models
8 | from . import utils
9 | from django.db import connection
10 | from django.db.models import Count
11 | from datetime import timedelta
12 | from django.utils import timezone
13 |
14 | # 使用context processro去提供一些context内容中公共的部分,也就是返回一个字典而已。
15 | def custom_proc(request):
16 | # 显示前5个页面,安装porder排序
17 | recent_pages = models.Page.objects.filter(
18 | published_date__isnull=False).order_by('porder')[:5]
19 | # 近期文章
20 | recent_posts = models.Post.objects.filter(
21 | published_date__isnull=False).order_by('-published_date')[:10]
22 | # 热门文章
23 | old_month = timezone.now() - timedelta(days=60)
24 | hot_posts = models.Post.objects.annotate(num_comment=Count('comment')).filter(
25 | published_date__gte=old_month).prefetch_related(
26 | 'category').prefetch_related('tags').order_by('-click')[:10]
27 | # 近期评论
28 | recent_comments = models.Comment.objects.prefetch_related(
29 | 'post').order_by('-created_date')[:10]
30 | # 标签
31 | alltags = models.Tag.objects.annotate(num_post=Count('post'))
32 | tags = {t.name: t.num_post for t in alltags}
33 | # 分类目录
34 | categories = models.Category.objects.annotate(
35 | num_post=Count('post')).filter(num_post__gt=0).order_by('name')
36 | # 文章归档,按照年月分类
37 | # select = {
38 | # 'year': connection.ops.date_trunc_sql('year', 'published_date'),
39 | # 'month': connection.ops.date_trunc_sql('month', 'published_date'),
40 | # }
41 | archives_db = models.Post.objects.filter(published_date__isnull=False)
42 | archives = []
43 | map_temp = {}
44 | for ar in archives_db:
45 | y = ar.published_date.year
46 | m = ar.published_date.month
47 | k = '{}|{}'.format(y, m)
48 | if k in map_temp:
49 | map_temp[k] += 1
50 | else:
51 | map_temp[k] = 1
52 | for kk,vv in map_temp.items():
53 | ym = kk.split('|')
54 | archives.append({'year':ym[0], 'month':ym[1], 'number': vv})
55 |
56 | return {
57 | 'RECENT_PAGES': recent_pages,
58 | 'RECENT_POSTS': recent_posts,
59 | 'HOT_POSTS': hot_posts,
60 | 'RECENT_COMMENTS': recent_comments,
61 | 'TAGS': utils.tag_font(tags),
62 | 'CATEGORIES': categories,
63 | 'ARCHIVES': archives,
64 | }
65 |
--------------------------------------------------------------------------------
/blog/commons/utils.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- encoding: utf-8 -*-
3 | """
4 | Topic: 帮助类
5 | Desc :
6 | """
7 | from datetime import datetime, timedelta, time
8 | import pytz
9 |
10 | MIN_TAG = 8
11 | MAX_TAG = 24
12 |
13 |
14 |
15 | def tag_font(tags):
16 | """
17 | 标签云的字体大小算法
18 | 思路如下:最小字体为MIN_TAG,文章数每增加一个字体增加2px,但是到MAX_TAG后封顶
19 | """
20 | return [(k, v, MIN_TAG + (v - 1) * 2 if MIN_TAG + (v - 1) * 2 <= MAX_TAG else MAX_TAG)
21 | for k, v in tags.items()]
22 |
23 |
24 | def seconds(dt):
25 | return (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)
26 |
27 |
28 | if __name__ == '__main__':
29 | print(tag_font({'校园': 3, 'python': 9, 'java': 1, '哈哈': 2}))
30 | for a,b,c in tag_font({'校园': 3, 'python': 9, 'java': 1, '哈哈': 2}):
31 | print(a,b,c)
32 | print(time(tzinfo=pytz.timezone('Asia/Shanghai')).tzname())
33 | print(datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
--------------------------------------------------------------------------------
/blog/forms.py:
--------------------------------------------------------------------------------
1 | # coding=utf-8
2 | from django import forms
3 | from .models import Post, Comment
4 |
5 |
6 | class PostForm(forms.ModelForm):
7 | class Meta:
8 | model = Post
9 | fields = ('title', 'text', 'category')
10 | labels = {
11 | 'category': '分类目录',
12 | 'text': '正文',
13 | 'title': '标题',
14 | }
15 | widgets = {
16 | 'text': forms.Textarea(attrs={'rows': 15}),
17 | }
18 |
19 |
20 | class CommentForm(forms.ModelForm):
21 | class Meta:
22 | model = Comment
23 | fields = ('author', 'email', 'text')
24 | labels = {
25 | 'author': '昵称(必填)',
26 | 'email': '电子邮箱(我们会为您保密)(必填)',
27 | 'text': '评论内容',
28 | }
29 | widgets = {
30 | 'text': forms.Textarea(attrs={'rows': 7}),
31 | }
--------------------------------------------------------------------------------
/blog/models.py:
--------------------------------------------------------------------------------
1 | # coding=utf-8
2 | from django.db import models
3 | from django.utils import timezone
4 | from django.contrib.auth.models import User
5 |
6 |
7 | class Tag(models.Model):
8 | class Meta:
9 | app_label = 'blog'
10 | verbose_name = '标签'
11 | verbose_name_plural = '标签'
12 |
13 | name = models.CharField(max_length=40)
14 |
15 | def __str__(self):
16 | return self.name
17 |
18 |
19 | class Category(models.Model):
20 | class Meta:
21 | app_label = 'blog'
22 | verbose_name = '分类目录'
23 | verbose_name_plural = '分类目录'
24 |
25 | name = models.CharField(max_length=40)
26 |
27 | def __str__(self):
28 | return self.name
29 |
30 |
31 | class Post(models.Model):
32 | class Meta:
33 | app_label = 'blog'
34 | verbose_name = '文章'
35 | verbose_name_plural = '文章'
36 |
37 | # 作者
38 | author = models.ForeignKey(User)
39 | # 标题
40 | title = models.CharField(max_length=200)
41 | # 正文
42 | text = models.TextField()
43 | # 标签
44 | tags = models.ManyToManyField(Tag)
45 | # 分类目录
46 | category = models.ForeignKey(Category)
47 | # 点击量
48 | click = models.IntegerField(default=0)
49 | # 创建时间
50 | created_date = models.DateTimeField(default=timezone.now)
51 | # 发布时间
52 | published_date = models.DateTimeField(blank=True, null=True)
53 |
54 | def publish(self):
55 | self.published_date = timezone.now()
56 | self.save()
57 |
58 | def __str__(self):
59 | return self.title
60 |
61 |
62 | class Comment(models.Model):
63 | class Meta:
64 | app_label = 'blog'
65 | verbose_name = '评论'
66 | verbose_name_plural = '评论'
67 |
68 | author = models.CharField(max_length=20)
69 | email = models.EmailField()
70 | text = models.TextField()
71 | created_date = models.DateTimeField(default=timezone.now)
72 | post = models.ForeignKey(Post)
73 |
74 | def __str__(self):
75 | return '{0}: {1}'.format(self.author, self.post.title)
76 |
77 |
78 | class Evaluate(models.Model):
79 | class Meta:
80 | app_label = 'blog'
81 | verbose_name = '评分'
82 | verbose_name_plural = '评分'
83 |
84 | ip = models.CharField(max_length=40)
85 | evaluate = models.IntegerField()
86 | post = models.ForeignKey(Post)
87 |
88 | def __str__(self):
89 | return '{0}: {1}'.format(self.ip, self.evaluate)
90 |
91 |
92 | class Page(models.Model):
93 | class Meta:
94 | app_label = 'blog'
95 | verbose_name = '页面'
96 | verbose_name_plural = '页面'
97 |
98 | # 作者
99 | author = models.ForeignKey(User)
100 | # 标题
101 | title = models.CharField(max_length=200)
102 | # 正文
103 | text = models.TextField()
104 | # 排列顺序
105 | porder = models.IntegerField(default=0)
106 | # 创建时间
107 | created_date = models.DateTimeField(default=timezone.now)
108 | # 发布时间
109 | published_date = models.DateTimeField(blank=True, null=True)
110 |
111 | def publish(self):
112 | self.published_date = timezone.now()
113 | self.save()
114 |
115 | def __str__(self):
116 | return self.title
117 |
--------------------------------------------------------------------------------
/blog/search_indexes.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- encoding: utf-8 -*-
3 | """
4 | Topic: 索引配置
5 | Desc :
6 | """
7 | from .models import Post
8 | from haystack import indexes
9 |
10 |
11 | class PostIndex(indexes.SearchIndex, indexes.Indexable):
12 | # 文章内容
13 | text = indexes.CharField(document=True, use_template=True)
14 | # 对标题字段进行索引
15 | title = indexes.CharField(model_attr='title')
16 |
17 | def get_model(self):
18 | return Post
19 |
20 | def index_queryset(self, using=None):
21 | return self.get_model().objects.all()
22 |
--------------------------------------------------------------------------------
/blog/templates/blog/page_detail.html:
--------------------------------------------------------------------------------
1 | {% extends 'mysite/base.html' %}
2 | {% load staticfiles %}
3 | {% block content %}
4 |
5 |
{{ page.title }}
6 |
7 |
8 |
{{ page.published_date|date:'Y年m月d日' }}
9 |
10 |
11 |
12 |
13 | {% autoescape off %}
14 | {{ page.text|linebreaks }}
15 | {% endautoescape %}
16 |
17 |
18 |
19 |
20 |
25 | {% endblock %}
26 |
--------------------------------------------------------------------------------
/blog/templates/blog/post_draft_list.html:
--------------------------------------------------------------------------------
1 | {% extends 'mysite/base.html' %}
2 | {% load blog_tags %}
3 | {% block content %}
4 | {% for post in posts %}
5 |
6 |
7 |
8 |
9 |
创建时间: {{ post.created_date|date:'Y年m月d日' }}
10 |
11 |
12 |
13 |
14 |
15 | {% autoescape off %}
16 | {{ post.text|more:post.id }}
17 | {% endautoescape %}
18 |
19 |
20 |
35 |
36 | {% endfor %}
37 | {% endblock %}
38 |
--------------------------------------------------------------------------------
/blog/templates/blog/post_edit.html:
--------------------------------------------------------------------------------
1 | {% extends 'mysite/base.html' %}
2 | {% load staticfiles %}
3 | {% block header %}
4 |
5 |
6 |
23 | {% endblock %}
24 | {% block content %}
25 |
26 |
{% if is_new %}新建文章{% else %}编辑文章{% endif %}
27 |
39 |
40 | {% endblock %}
41 |
--------------------------------------------------------------------------------
/blog/templates/blog/post_list.html:
--------------------------------------------------------------------------------
1 | {% extends 'mysite/base.html' %}
2 | {% load blog_tags %}
3 | {% block content %}
4 | {% if list_header %}
5 | {{ list_header }}
6 | {% endif %}
7 | {% for post in posts %}
8 |
9 |
10 |
11 |
{{ post.published_date|date:'Y年m月d日' }}
12 |
19 |
22 |
23 |
24 |
25 |
26 | {% autoescape off %}
27 | {{ post.text|more:post.id }}
28 | {% endautoescape %}
29 |
30 |
31 |
46 |
47 | {% endfor %}
48 | {% if page %}
49 |
62 | {% endif %}
63 | {% endblock %}
64 |
--------------------------------------------------------------------------------
/blog/templates/blog/post_search_list.html:
--------------------------------------------------------------------------------
1 | {% extends 'mysite/base.html' %}
2 | {% load blog_tags %}
3 | {% block content %}
4 | {% if list_header %}
5 | {{ list_header }}
6 | {% endif %}
7 | {% for post in posts %}
8 |
11 | {% endfor %}
12 | {% endblock %}
13 |
--------------------------------------------------------------------------------
/blog/templates/search/indexes/blog/post_text.txt:
--------------------------------------------------------------------------------
1 | {{ object.title}}
2 | {{ object.text}}
--------------------------------------------------------------------------------
/blog/templates/search/search.html:
--------------------------------------------------------------------------------
1 | {% block content %}
2 | Search
3 |
4 |
26 | {% endblock %}
--------------------------------------------------------------------------------
/blog/templatetags/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- encoding: utf-8 -*-
3 | """
4 | Topic: sample
5 | Desc :
6 | """
7 |
8 |
--------------------------------------------------------------------------------
/blog/templatetags/blog_tags.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- encoding: utf-8 -*-
3 | """
4 | Topic: 过滤器filter和标签tag
5 | Desc :
6 | """
7 | from django import template
8 |
9 | register = template.Library()
10 |
11 |
12 | @register.filter
13 | def more(value, post_id):
14 | """通过[!--more--]标签实现文章截取和增加查看全文链接"""
15 | more_str = '[!--more--]'
16 | if more_str in value:
17 | return value.split(more_str)[0] + '查看全文...'.format(post_id)
18 | return value
19 |
20 |
21 | @register.filter
22 | def lower(value):
23 | return value.lower()
24 |
25 | @register.filter
26 | def lower(value):
27 | return value.lower()
28 |
29 |
30 | @register.tag(name='more')
31 | def do_more(parser, token):
32 | """
33 | {% more %}
34 | This will appear in uppercase, {{ user_name }}.
35 | {% endmore %}
36 | """
37 | nodelist = parser.parse(('endmore',))
38 | parser.delete_first_token()
39 | return MoreNode(nodelist)
40 |
41 |
42 | class MoreNode(template.Node):
43 | def __init__(self, nodelist):
44 | self.nodelist = nodelist
45 |
46 | def render(self, context):
47 | output = self.nodelist.render(context)
48 | return output.upper()
--------------------------------------------------------------------------------
/blog/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 |
3 | # Create your tests here.
4 |
--------------------------------------------------------------------------------
/blog/urls.py:
--------------------------------------------------------------------------------
1 | # coding=utf-8
2 | from django.conf.urls import url
3 | from .views import *
4 |
5 | urlpatterns = [
6 | url(r'^$', post_list, name='home'),
7 | url(r'^posts/search/$', full_search, name='full_search'),
8 | url(r'^posts/tag/(?P\w+)$', post_list_by_tag, name='list_by_tag'),
9 | url(r'^posts/category/(?P\w+)$', post_list_by_category, name='list_by_cg'),
10 | url(r'^posts/archive/(?P[0-9]{4})/(?P[0-9]{1,2})$', post_list_by_ym, name='list_by_ym'),
11 | url(r'^post/(?P[0-9]+)/$', post_detail, name='post_detail'),
12 | url(r'^post/(?P[0-9]+)/(?P[01])/evaluate$', evaluate, name='post_evaluate'),
13 | url(r'^post/new/$', post_new, name='post_new'),
14 | url(r'^post/(?P[0-9]+)/edit/$', post_edit, name='post_edit'),
15 | url(r'^drafts/$', post_draft_list, name='post_draft_list'),
16 | url(r'^post/(?P[0-9]+)/publish/$', post_publish, name='post_publish'),
17 | url(r'^post/(?P[0-9]+)/remove/$', post_remove, name='post_remove'),
18 | url(r'^page/(?P[0-9]+)/$', page_detail, name='page_detail'),
19 | url(r'^comment/add/(?P[0-9]+)/$', add_comment, name='add_comment'),
20 | ]
21 |
--------------------------------------------------------------------------------
/locale/zh_CN/LC_MESSAGES/django.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/locale/zh_CN/LC_MESSAGES/django.mo
--------------------------------------------------------------------------------
/locale/zh_CN/LC_MESSAGES/django.po:
--------------------------------------------------------------------------------
1 | # SOME DESCRIPTIVE TITLE.
2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3 | # This file is distributed under the same license as the PACKAGE package.
4 | # FIRST AUTHOR , YEAR.
5 | #
6 | #, fuzzy
7 | msgid ""
8 | msgstr ""
9 | "Project-Id-Version: PACKAGE VERSION\n"
10 | "Report-Msgid-Bugs-To: \n"
11 | "POT-Creation-Date: 2014-11-26 11:45+0800\n"
12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13 | "Last-Translator: FULL NAME \n"
14 | "Language-Team: LANGUAGE \n"
15 | "MIME-Version: 1.0\n"
16 | "Content-Type: text/plain; charset=UTF-8\n"
17 | "Content-Transfer-Encoding: 8bit\n"
18 | "Plural-Forms: nplurals=1; plural=0;\n"
19 |
20 | #: .\mysite\settings.py:94
21 | msgid "Simplified Chinese"
22 | msgstr "简体中文"
23 |
24 | #: .\mysite\settings.py:95
25 | msgid "English"
26 | msgstr "English"
27 |
28 | #: base.html
29 | msgid "Simple Blog"
30 | msgstr "极简博客"
31 |
32 | msgid "Hello"
33 | msgstr "欢迎你"
34 |
35 | msgid "previous"
36 | msgstr "上一页"
37 |
38 | msgid "next"
39 | msgstr "下一页"
40 |
41 |
--------------------------------------------------------------------------------
/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | import os
3 | import sys
4 |
5 | if __name__ == "__main__":
6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
7 |
8 | from django.core.management import execute_from_command_line
9 |
10 | execute_from_command_line(sys.argv)
11 |
--------------------------------------------------------------------------------
/mysite/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/mysite/__init__.py
--------------------------------------------------------------------------------
/mysite/templates/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- encoding: utf-8 -*-
3 | """
4 | Topic: sample
5 | Desc :
6 | """
7 |
8 |
--------------------------------------------------------------------------------
/mysite/urls.py:
--------------------------------------------------------------------------------
1 | # coding=utf-8
2 | from django.conf.urls import patterns, include, url
3 | from django.contrib import admin
4 |
5 | urlpatterns = [
6 | url('^', include('django.contrib.auth.urls')),
7 | url(r'^admin/', include(admin.site.urls)),
8 | url(r'^search/', include('haystack.urls')),
9 | url(r'', include('blog.urls')),
10 | ]
11 |
--------------------------------------------------------------------------------
/mysite/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for mysite project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
12 |
13 | from django.core.wsgi import get_wsgi_application
14 | application = get_wsgi_application()
15 | #
16 | # from whitenoise.django import DjangoWhiteNoise
17 | # application = DjangoWhiteNoise(application)
18 |
19 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | pytz==2016.3
2 | gunicorn==19.4.5
3 | whitenoise==3.0
4 | psycopg2==2.6.1
5 | redis==2.10.5
6 | APScheduler==3.1.0
7 | xlwt==1.0.0
8 | whoosh==2.7.4
9 | jieba==0.38
10 | git+https://github.com/sshwsfc/django-xadmin.git@django1.9
11 | Django==1.9.5
12 | dj-database-url==0.4.1
13 | django-pagination-py3==1.1.1
14 | django-redis==4.4.2
15 | django-reversion==1.10.2
16 | django-haystack==2.4.1
17 | django-crispy-forms==1.6.0
18 |
--------------------------------------------------------------------------------
/runtime.txt:
--------------------------------------------------------------------------------
1 | python-2.7.8
2 |
--------------------------------------------------------------------------------
/static/css/login.css:
--------------------------------------------------------------------------------
1 | html {
2 | min-height: 100%;
3 | _height:100%;
4 | height:100%;
5 | }
6 | body {
7 | min-height: 100%;
8 | _height:100%;
9 | height:100%;
10 | background-color: #f5f5f5;
11 | }
12 |
13 | .container {
14 | width: 1000px !important;
15 | padding: 0;
16 |
17 | }
18 |
19 | .form-login {
20 | max-width: 350px;
21 | margin: 0 auto;
22 | border-radius: 2px;
23 | margin-top: 20%;
24 | -webkit-box-shadow: 4px 5px 5px 0 #d7d7d7;
25 | -moz-box-shadow: 4px 5px 5px 0 #d7d7d7;
26 | box-shadow: 4px 5px 5px 0 #d7d7d7;
27 | border-color: #d7d7d7;
28 | }
29 |
30 | .form-login .form-control:focus {
31 | z-index: 2;
32 | }
33 |
34 | .form-login .panel-title {
35 | font-size: 20px;
36 | }
37 |
38 | .form-login .panel-heading {
39 | border-top-left-radius: 2px;
40 | border-top-right-radius: 2px;
41 | }
42 |
43 | .form-login input {
44 | border-radius: 2px;
45 | }
46 |
47 | .form-login .btn {
48 | border-radius: 2px;
49 | }
50 |
51 | .input-group-addon {
52 | border-radius: 2px;
53 | }
54 |
55 | .copyright {
56 | padding-top: 10px;
57 | border-top: 1px solid #eeeeee;
58 | color: #9d9d9d;
59 | }
--------------------------------------------------------------------------------
/static/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/static/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/static/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/static/img/arrow.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/arrow.gif
--------------------------------------------------------------------------------
/static/img/bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/bg.jpg
--------------------------------------------------------------------------------
/static/img/blockquote.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/blockquote.gif
--------------------------------------------------------------------------------
/static/img/box.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/box.gif
--------------------------------------------------------------------------------
/static/img/box_1col.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/box_1col.gif
--------------------------------------------------------------------------------
/static/img/comment.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/comment.gif
--------------------------------------------------------------------------------
/static/img/comment_1col.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/comment_1col.gif
--------------------------------------------------------------------------------
/static/img/commentpoint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/commentpoint.png
--------------------------------------------------------------------------------
/static/img/digg_bottom.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/digg_bottom.gif
--------------------------------------------------------------------------------
/static/img/digged_bottom.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/digged_bottom.gif
--------------------------------------------------------------------------------
/static/img/feeds.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/feeds.gif
--------------------------------------------------------------------------------
/static/img/footer_990.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/footer_990.jpg
--------------------------------------------------------------------------------
/static/img/icons.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/icons.gif
--------------------------------------------------------------------------------
/static/img/light.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/light.gif
--------------------------------------------------------------------------------
/static/img/main_shadow.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/main_shadow.gif
--------------------------------------------------------------------------------
/static/img/menu.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/menu.gif
--------------------------------------------------------------------------------
/static/img/messagebox.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/messagebox.gif
--------------------------------------------------------------------------------
/static/img/messagebox_1col.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/messagebox_1col.gif
--------------------------------------------------------------------------------
/static/img/postbox.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/postbox.gif
--------------------------------------------------------------------------------
/static/img/postbox_1col.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/postbox_1col.gif
--------------------------------------------------------------------------------
/static/img/readers.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/readers.gif
--------------------------------------------------------------------------------
/static/img/searchbox.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/searchbox.gif
--------------------------------------------------------------------------------
/static/img/sidebar_shadow.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/sidebar_shadow.gif
--------------------------------------------------------------------------------
/static/img/sidesep.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/sidesep.gif
--------------------------------------------------------------------------------
/static/img/spinner.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/spinner.gif
--------------------------------------------------------------------------------
/static/img/textfield.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/textfield.gif
--------------------------------------------------------------------------------
/static/img/title.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/title.gif
--------------------------------------------------------------------------------
/static/img/widgetsep.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/widgetsep.png
--------------------------------------------------------------------------------
/static/img/wp-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yidao620c/simpleblog/5c4618df03780a98777fefbc42354d6875a2995f/static/img/wp-logo.png
--------------------------------------------------------------------------------
/static/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
21 |
22 |
23 |
24 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/compass/config.rb:
--------------------------------------------------------------------------------
1 | environment = :production
2 | project_type = :stand_alone
3 | http_path = "/"
4 | css_dir = "../styles"
5 | sass_dir = "."
6 | images_dir = "images"
7 | sass_options = {
8 | :line_numbers => false,
9 | :debug_info => false
10 | }
11 |
12 | # output_style = :compressed
13 | # output_style = :compact
14 | output_style = :expanded
15 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/compass/shCoreDefault.scss:
--------------------------------------------------------------------------------
1 | @import "shCore.scss";
2 | @import "shThemeDefault.scss";
3 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/compass/shCoreDjango.scss:
--------------------------------------------------------------------------------
1 | @import "shCore.scss";
2 | @import "shThemeDjango.scss";
3 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/compass/shCoreEclipse.scss:
--------------------------------------------------------------------------------
1 | @import "shCore.scss";
2 | @import "shThemeEclipse.scss";
3 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/compass/shCoreEmacs.scss:
--------------------------------------------------------------------------------
1 | @import "shCore.scss";
2 | @import "shThemeEmacs.scss";
3 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/compass/shCoreFadeToGrey.scss:
--------------------------------------------------------------------------------
1 | @import "shCore.scss";
2 | @import "shThemeFadeToGrey.scss";
3 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/compass/shCoreMDUltra.scss:
--------------------------------------------------------------------------------
1 | @import "shCore.scss";
2 | @import "shThemeMDUltra.scss";
3 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/compass/shCoreMidnight.scss:
--------------------------------------------------------------------------------
1 | @import "shCore.scss";
2 | @import "shThemeMidnight.scss";
3 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/compass/shCoreRDark.scss:
--------------------------------------------------------------------------------
1 | @import "shCore.scss";
2 | @import "shThemeRDark.scss";
3 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/compass/shThemeDefault.scss:
--------------------------------------------------------------------------------
1 | // Default Syntax Highlighter theme.
2 |
3 | @import "_theme_template.scss";
4 |
5 | .syntaxhighlighter {
6 | .keyword { font-weight: bold !important; }
7 | }
8 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/compass/shThemeDjango.scss:
--------------------------------------------------------------------------------
1 | // Django SyntaxHighlighter theme
2 |
3 | $background: #0a2b1d !default;
4 |
5 | $line_highlighted_background: #233729 !default;
6 | $line_highlighted_number: white !default;
7 |
8 | $gutter_text: #497958 !default;
9 | $gutter_border_color: #41a83e !default;
10 |
11 | $toolbar_collapsed_a: #96dd3b !default;
12 | $toolbar_collapsed_a_hover: #fff !default;
13 | $toolbar_collapsed_background: #000 !default;
14 |
15 | $toolbar_a: #fff !default;
16 | $toolbar_a_hover: #ffe862 !default;
17 |
18 | $code_plain: #f8f8f8 !default;
19 | $code_comments: #336442 !default;
20 | $code_string: #9df39f !default;
21 | $code_keyword: #96dd3b !default;
22 | $code_preprocessor: #91bb9e !default;
23 | $code_variable: #ffaa3e !default;
24 | $code_value: #f7e741 !default;
25 | $code_functions: #ffaa3e !default;
26 | $code_constants: #e0e8ff !default;
27 | $code_color1: #eb939a !default;
28 | $code_color2: #91bb9e !default;
29 | $code_color3: #edef7d !default;
30 |
31 | @import "_theme_template.scss";
32 |
33 | .syntaxhighlighter {
34 | .comments { font-style: italic !important; }
35 | .keyword { font-weight: bold !important; }
36 | }
37 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/compass/shThemeEclipse.scss:
--------------------------------------------------------------------------------
1 | // Eclipse IDE SyntaxHighlighter color theme
2 | // (C) Code-House
3 | // :http//blog.code-house.org/2009/10/xml-i-adnotacje-kod-ogolnego-przeznaczenia-i-jpa/
4 |
5 | $background: #fff !default;
6 |
7 | $line_highlighted_background: #c3defe !default;
8 | $line_highlighted_number: #fff !default;
9 |
10 | $gutter_text: #787878 !default;
11 | $gutter_border_color: #d4d0c8 !default;
12 |
13 | $toolbar_collapsed_a: #3f5fbf !default;
14 | $toolbar_collapsed_a_hover: #aa7700 !default;
15 | $toolbar_collapsed_background: #fff !default;
16 |
17 | $toolbar_a: #a0a0a0 !default;
18 | $toolbar_a_hover: red !default;
19 |
20 | $code_plain: black !default;
21 | $code_comments: #3f5fbf !default;
22 | $code_string: #2a00ff !default;
23 | $code_keyword: #7f0055 !default;
24 | $code_preprocessor: #646464 !default;
25 | $code_variable: #aa7700 !default;
26 | $code_value: #009900 !default;
27 | $code_functions: #ff1493 !default;
28 | $code_constants: #0066cc !default;
29 | $code_color1: gray !default;
30 | $code_color2: #ff1493 !default;
31 | $code_color3: red !default;
32 |
33 | @import "_theme_template.scss";
34 |
35 | .syntaxhighlighter {
36 | .keyword { font-weight: bold !important; }
37 |
38 | .xml {
39 | .keyword {
40 | color: #3f7f7f !important;
41 | font-weight: normal !important; }
42 | .color1, .color1 a { color: #7f007f !important; }
43 | .string {
44 | font-style: italic !important;
45 | color: #2a00ff !important;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/compass/shThemeEmacs.scss:
--------------------------------------------------------------------------------
1 | // Emacs SyntaxHighlighter theme based on theme by Joshua Emmons
2 | // http://www.skia.net/
3 |
4 | $background: black !default;
5 |
6 | $line_highlighted_background: #2A3133 !default;
7 | $line_highlighted_number: white !default;
8 |
9 | $gutter_text: #d3d3d3 !default;
10 | $gutter_border_color: #990000 !default;
11 |
12 | $toolbar_collapsed_a: #ebdb8d !default;
13 | $toolbar_collapsed_a_hover: #ff7d27 !default;
14 | $toolbar_collapsed_background: black !default;
15 |
16 | $toolbar_a: #fff !default;
17 | $toolbar_a_hover: #9ccff4 !default;
18 |
19 | $code_plain: #d3d3d3 !default;
20 | $code_comments: #ff7d27 !default;
21 | $code_string: #ff9e7b !default;
22 | $code_keyword: aqua !default;
23 | $code_preprocessor: #aec4de !default;
24 | $code_variable: #ffaa3e !default;
25 | $code_value: #009900 !default;
26 | $code_functions: #81cef9 !default;
27 | $code_constants: #ff9e7b !default;
28 | $code_color1: #ebdb8d !default;
29 | $code_color2: #ff7d27 !default;
30 | $code_color3: #aec4de !default;
31 |
32 | @import "_theme_template.scss";
33 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/compass/shThemeFadeToGrey.scss:
--------------------------------------------------------------------------------
1 | // Fade to Grey SyntaxHighlighter theme based on theme by Brasten Sager
2 | // :http//www.ibrasten.com/
3 |
4 | $background: #121212 !default;
5 |
6 | $line_highlighted_background: #2C2C29 !default;
7 | $line_highlighted_number: white !default;
8 |
9 | $gutter_text: #afafaf !default;
10 | $gutter_border_color: #3185b9 !default;
11 |
12 | $toolbar_collapsed_a: #3185b9 !default;
13 | $toolbar_collapsed_a_hover: #d01d33 !default;
14 | $toolbar_collapsed_background: black !default;
15 |
16 | $toolbar_a: #fff !default;
17 | $toolbar_a_hover: #96daff !default;
18 |
19 | $code_plain: white !default;
20 | $code_comments: #696854 !default;
21 | $code_string: #e3e658 !default;
22 | $code_keyword: #d01d33 !default;
23 | $code_preprocessor: #435a5f !default;
24 | $code_variable: #898989 !default;
25 | $code_value: #009900 !default;
26 | $code_functions: #aaaaaa !default;
27 | $code_constants: #96daff !default;
28 | $code_color1: #ffc074 !default;
29 | $code_color2: #4a8cdb !default;
30 | $code_color3: #96daff !default;
31 |
32 | @import "_theme_template.scss";
33 |
34 | .syntaxhighlighter {
35 | .functions { font-weight: bold !important; }
36 | }
37 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/compass/shThemeMDUltra.scss:
--------------------------------------------------------------------------------
1 | // MDUltra SyntaxHighlighter theme based on Midnight Theme
2 | // http://www.mddev.co.uk/
3 |
4 | $background: #222222 !default;
5 |
6 | $line_highlighted_background: #253e5a !default;
7 | $line_highlighted_number: white !default;
8 |
9 | $gutter_text: #38566f !default;
10 | $gutter_border_color: #435a5f !default;
11 |
12 | $toolbar_collapsed_a: #428bdd !default;
13 | $toolbar_collapsed_a_hover: lime !default;
14 | $toolbar_collapsed_background: black !default;
15 |
16 | $toolbar_a: #aaaaff !default;
17 | $toolbar_a_hover: #9ccff4 !default;
18 |
19 | $code_plain: lime !default;
20 | $code_comments: #428bdd !default;
21 | $code_string: lime !default;
22 | $code_keyword: #aaaaff !default;
23 | $code_preprocessor: #8aa6c1 !default;
24 | $code_variable: aqua !default;
25 | $code_value: #f7e741 !default;
26 | $code_functions: #ff8000 !default;
27 | $code_constants: yellow !default;
28 | $code_color1: red !default;
29 | $code_color2: yellow !default;
30 | $code_color3: #ffaa3e !default;
31 |
32 | @import "_theme_template.scss";
33 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/compass/shThemeMidnight.scss:
--------------------------------------------------------------------------------
1 | // Midnight SyntaxHighlighter theme based on theme by J.D. Myers
2 | // http://webdesign.lsnjd.com/
3 |
4 | $background: #0f192a !default;
5 |
6 | $line_highlighted_background: #253e5a !default;
7 | $line_highlighted_number: #38566f !default;
8 |
9 | $gutter_text: #afafaf !default;
10 | $gutter_border_color: #435a5f !default;
11 |
12 | $toolbar_collapsed_a: #428bdd !default;
13 | $toolbar_collapsed_a_hover: #1dc116 !default;
14 | $toolbar_collapsed_background: #000 !default;
15 |
16 | $toolbar_a: #D1EDFF !default;
17 | $toolbar_a_hover: #8aa6c1 !default;
18 |
19 | $code_plain: #d1edff !default;
20 | $code_comments: #428bdd !default;
21 | $code_string: #1dc116 !default;
22 | $code_keyword: #b43d3d !default;
23 | $code_preprocessor: #8aa6c1 !default;
24 | $code_variable: #ffaa3e !default;
25 | $code_value: #f7e741 !default;
26 | $code_functions: #ffaa3e !default;
27 | $code_constants: #e0e8ff !default;
28 | $code_color1: #f8bb00 !default;
29 | $code_color2: white !default;
30 | $code_color3: #ffaa3e !default;
31 |
32 | @import "_theme_template.scss";
33 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/compass/shThemeRDark.scss:
--------------------------------------------------------------------------------
1 | // RDark SyntaxHighlighter theme based on theme by Radu Dineiu
2 | // http://www.vim.org/scripts/script.php?script_id=1732
3 |
4 | $background: #1b2426 !default;
5 |
6 | $line_highlighted_background: #323E41 !default;
7 | $line_highlighted_number: #b9bdb6 !default;
8 |
9 | $gutter_text: #afafaf !default;
10 | $gutter_border_color: #435a5f !default;
11 |
12 | $toolbar_collapsed_a: #5ba1cf !default;
13 | $toolbar_collapsed_a_hover: #5ce638 !default;
14 | $toolbar_collapsed_background: #000 !default;
15 |
16 | $toolbar_a: #fff !default;
17 | $toolbar_a_hover: #e0e8ff !default;
18 |
19 | $code_plain: #b9bdb6 !default;
20 | $code_comments: #878a85 !default;
21 | $code_string: #5ce638 !default;
22 | $code_keyword: #5ba1cf !default;
23 | $code_preprocessor: #435a5f !default;
24 | $code_variable: #ffaa3e !default;
25 | $code_value: #009900 !default;
26 | $code_functions: #ffaa3e !default;
27 | $code_constants: #e0e8ff !default;
28 | $code_color1: #e0e8ff !default;
29 | $code_color2: white !default;
30 | $code_color3: #ffaa3e !default;
31 |
32 | @import "_theme_template.scss";
33 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/index.html:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 | Hello SyntaxHighlighter
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | Hello SyntaxHighlighter
16 |
17 | function helloSyntaxHighlighter()
18 | {
19 | return "hi!";
20 | }
21 |
22 |
23 |
24 | def add_comment(request, pk):
25 | """添加评论"""
26 | form = CommentForm(request.POST)
27 | if form.is_valid():
28 | comment = form.save(commit=False)
29 | comment.post_id = pk
30 | comment.save()
31 | return redirect('blog.views.post_detail', pk=pk)
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/scripts/shAutoloader.js:
--------------------------------------------------------------------------------
1 | /**
2 | * SyntaxHighlighter
3 | * http://alexgorbatchev.com/SyntaxHighlighter
4 | *
5 | * SyntaxHighlighter is donationware. If you are using it, please donate.
6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html
7 | *
8 | * @version
9 | * 3.0.83 (July 02 2010)
10 | *
11 | * @copyright
12 | * Copyright (C) 2004-2010 Alex Gorbatchev.
13 | *
14 | * @license
15 | * Dual licensed under the MIT and GPL licenses.
16 | */
17 | eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(2(){1 h=5;h.I=2(){2 n(c,a){4(1 d=0;d)/g
47 | });
48 | };
49 |
50 | Brush.prototype = new SyntaxHighlighter.Highlighter();
51 | Brush.aliases = ['java'];
52 |
53 | SyntaxHighlighter.brushes.Java = Brush;
54 |
55 | // CommonJS
56 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
57 | })();
58 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/scripts/shBrushJavaFX.js:
--------------------------------------------------------------------------------
1 | /**
2 | * SyntaxHighlighter
3 | * http://alexgorbatchev.com/SyntaxHighlighter
4 | *
5 | * SyntaxHighlighter is donationware. If you are using it, please donate.
6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html
7 | *
8 | * @version
9 | * 3.0.83 (July 02 2010)
10 | *
11 | * @copyright
12 | * Copyright (C) 2004-2010 Alex Gorbatchev.
13 | *
14 | * @license
15 | * Dual licensed under the MIT and GPL licenses.
16 | */
17 | ;(function()
18 | {
19 | // CommonJS
20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
21 |
22 | function Brush()
23 | {
24 | // Contributed by Patrick Webster
25 | // http://patrickwebster.blogspot.com/2009/04/javafx-brush-for-syntaxhighlighter.html
26 | var datatypes = 'Boolean Byte Character Double Duration '
27 | + 'Float Integer Long Number Short String Void'
28 | ;
29 |
30 | var keywords = 'abstract after and as assert at before bind bound break catch class '
31 | + 'continue def delete else exclusive extends false finally first for from '
32 | + 'function if import in indexof init insert instanceof into inverse last '
33 | + 'lazy mixin mod nativearray new not null on or override package postinit '
34 | + 'protected public public-init public-read replace return reverse sizeof '
35 | + 'step super then this throw true try tween typeof var where while with '
36 | + 'attribute let private readonly static trigger'
37 | ;
38 |
39 | this.regexList = [
40 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' },
41 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' },
42 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' },
43 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' },
44 | { regex: /(-?\.?)(\b(\d*\.?\d+|\d+\.?\d*)(e[+-]?\d+)?|0x[a-f\d]+)\b\.?/gi, css: 'color2' }, // numbers
45 | { regex: new RegExp(this.getKeywords(datatypes), 'gm'), css: 'variable' }, // datatypes
46 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }
47 | ];
48 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
49 | };
50 |
51 | Brush.prototype = new SyntaxHighlighter.Highlighter();
52 | Brush.aliases = ['jfx', 'javafx'];
53 |
54 | SyntaxHighlighter.brushes.JavaFX = Brush;
55 |
56 | // CommonJS
57 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
58 | })();
59 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/scripts/shBrushPlain.js:
--------------------------------------------------------------------------------
1 | /**
2 | * SyntaxHighlighter
3 | * http://alexgorbatchev.com/SyntaxHighlighter
4 | *
5 | * SyntaxHighlighter is donationware. If you are using it, please donate.
6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html
7 | *
8 | * @version
9 | * 3.0.83 (July 02 2010)
10 | *
11 | * @copyright
12 | * Copyright (C) 2004-2010 Alex Gorbatchev.
13 | *
14 | * @license
15 | * Dual licensed under the MIT and GPL licenses.
16 | */
17 | ;(function()
18 | {
19 | // CommonJS
20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
21 |
22 | function Brush()
23 | {
24 | };
25 |
26 | Brush.prototype = new SyntaxHighlighter.Highlighter();
27 | Brush.aliases = ['text', 'plain'];
28 |
29 | SyntaxHighlighter.brushes.Plain = Brush;
30 |
31 | // CommonJS
32 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
33 | })();
34 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/scripts/shBrushPython.js:
--------------------------------------------------------------------------------
1 | /**
2 | * SyntaxHighlighter
3 | * http://alexgorbatchev.com/SyntaxHighlighter
4 | *
5 | * SyntaxHighlighter is donationware. If you are using it, please donate.
6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html
7 | *
8 | * @version
9 | * 3.0.83 (July 02 2010)
10 | *
11 | * @copyright
12 | * Copyright (C) 2004-2010 Alex Gorbatchev.
13 | *
14 | * @license
15 | * Dual licensed under the MIT and GPL licenses.
16 | */
17 | ;(function()
18 | {
19 | // CommonJS
20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
21 |
22 | function Brush()
23 | {
24 | // Contributed by Gheorghe Milas and Ahmad Sherif
25 |
26 | var keywords = 'and assert break class continue def del elif else ' +
27 | 'except exec finally for from global if import in is ' +
28 | 'lambda not or pass print raise return try yield while';
29 |
30 | var funcs = '__import__ abs all any apply basestring bin bool buffer callable ' +
31 | 'chr classmethod cmp coerce compile complex delattr dict dir ' +
32 | 'divmod enumerate eval execfile file filter float format frozenset ' +
33 | 'getattr globals hasattr hash help hex id input int intern ' +
34 | 'isinstance issubclass iter len list locals long map max min next ' +
35 | 'object oct open ord pow print property range raw_input reduce ' +
36 | 'reload repr reversed round set setattr slice sorted staticmethod ' +
37 | 'str sum super tuple type type unichr unicode vars xrange zip';
38 |
39 | var special = 'None True False self cls class_';
40 |
41 | this.regexList = [
42 | { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' },
43 | { regex: /^\s*@\w+/gm, css: 'decorator' },
44 | { regex: /(['\"]{3})([^\1])*?\1/gm, css: 'comments' },
45 | { regex: /"(?!")(?:\.|\\\"|[^\""\n])*"/gm, css: 'string' },
46 | { regex: /'(?!')(?:\.|(\\\')|[^\''\n])*'/gm, css: 'string' },
47 | { regex: /\+|\-|\*|\/|\%|=|==/gm, css: 'keyword' },
48 | { regex: /\b\d+\.?\w*/g, css: 'value' },
49 | { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' },
50 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' },
51 | { regex: new RegExp(this.getKeywords(special), 'gm'), css: 'color1' }
52 | ];
53 |
54 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
55 | };
56 |
57 | Brush.prototype = new SyntaxHighlighter.Highlighter();
58 | Brush.aliases = ['py', 'python'];
59 |
60 | SyntaxHighlighter.brushes.Python = Brush;
61 |
62 | // CommonJS
63 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
64 | })();
65 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/scripts/shBrushRuby.js:
--------------------------------------------------------------------------------
1 | /**
2 | * SyntaxHighlighter
3 | * http://alexgorbatchev.com/SyntaxHighlighter
4 | *
5 | * SyntaxHighlighter is donationware. If you are using it, please donate.
6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html
7 | *
8 | * @version
9 | * 3.0.83 (July 02 2010)
10 | *
11 | * @copyright
12 | * Copyright (C) 2004-2010 Alex Gorbatchev.
13 | *
14 | * @license
15 | * Dual licensed under the MIT and GPL licenses.
16 | */
17 | ;(function()
18 | {
19 | // CommonJS
20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
21 |
22 | function Brush()
23 | {
24 | // Contributed by Erik Peterson.
25 |
26 | var keywords = 'alias and BEGIN begin break case class def define_method defined do each else elsif ' +
27 | 'END end ensure false for if in module new next nil not or raise redo rescue retry return ' +
28 | 'self super then throw true undef unless until when while yield';
29 |
30 | var builtins = 'Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload ' +
31 | 'Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol ' +
32 | 'ThreadGroup Thread Time TrueClass';
33 |
34 | this.regexList = [
35 | { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments
36 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
38 | { regex: /\b[A-Z0-9_]+\b/g, css: 'constants' }, // constants
39 | { regex: /:[a-z][A-Za-z0-9_]*/g, css: 'color2' }, // symbols
40 | { regex: /(\$|@@|@)\w+/g, css: 'variable bold' }, // $global, @instance, and @@class variables
41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
42 | { regex: new RegExp(this.getKeywords(builtins), 'gm'), css: 'color1' } // builtins
43 | ];
44 |
45 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
46 | };
47 |
48 | Brush.prototype = new SyntaxHighlighter.Highlighter();
49 | Brush.aliases = ['ruby', 'rails', 'ror', 'rb'];
50 |
51 | SyntaxHighlighter.brushes.Ruby = Brush;
52 |
53 | // CommonJS
54 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
55 | })();
56 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/scripts/shBrushScala.js:
--------------------------------------------------------------------------------
1 | /**
2 | * SyntaxHighlighter
3 | * http://alexgorbatchev.com/SyntaxHighlighter
4 | *
5 | * SyntaxHighlighter is donationware. If you are using it, please donate.
6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html
7 | *
8 | * @version
9 | * 3.0.83 (July 02 2010)
10 | *
11 | * @copyright
12 | * Copyright (C) 2004-2010 Alex Gorbatchev.
13 | *
14 | * @license
15 | * Dual licensed under the MIT and GPL licenses.
16 | */
17 | ;(function()
18 | {
19 | // CommonJS
20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
21 |
22 | function Brush()
23 | {
24 | // Contributed by Yegor Jbanov and David Bernard.
25 |
26 | var keywords = 'val sealed case def true trait implicit forSome import match object null finally super ' +
27 | 'override try lazy for var catch throw type extends class while with new final yield abstract ' +
28 | 'else do if return protected private this package false';
29 |
30 | var keyops = '[_:=><%#@]+';
31 |
32 | this.regexList = [
33 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
34 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
35 | { regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // multi-line strings
36 | { regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double-quoted string
37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
38 | { regex: /0x[a-f0-9]+|\d+(\.\d+)?/gi, css: 'value' }, // numbers
39 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
40 | { regex: new RegExp(keyops, 'gm'), css: 'keyword' } // scala keyword
41 | ];
42 | }
43 |
44 | Brush.prototype = new SyntaxHighlighter.Highlighter();
45 | Brush.aliases = ['scala'];
46 |
47 | SyntaxHighlighter.brushes.Scala = Brush;
48 |
49 | // CommonJS
50 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
51 | })();
52 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/scripts/shBrushVb.js:
--------------------------------------------------------------------------------
1 | /**
2 | * SyntaxHighlighter
3 | * http://alexgorbatchev.com/SyntaxHighlighter
4 | *
5 | * SyntaxHighlighter is donationware. If you are using it, please donate.
6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html
7 | *
8 | * @version
9 | * 3.0.83 (July 02 2010)
10 | *
11 | * @copyright
12 | * Copyright (C) 2004-2010 Alex Gorbatchev.
13 | *
14 | * @license
15 | * Dual licensed under the MIT and GPL licenses.
16 | */
17 | ;(function()
18 | {
19 | // CommonJS
20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
21 |
22 | function Brush()
23 | {
24 | var keywords = 'AddHandler AddressOf AndAlso Alias And Ansi As Assembly Auto ' +
25 | 'Boolean ByRef Byte ByVal Call Case Catch CBool CByte CChar CDate ' +
26 | 'CDec CDbl Char CInt Class CLng CObj Const CShort CSng CStr CType ' +
27 | 'Date Decimal Declare Default Delegate Dim DirectCast Do Double Each ' +
28 | 'Else ElseIf End Enum Erase Error Event Exit False Finally For Friend ' +
29 | 'Function Get GetType GoSub GoTo Handles If Implements Imports In ' +
30 | 'Inherits Integer Interface Is Let Lib Like Long Loop Me Mod Module ' +
31 | 'MustInherit MustOverride MyBase MyClass Namespace New Next Not Nothing ' +
32 | 'NotInheritable NotOverridable Object On Option Optional Or OrElse ' +
33 | 'Overloads Overridable Overrides ParamArray Preserve Private Property ' +
34 | 'Protected Public RaiseEvent ReadOnly ReDim REM RemoveHandler Resume ' +
35 | 'Return Select Set Shadows Shared Short Single Static Step Stop String ' +
36 | 'Structure Sub SyncLock Then Throw To True Try TypeOf Unicode Until ' +
37 | 'Variant When While With WithEvents WriteOnly Xor';
38 |
39 | this.regexList = [
40 | { regex: /'.*$/gm, css: 'comments' }, // one line comments
41 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
42 | { regex: /^\s*#.*$/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
43 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // vb keyword
44 | ];
45 |
46 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
47 | };
48 |
49 | Brush.prototype = new SyntaxHighlighter.Highlighter();
50 | Brush.aliases = ['vb', 'vbnet'];
51 |
52 | SyntaxHighlighter.brushes.Vb = Brush;
53 |
54 | // CommonJS
55 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
56 | })();
57 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/scripts/shBrushXml.js:
--------------------------------------------------------------------------------
1 | /**
2 | * SyntaxHighlighter
3 | * http://alexgorbatchev.com/SyntaxHighlighter
4 | *
5 | * SyntaxHighlighter is donationware. If you are using it, please donate.
6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html
7 | *
8 | * @version
9 | * 3.0.83 (July 02 2010)
10 | *
11 | * @copyright
12 | * Copyright (C) 2004-2010 Alex Gorbatchev.
13 | *
14 | * @license
15 | * Dual licensed under the MIT and GPL licenses.
16 | */
17 | ;(function()
18 | {
19 | // CommonJS
20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;
21 |
22 | function Brush()
23 | {
24 | function process(match, regexInfo)
25 | {
26 | var constructor = SyntaxHighlighter.Match,
27 | code = match[0],
28 | tag = new XRegExp('(<|<)[\\s\\/\\?]*(?[:\\w-\\.]+)', 'xg').exec(code),
29 | result = []
30 | ;
31 |
32 | if (match.attributes != null)
33 | {
34 | var attributes,
35 | regex = new XRegExp('(? [\\w:\\-\\.]+)' +
36 | '\\s*=\\s*' +
37 | '(? ".*?"|\'.*?\'|\\w+)',
38 | 'xg');
39 |
40 | while ((attributes = regex.exec(code)) != null)
41 | {
42 | result.push(new constructor(attributes.name, match.index + attributes.index, 'color1'));
43 | result.push(new constructor(attributes.value, match.index + attributes.index + attributes[0].indexOf(attributes.value), 'string'));
44 | }
45 | }
46 |
47 | if (tag != null)
48 | result.push(
49 | new constructor(tag.name, match.index + tag[0].indexOf(tag.name), 'keyword')
50 | );
51 |
52 | return result;
53 | }
54 |
55 | this.regexList = [
56 | { regex: new XRegExp('(\\<|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\\>|>)', 'gm'), css: 'color2' }, //
57 | { regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, //
58 | { regex: new XRegExp('(<|<)[\\s\\/\\?]*(\\w+)(?.*?)[\\s\\/\\?]*(>|>)', 'sg'), func: process }
59 | ];
60 | };
61 |
62 | Brush.prototype = new SyntaxHighlighter.Highlighter();
63 | Brush.aliases = ['xml', 'xhtml', 'xslt', 'html'];
64 |
65 | SyntaxHighlighter.brushes.Xml = Brush;
66 |
67 | // CommonJS
68 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
69 | })();
70 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/scripts/shLegacy.js:
--------------------------------------------------------------------------------
1 | /**
2 | * SyntaxHighlighter
3 | * http://alexgorbatchev.com/SyntaxHighlighter
4 | *
5 | * SyntaxHighlighter is donationware. If you are using it, please donate.
6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html
7 | *
8 | * @version
9 | * 3.0.83 (July 02 2010)
10 | *
11 | * @copyright
12 | * Copyright (C) 2004-2010 Alex Gorbatchev.
13 | *
14 | * @license
15 | * Dual licensed under the MIT and GPL licenses.
16 | */
17 | eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('3 u={8:{}};u.8={A:4(c,k,l,m,n,o){4 d(a,b){2 a!=1?a:b}4 f(a){2 a!=1?a.E():1}c=c.I(":");3 g=c[0],e={};t={"r":K};M=1;5=8.5;9(3 j R c)e[c[j]]="r";k=f(d(k,5.C));l=f(d(l,5.D));m=f(d(m,5.s));o=f(d(o,5.Q));n=f(d(n,5["x-y"]));2{P:g,C:d(t[e.O],k),D:d(t[e.N],l),s:d({"r":r}[e.s],m),"x-y":d(4(a,b){9(3 h=T S("^"+b+"\\\\[(?\\\\w+)\\\\]$","U"),i=1,p=0;p
2 |
3 |
4 |
5 |
21 |
22 |
23 |
24 |
27 |
28 |
29 |