├── .gitignore ├── LICENSE ├── README.md ├── apps ├── __init__.py ├── about │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── urls.py │ └── views.py ├── account │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ └── views.py ├── blog │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── urls.py │ └── views.py ├── comment │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── urls.py │ └── views.py ├── homepage │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── urls.py │ └── views.py ├── interest │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── urls.py │ └── views.py ├── photo │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── urls.py │ └── views.py └── ueditor │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── migrations │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── urls.py │ └── views.py ├── loonblog ├── __init__.py ├── urls.py └── wsgi.py ├── manage.py ├── requirement ├── common.txt ├── dev.txt ├── pro.txt └── test.txt ├── services ├── __init__.py ├── about │ ├── __init__.py │ └── about_service.py ├── base_service.py ├── blog │ ├── __init__.py │ ├── blog_service.py │ ├── blog_tag_service.py │ ├── category_service.py │ ├── tag_service.py │ └── topic_service.py ├── comment │ ├── __init__.py │ └── comment_service.py └── common │ ├── __init__.py │ ├── auto_log_service.py │ ├── context_processors.py │ ├── ip_service.py │ └── msg_service.py ├── settings ├── __init__.py ├── common.py ├── dev.py └── test.py ├── static ├── css │ ├── about.css │ ├── base.css │ ├── blog.css │ ├── bootstrap-multiselect.css │ ├── bootstrap-theme.css │ ├── bootstrap-theme.css.map │ ├── bootstrap-theme.min.css │ ├── bootstrap-theme.min.css.map │ ├── bootstrap.css │ ├── bootstrap.css.map │ ├── bootstrap.min.css │ ├── bootstrap.min.css.map │ ├── dataTables.bootstrap.css │ ├── dataTables.bootstrap.min.css │ ├── index.css │ ├── jquery.dataTables.css │ └── jquery.dataTables.min.css ├── fonts │ ├── Arial.ttf │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 ├── image │ ├── LOGO.png │ ├── apple-touch-icon-precomposed.png │ ├── apple-touch-icon.png │ ├── davatar.png │ ├── favicon.ico │ └── s_icon.png ├── images │ ├── Sorting icons.psd │ ├── blogedit.png │ ├── bloglist.png │ ├── favicon.ico │ ├── homepage.png │ ├── sort_asc.png │ ├── sort_asc_disabled.png │ ├── sort_both.png │ ├── sort_desc.png │ └── sort_desc_disabled.png ├── js │ ├── bootstrap-multiselect.js │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── dataTables.bootstrap.js │ ├── dataTables.bootstrap.min.js │ ├── jquery-3.2.1.min.js │ ├── jquery.dataTables.js │ ├── jquery.dataTables.min.js │ ├── jquery.validate.min.js │ ├── loonapp.js │ ├── npm.js │ ├── placeholder.js │ └── syntaxhighlighter_autoloads.js ├── syntaxhighlighter │ ├── css │ │ ├── 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 │ └── js │ │ ├── XRegExp.js │ │ ├── shAutoloader.js │ │ ├── shBrushAS3.js │ │ ├── shBrushAppleScript.js │ │ ├── shBrushBash.js │ │ ├── shBrushCSharp.js │ │ ├── shBrushColdFusion.js │ │ ├── shBrushCpp.js │ │ ├── shBrushCss.js │ │ ├── shBrushDelphi.js │ │ ├── shBrushDiff.js │ │ ├── shBrushErlang.js │ │ ├── shBrushGroovy.js │ │ ├── shBrushHaxe.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 └── ueditor │ ├── dialogs │ ├── anchor │ │ └── anchor.html │ ├── attachment │ │ ├── attachment.css │ │ ├── attachment.html │ │ ├── attachment.js │ │ ├── fileTypeImages │ │ │ ├── icon_chm.gif │ │ │ ├── icon_default.png │ │ │ ├── icon_doc.gif │ │ │ ├── icon_exe.gif │ │ │ ├── icon_jpg.gif │ │ │ ├── icon_mp3.gif │ │ │ ├── icon_mv.gif │ │ │ ├── icon_pdf.gif │ │ │ ├── icon_ppt.gif │ │ │ ├── icon_psd.gif │ │ │ ├── icon_rar.gif │ │ │ ├── icon_txt.gif │ │ │ └── icon_xls.gif │ │ └── images │ │ │ ├── alignicon.gif │ │ │ ├── alignicon.png │ │ │ ├── bg.png │ │ │ ├── file-icons.gif │ │ │ ├── file-icons.png │ │ │ ├── icons.gif │ │ │ ├── icons.png │ │ │ ├── image.png │ │ │ ├── progress.png │ │ │ ├── success.gif │ │ │ └── success.png │ ├── background │ │ ├── background.css │ │ ├── background.html │ │ ├── background.js │ │ └── images │ │ │ ├── bg.png │ │ │ └── success.png │ ├── charts │ │ ├── chart.config.js │ │ ├── charts.css │ │ ├── charts.html │ │ ├── charts.js │ │ └── images │ │ │ ├── charts0.png │ │ │ ├── charts1.png │ │ │ ├── charts2.png │ │ │ ├── charts3.png │ │ │ ├── charts4.png │ │ │ └── charts5.png │ ├── emotion │ │ ├── emotion.css │ │ ├── emotion.html │ │ ├── emotion.js │ │ └── images │ │ │ ├── 0.gif │ │ │ ├── bface.gif │ │ │ ├── cface.gif │ │ │ ├── fface.gif │ │ │ ├── jxface2.gif │ │ │ ├── neweditor-tab-bg.png │ │ │ ├── tface.gif │ │ │ ├── wface.gif │ │ │ └── yface.gif │ ├── gmap │ │ └── gmap.html │ ├── help │ │ ├── help.css │ │ ├── help.html │ │ └── help.js │ ├── image │ │ ├── image.css │ │ ├── image.html │ │ ├── image.js │ │ └── images │ │ │ ├── alignicon.jpg │ │ │ ├── bg.png │ │ │ ├── icons.gif │ │ │ ├── icons.png │ │ │ ├── image.png │ │ │ ├── progress.png │ │ │ ├── success.gif │ │ │ └── success.png │ ├── insertframe │ │ └── insertframe.html │ ├── internal.js │ ├── link │ │ └── link.html │ ├── map │ │ ├── map.html │ │ └── show.html │ ├── music │ │ ├── music.css │ │ ├── music.html │ │ └── music.js │ ├── preview │ │ └── preview.html │ ├── scrawl │ │ ├── images │ │ │ ├── addimg.png │ │ │ ├── brush.png │ │ │ ├── delimg.png │ │ │ ├── delimgH.png │ │ │ ├── empty.png │ │ │ ├── emptyH.png │ │ │ ├── eraser.png │ │ │ ├── redo.png │ │ │ ├── redoH.png │ │ │ ├── scale.png │ │ │ ├── scaleH.png │ │ │ ├── size.png │ │ │ ├── undo.png │ │ │ └── undoH.png │ │ ├── scrawl.css │ │ ├── scrawl.html │ │ └── scrawl.js │ ├── searchreplace │ │ ├── searchreplace.html │ │ └── searchreplace.js │ ├── snapscreen │ │ └── snapscreen.html │ ├── spechars │ │ ├── spechars.html │ │ └── spechars.js │ ├── table │ │ ├── dragicon.png │ │ ├── edittable.css │ │ ├── edittable.html │ │ ├── edittable.js │ │ ├── edittd.html │ │ └── edittip.html │ ├── template │ │ ├── config.js │ │ ├── images │ │ │ ├── bg.gif │ │ │ ├── pre0.png │ │ │ ├── pre1.png │ │ │ ├── pre2.png │ │ │ ├── pre3.png │ │ │ └── pre4.png │ │ ├── template.css │ │ ├── template.html │ │ └── template.js │ ├── video │ │ ├── images │ │ │ ├── bg.png │ │ │ ├── center_focus.jpg │ │ │ ├── file-icons.gif │ │ │ ├── file-icons.png │ │ │ ├── icons.gif │ │ │ ├── icons.png │ │ │ ├── image.png │ │ │ ├── left_focus.jpg │ │ │ ├── none_focus.jpg │ │ │ ├── progress.png │ │ │ ├── right_focus.jpg │ │ │ ├── success.gif │ │ │ └── success.png │ │ ├── video.css │ │ ├── video.html │ │ └── video.js │ ├── webapp │ │ └── webapp.html │ └── wordimage │ │ ├── fClipboard_ueditor.swf │ │ ├── imageUploader.swf │ │ ├── tangram.js │ │ ├── wordimage.html │ │ └── wordimage.js │ ├── index.html │ ├── lang │ ├── en │ │ ├── en.js │ │ └── images │ │ │ ├── addimage.png │ │ │ ├── alldeletebtnhoverskin.png │ │ │ ├── alldeletebtnupskin.png │ │ │ ├── background.png │ │ │ ├── button.png │ │ │ ├── copy.png │ │ │ ├── deletedisable.png │ │ │ ├── deleteenable.png │ │ │ ├── listbackground.png │ │ │ ├── localimage.png │ │ │ ├── music.png │ │ │ ├── rotateleftdisable.png │ │ │ ├── rotateleftenable.png │ │ │ ├── rotaterightdisable.png │ │ │ ├── rotaterightenable.png │ │ │ └── upload.png │ └── zh-cn │ │ ├── images │ │ ├── copy.png │ │ ├── localimage.png │ │ ├── music.png │ │ └── upload.png │ │ └── zh-cn.js │ ├── themes │ ├── default │ │ ├── css │ │ │ ├── ueditor.css │ │ │ └── ueditor.min.css │ │ ├── dialogbase.css │ │ └── images │ │ │ ├── anchor.gif │ │ │ ├── arrow.png │ │ │ ├── arrow_down.png │ │ │ ├── arrow_up.png │ │ │ ├── button-bg.gif │ │ │ ├── cancelbutton.gif │ │ │ ├── charts.png │ │ │ ├── cursor_h.gif │ │ │ ├── cursor_h.png │ │ │ ├── cursor_v.gif │ │ │ ├── cursor_v.png │ │ │ ├── dialog-title-bg.png │ │ │ ├── filescan.png │ │ │ ├── highlighted.gif │ │ │ ├── icons-all.gif │ │ │ ├── icons.gif │ │ │ ├── icons.png │ │ │ ├── loaderror.png │ │ │ ├── loading.gif │ │ │ ├── lock.gif │ │ │ ├── neweditor-tab-bg.png │ │ │ ├── pagebreak.gif │ │ │ ├── scale.png │ │ │ ├── sortable.png │ │ │ ├── spacer.gif │ │ │ ├── sparator_v.png │ │ │ ├── table-cell-align.png │ │ │ ├── tangram-colorpicker.png │ │ │ ├── toolbar_bg.png │ │ │ ├── unhighlighted.gif │ │ │ ├── upload.png │ │ │ ├── videologo.gif │ │ │ ├── word.gif │ │ │ └── wordpaste.png │ └── iframe.css │ ├── third-party │ ├── SyntaxHighlighter │ │ ├── shCore.js │ │ └── shCoreDefault.css │ ├── codemirror │ │ ├── codemirror.css │ │ └── codemirror.js │ ├── highcharts │ │ ├── adapters │ │ │ ├── mootools-adapter.js │ │ │ ├── mootools-adapter.src.js │ │ │ ├── prototype-adapter.js │ │ │ ├── prototype-adapter.src.js │ │ │ ├── standalone-framework.js │ │ │ └── standalone-framework.src.js │ │ ├── highcharts-more.js │ │ ├── highcharts-more.src.js │ │ ├── highcharts.js │ │ ├── highcharts.src.js │ │ ├── modules │ │ │ ├── annotations.js │ │ │ ├── annotations.src.js │ │ │ ├── canvas-tools.js │ │ │ ├── canvas-tools.src.js │ │ │ ├── data.js │ │ │ ├── data.src.js │ │ │ ├── drilldown.js │ │ │ ├── drilldown.src.js │ │ │ ├── exporting.js │ │ │ ├── exporting.src.js │ │ │ ├── funnel.js │ │ │ ├── funnel.src.js │ │ │ ├── heatmap.js │ │ │ ├── heatmap.src.js │ │ │ ├── map.js │ │ │ ├── map.src.js │ │ │ ├── no-data-to-display.js │ │ │ └── no-data-to-display.src.js │ │ └── themes │ │ │ ├── dark-blue.js │ │ │ ├── dark-green.js │ │ │ ├── gray.js │ │ │ ├── grid.js │ │ │ └── skies.js │ ├── jquery-1.10.2.js │ ├── jquery-1.10.2.min.js │ ├── jquery-1.10.2.min.map │ ├── snapscreen │ │ └── UEditorSnapscreen.exe │ ├── video-js │ │ ├── font │ │ │ ├── vjs.eot │ │ │ ├── vjs.svg │ │ │ ├── vjs.ttf │ │ │ └── vjs.woff │ │ ├── video-js.css │ │ ├── video-js.min.css │ │ ├── video-js.swf │ │ ├── video.dev.js │ │ └── video.js │ ├── webuploader │ │ ├── Uploader.swf │ │ ├── webuploader.css │ │ ├── webuploader.custom.js │ │ ├── webuploader.custom.min.js │ │ ├── webuploader.flashonly.js │ │ ├── webuploader.flashonly.min.js │ │ ├── webuploader.html5only.js │ │ ├── webuploader.html5only.min.js │ │ ├── webuploader.js │ │ ├── webuploader.min.js │ │ ├── webuploader.withoutimage.js │ │ └── webuploader.withoutimage.min.js │ ├── xss.min.js │ └── zeroclipboard │ │ ├── ZeroClipboard.js │ │ ├── ZeroClipboard.min.js │ │ └── ZeroClipboard.swf │ ├── ueditor.all.js │ ├── ueditor.all.min.js │ ├── ueditor.config.js │ ├── ueditor.parse.js │ └── ueditor.parse.min.js ├── templates ├── 403.html ├── 404.html ├── 500.html ├── about │ └── about.html ├── base.html ├── blog │ ├── blog_base.html │ ├── blog_edit.html │ ├── blog_index.html │ ├── blog_list.html │ ├── blog_view.html │ └── includes │ │ ├── blogbox.html │ │ ├── cmtdisplaybox.html │ │ ├── cmtformbox.html │ │ ├── paginator.html │ │ ├── replydisplaybox.html │ │ └── sidebar.html ├── index.html ├── interest │ └── index.html └── photo │ └── index.html └── uwsgi.ini /.gitignore: -------------------------------------------------------------------------------- 1 | /nohup.out 2 | *.pyc 3 | *.xml 4 | .idea 5 | .idea/* 6 | .idea/workspace.xml 7 | log/ 8 | settings/pro.py 9 | temp 10 | media/* 11 | os 12 | platform 13 | tests/*.json 14 | tests/cookies.pkl 15 | .DS_Store 16 | /.env 17 | venv/ 18 | .tags 19 | dump.rdb 20 | migrations/0* 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 blackholll 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # loonblog 2 | 基于django的个人博客系统 a blog base django 3 | 4 | ## 介绍 5 | - 本系统基于python(3.5)+ django(1.11.2)开发 6 | - 前端使用的是 http://www.dannysite.com/ 曾经的开源版本。 后端全部本人重写的 7 | - 项目demo见我的个人博客: http://www.loonapp.com 8 | - 欢迎访问我的个人博客 9 |  10 |  11 |  12 | 13 | 14 | 15 | ## 部署说明: 16 | - 目录结构说明 17 | 18 | apps: 功能模块列表,如博客、评论、图片、账号等等功能 19 | 20 | loonblog: 路由及wsgi配置 21 | 22 | media: 媒体文件,用于blog文章中的图片及附件保存路径 23 | 24 | requirement: 依赖说明,分为生产、开发、线上环境的依赖说明 25 | 26 | service: 服务层,具体的逻辑,与view分离 27 | 28 | settings: 配置文件,分为生产、开发、线上环境 29 | 30 | static: 静态文件 31 | 32 | templates: 模板文件 33 | 34 | - 安装依赖 35 | 1. 建议使用虚拟环境部署,请百度 virtualenv和virtualenvwrapper用法 36 | 2. 进入虚拟环境,cd到项目根目录,pip install -r requirement/pro.txt 37 | 38 | - 配置文件 39 | 1. 复制settings/dev.py为settings.pro,修改必要的配置,如DEBUG、MEDIA目录、数据库配置、日志文件路径等 40 | 41 | 42 | - 收集静态文件(本系统部分使用了django自带的admin后台的功能) 43 | 1. python manager collectstatic 44 | 45 | - 数据库初始化 46 | 1. python manage.py makemigrations 47 | 2. python manage.py migrate 48 | 49 | - 创建管理员账号 50 | 1. python manage.py creatsuperuser 51 | 52 | - 其他 53 | 1. 开发环境可以直接 python manager.py runserver 54 | 2. 线上环境建议使用nginx+uwsgi来部署.可参考 http://www.loonapp.com/blog/1/ 55 | 56 | ## 如何写博客 57 | 58 | - 登录管理员账号 59 | 1. 点击页面下方的"管理登录" 60 | 2. 使用上面创建的账号密码登录 61 | 62 | - 点击下方的"文章管理" 63 | 1. 注意:因为首页使用了缓存(默认5分钟),所以登录后还是显示的"管理登录"(这个后续会优化下),你可以登陆后访问系统首页,然后点击上方的"文章"后,页面下方就会出现"文章管理" 64 | 了 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /apps/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/apps/__init__.py -------------------------------------------------------------------------------- /apps/about/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/apps/about/__init__.py -------------------------------------------------------------------------------- /apps/about/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /apps/about/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AboutConfig(AppConfig): 5 | name = 'apps.about' 6 | -------------------------------------------------------------------------------- /apps/about/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/apps/about/migrations/__init__.py -------------------------------------------------------------------------------- /apps/about/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | 5 | class AboutMe(models.Model): 6 | """ 7 | 关于我 8 | """ 9 | description = models.TextField('内容') 10 | 11 | creator = models.CharField('创建人', max_length=50) 12 | gmt_created = models.DateTimeField('创建时间', auto_now_add=True, help_text="") 13 | gmt_modified = models.DateTimeField('修改时间', auto_now=True, help_text="") 14 | is_deleted = models.BooleanField('已删除', default=False) 15 | 16 | class AboutLoonapp(models.Model): 17 | """ 18 | 关于loonapp 19 | """ 20 | description = models.TextField('内容') 21 | 22 | creator = models.CharField('创建人', max_length=50) 23 | gmt_created = models.DateTimeField('创建时间', auto_now_add=True, help_text="") 24 | gmt_modified = models.DateTimeField('修改时间', auto_now=True, help_text="") 25 | is_deleted = models.BooleanField('已删除', default=False) 26 | 27 | class AboutCopyright(models.Model): 28 | """ 29 | 关于版权 30 | """ 31 | description = models.TextField('内容') 32 | 33 | creator = models.CharField('创建人', max_length=50) 34 | gmt_created = models.DateTimeField('创建时间', auto_now_add=True, help_text="") 35 | gmt_modified = models.DateTimeField('修改时间', auto_now=True, help_text="") 36 | is_deleted = models.BooleanField('已删除', default=False) 37 | 38 | -------------------------------------------------------------------------------- /apps/about/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /apps/about/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url 2 | from apps.about import views 3 | 4 | urlpatterns = [ 5 | url(r'^$', views.index, name='index'), 6 | 7 | ] -------------------------------------------------------------------------------- /apps/about/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | from django.views.decorators.cache import cache_page 5 | 6 | from services.about.about_service import AboutService 7 | 8 | # @cache_page(300) 9 | def index(request): 10 | about_service_obj = AboutService() 11 | about_mes, msg = about_service_obj.get_about_me_list() 12 | about_loonapps, msg2 = about_service_obj.get_about_loonapp_list() 13 | about_copyrights, msg2 = about_service_obj.get_about_copyright_list() 14 | return render(request, 'about/about.html', dict(about_mes=about_mes, about_loonapps=about_loonapps, 15 | about_copyrights=about_copyrights)) 16 | -------------------------------------------------------------------------------- /apps/account/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/apps/account/__init__.py -------------------------------------------------------------------------------- /apps/account/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from django.contrib.auth.models import Group 3 | 4 | # Register your models here. 5 | 6 | 7 | admin.site.unregister(Group) 8 | -------------------------------------------------------------------------------- /apps/account/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AccountConfig(AppConfig): 5 | name = 'apps.account' 6 | -------------------------------------------------------------------------------- /apps/account/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/apps/account/migrations/__init__.py -------------------------------------------------------------------------------- /apps/account/models.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth.base_user import AbstractBaseUser,BaseUserManager 2 | from django.db import models 3 | 4 | # Create your models here. 5 | 6 | 7 | 8 | class MyUserManager(BaseUserManager): 9 | def create_user(self, email, username, password=None, dep=0): 10 | """ 11 | Creates and saves a User with the given email, date of 12 | birth and password. 13 | """ 14 | if not email: 15 | raise ValueError('Users must have an email address') 16 | 17 | user = self.model( 18 | username = username, 19 | email=self.normalize_email(email), 20 | 21 | ) 22 | 23 | user.set_password(password) 24 | user.save(using=self._db) 25 | return user 26 | 27 | def create_superuser(self, email, username,password): 28 | """ 29 | Creates and saves a superuser with the given email, date of 30 | birth and password. 31 | """ 32 | user = self.create_user( 33 | email=self.normalize_email(email), 34 | username=username, 35 | password=password, 36 | ) 37 | user.is_admin = True 38 | user.save(using=self._db) 39 | return user 40 | 41 | 42 | class MyUser(AbstractBaseUser): 43 | """ 44 | 用户模型 45 | """ 46 | username = models.CharField(u'用户名', max_length=20, unique=True) 47 | chinese_name = models.CharField(u'中文名',max_length=20) 48 | email = models.EmailField(u'邮箱', max_length=50, unique=True) 49 | 50 | is_staff = models.BooleanField(u'职员', default=True) 51 | is_active = models.BooleanField(u'激活', default=True) 52 | is_admin = models.BooleanField(u'管理员', default=False) 53 | objects = MyUserManager() 54 | 55 | USERNAME_FIELD = 'username' 56 | REQUIRED_FIELDS = ['email'] 57 | 58 | def get_chinese_name(self): 59 | # The user is identified by their email address 60 | return self.chinese_name 61 | 62 | def get_short_name(self): 63 | # The user is identified by their email address 64 | return self.chinese_name 65 | 66 | def get_username(self): 67 | # The user is identified by their email address 68 | return self.username 69 | 70 | def get_full_name(self): 71 | # The user is identified by their email address 72 | return self.chinese_name 73 | 74 | def has_perm(self, perm, obj=None): 75 | "Does the user have a specific permission?" 76 | # Simplest possible answer: Yes, always 77 | return True 78 | 79 | def has_module_perms(self, app_label): 80 | return True 81 | 82 | 83 | # On Python 3: def __str__(self): 84 | def __unicode__(self): 85 | return self.chinese_name 86 | 87 | 88 | -------------------------------------------------------------------------------- /apps/account/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /apps/account/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | -------------------------------------------------------------------------------- /apps/blog/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/apps/blog/__init__.py -------------------------------------------------------------------------------- /apps/blog/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | from apps.blog.models import Topic, Category, Tag 5 | 6 | 7 | class TopicAdmin(admin.ModelAdmin): 8 | list_display = ('name', 'creator', 'gmt_created', 'is_deleted') 9 | search_fields = ('name',) 10 | fieldsets = ( 11 | (None, { 12 | 'fields': ('name', 'creator', 'gmt_created', 'gmt_modified', 'is_deleted') 13 | }),) 14 | 15 | def save_model(self, request, obj, form, change): 16 | obj.creator = request.user.username 17 | super(TopicAdmin, self).save_model(request, obj, form, change) 18 | 19 | def get_readonly_fields(self, request, obj=None): 20 | return ['gmt_created', 'gmt_modified', 'creator'] 21 | 22 | 23 | class CategoryAdmin(admin.ModelAdmin): 24 | list_display = ('name', 'creator', 'gmt_created', 'is_deleted') 25 | search_fields = ('name',) 26 | fieldsets = ( 27 | (None, { 28 | 'fields': ('name', 'creator', 'gmt_created', 'gmt_modified', 'is_deleted') 29 | }),) 30 | 31 | def save_model(self, request, obj, form, change): 32 | obj.creator = request.user.username 33 | super(CategoryAdmin, self).save_model(request, obj, form, change) 34 | 35 | def get_readonly_fields(self, request, obj=None): 36 | return ['gmt_created', 'gmt_modified', 'creator'] 37 | 38 | 39 | class TagAdmin(admin.ModelAdmin): 40 | list_display = ('name', 'creator', 'gmt_created', 'is_deleted') 41 | search_fields = ('name',) 42 | fieldsets = ( 43 | (None, { 44 | 'fields': ('name', 'creator', 'gmt_created', 'gmt_modified', 'is_deleted') 45 | }),) 46 | 47 | def save_model(self, request, obj, form, change): 48 | obj.creator = request.user.username 49 | super(TagAdmin, self).save_model(request, obj, form, change) 50 | 51 | def get_readonly_fields(self, request, obj=None): 52 | return ['gmt_created', 'gmt_modified', 'creator'] 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | admin.site.register(Topic, TopicAdmin) 61 | admin.site.register(Category, CategoryAdmin) 62 | admin.site.register(Tag, TagAdmin) 63 | 64 | -------------------------------------------------------------------------------- /apps/blog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class BlogConfig(AppConfig): 5 | name = 'apps.blog' 6 | -------------------------------------------------------------------------------- /apps/blog/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/apps/blog/migrations/__init__.py -------------------------------------------------------------------------------- /apps/blog/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | 5 | 6 | class Topic(models.Model): 7 | """ 8 | 专题 9 | """ 10 | name = models.CharField('名称', max_length=50) 11 | 12 | creator = models.CharField('创建人', max_length=50) 13 | gmt_created = models.DateTimeField('创建时间', auto_now_add=True, help_text="") 14 | gmt_modified = models.DateTimeField('修改时间', auto_now=True, help_text="") 15 | is_deleted = models.BooleanField('已删除', default=False) 16 | 17 | class Meta: 18 | verbose_name = '专题' 19 | verbose_name_plural = '专题' 20 | 21 | 22 | 23 | class Category(models.Model): 24 | """ 25 | 分类 26 | """ 27 | name = models.CharField('名称', max_length=50) 28 | 29 | creator = models.CharField('创建人', max_length=50) 30 | gmt_created = models.DateTimeField('创建时间', auto_now_add=True, help_text="") 31 | gmt_modified = models.DateTimeField('修改时间', auto_now=True, help_text="") 32 | is_deleted = models.BooleanField('已删除', default=False) 33 | 34 | class Meta: 35 | verbose_name = '分类' 36 | verbose_name_plural = '分类' 37 | 38 | 39 | 40 | class Tag(models.Model): 41 | """ 42 | 标签 43 | """ 44 | name = models.CharField('名称', max_length=50) 45 | 46 | creator = models.CharField('创建人', max_length=50) 47 | gmt_created = models.DateTimeField('创建时间', auto_now_add=True, help_text="") 48 | gmt_modified = models.DateTimeField('修改时间', auto_now=True, help_text="") 49 | is_deleted = models.BooleanField('已删除', default=False) 50 | 51 | class Meta: 52 | verbose_name = '标签' 53 | verbose_name_plural = '标签' 54 | 55 | 56 | class Blog(models.Model): 57 | """ 58 | 博客 59 | """ 60 | title = models.CharField('名称', max_length=500) 61 | topic_id = models.IntegerField('主题id', null=True, blank=True) 62 | category_id = models.IntegerField('分类id') 63 | view_count = models.IntegerField('访问次数', default=0) # 非实时更新,请求次数写入redis。 当redis值大于10时候再更新数据库 64 | 65 | content = models.TextField('内容') 66 | creator = models.CharField('创建人', max_length=50) 67 | gmt_created = models.DateTimeField('创建时间', auto_now_add=True, help_text="") 68 | gmt_modified = models.DateTimeField('修改时间', auto_now=True, help_text="") 69 | is_deleted = models.BooleanField('已删除', default=False) 70 | 71 | 72 | class BlogTag(models.Model): 73 | """ 74 | 博客标签 75 | """ 76 | blog_id = models.IntegerField('博客id') 77 | tag_id = models.IntegerField('标签id') 78 | 79 | creator = models.CharField('创建人', max_length=50) 80 | gmt_created = models.DateTimeField('创建时间', auto_now_add=True, help_text="") 81 | gmt_modified = models.DateTimeField('修改时间', auto_now=True, help_text="") 82 | is_deleted = models.BooleanField('已删除', default=False) 83 | -------------------------------------------------------------------------------- /apps/blog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /apps/blog/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url 2 | from apps.blog import views 3 | 4 | urlpatterns = [ 5 | url(r'^$', views.index, name='index'), 6 | url(r'^(\d+)/$', views.blog_view, name='blog_view'), 7 | url(r'^list/$', views.blog_list, name='list'), 8 | url(r'^add/$', views.blog_add, name='add'), 9 | url(r'^get_json_list/$', views.get_json_list, name="get_json_list"), 10 | url(r'^edit/(\d+)/$', views.blog_edit, name="edit"), 11 | 12 | ] -------------------------------------------------------------------------------- /apps/comment/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/apps/comment/__init__.py -------------------------------------------------------------------------------- /apps/comment/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /apps/comment/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CommentConfig(AppConfig): 5 | name = 'apps.comment' 6 | -------------------------------------------------------------------------------- /apps/comment/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/apps/comment/migrations/__init__.py -------------------------------------------------------------------------------- /apps/comment/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | 5 | 6 | class Comment(models.Model): 7 | """ 8 | 评论 9 | """ 10 | obj_type_id = models.IntegerField('对象类别') # 1.博客 2.评论 11 | obj_id = models.IntegerField('对象id') 12 | username = models.CharField('用户名', max_length=50, null=True, blank=True) 13 | name = models.CharField('姓名', max_length=50, null=True, blank=True) 14 | email = models.EmailField('邮箱', null=True, blank=True) 15 | content = models.TextField('内容') 16 | source_ip = models.CharField('来源ip', max_length=20) 17 | 18 | creator = models.CharField('创建人', max_length=50) 19 | gmt_created = models.DateTimeField('创建时间', auto_now_add=True, help_text="") 20 | gmt_modified = models.DateTimeField('修改时间', auto_now=True, help_text="") 21 | is_deleted = models.BooleanField('已删除', default=False) 22 | 23 | def get_replys(self): 24 | """ 25 | 评论的回复 26 | :return: 27 | """ 28 | return Comment.objects.filter(obj_type_id=2, obj_id=self.id, is_deleted=False) 29 | -------------------------------------------------------------------------------- /apps/comment/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /apps/comment/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url 2 | from apps.comment import views 3 | 4 | urlpatterns = [ 5 | url(r'^$', views.index, name='index'), 6 | url(r'^captcha/$', views.captcha, name='captcha'), 7 | url(r'^(\d+)/$', views.comment, name='comment'), 8 | 9 | ] -------------------------------------------------------------------------------- /apps/homepage/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/apps/homepage/__init__.py -------------------------------------------------------------------------------- /apps/homepage/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /apps/homepage/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class HomepageConfig(AppConfig): 5 | name = 'apps.homepage' 6 | -------------------------------------------------------------------------------- /apps/homepage/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/apps/homepage/migrations/__init__.py -------------------------------------------------------------------------------- /apps/homepage/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /apps/homepage/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /apps/homepage/urls.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/apps/homepage/urls.py -------------------------------------------------------------------------------- /apps/homepage/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | from django.views.decorators.cache import cache_page 5 | 6 | from services.blog.blog_service import BlogService 7 | from services.blog.category_service import CategoryService 8 | 9 | # @cache_page(300) 10 | def index(request): 11 | """ 12 | 首页- 13 | :param request: 14 | :return: 15 | """ 16 | top_categorys, msg = CategoryService.get_top_category() 17 | new_blogs, msg1 = BlogService.get_new_blog() 18 | hot_blogs, msg2 = BlogService.get_hot_blog() 19 | params = dict(top_categorys=top_categorys, new_blogs=new_blogs, hot_blogs=hot_blogs) 20 | return render(request, 'index.html', params) 21 | -------------------------------------------------------------------------------- /apps/interest/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/apps/interest/__init__.py -------------------------------------------------------------------------------- /apps/interest/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /apps/interest/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class InterestConfig(AppConfig): 5 | name = 'apps.interest' 6 | -------------------------------------------------------------------------------- /apps/interest/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/apps/interest/migrations/__init__.py -------------------------------------------------------------------------------- /apps/interest/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /apps/interest/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /apps/interest/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url 2 | from apps.interest import views 3 | 4 | urlpatterns = [ 5 | url(r'^$', views.index, name='index'), 6 | 7 | ] -------------------------------------------------------------------------------- /apps/interest/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | from django.views.decorators.cache import cache_page 5 | 6 | from services.about.about_service import AboutService 7 | 8 | @cache_page(300) 9 | def index(request): 10 | return render(request, 'interest/index.html') 11 | -------------------------------------------------------------------------------- /apps/photo/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/apps/photo/__init__.py -------------------------------------------------------------------------------- /apps/photo/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /apps/photo/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PhotoConfig(AppConfig): 5 | name = 'apps.photo' 6 | -------------------------------------------------------------------------------- /apps/photo/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/apps/photo/migrations/__init__.py -------------------------------------------------------------------------------- /apps/photo/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /apps/photo/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /apps/photo/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url 2 | from apps.photo import views 3 | 4 | urlpatterns = [ 5 | url(r'^$', views.index, name='index'), 6 | 7 | ] -------------------------------------------------------------------------------- /apps/photo/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | 5 | from django.shortcuts import render 6 | 7 | # Create your views here. 8 | from django.views.decorators.cache import cache_page 9 | 10 | from services.about.about_service import AboutService 11 | 12 | @cache_page(300) 13 | def index(request): 14 | return render(request, 'photo/index.html') 15 | -------------------------------------------------------------------------------- /apps/ueditor/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/apps/ueditor/__init__.py -------------------------------------------------------------------------------- /apps/ueditor/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /apps/ueditor/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class UeditorConfig(AppConfig): 5 | name = 'apps.ueditor' 6 | -------------------------------------------------------------------------------- /apps/ueditor/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/apps/ueditor/migrations/__init__.py -------------------------------------------------------------------------------- /apps/ueditor/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /apps/ueditor/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /apps/ueditor/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url 2 | from apps.ueditor.views import ueditor_index,ueditor_ImgUp, ueditor_FileUp 3 | 4 | 5 | urlpatterns = [ 6 | url(r'^$', ueditor_index), 7 | url(r'^ueditor_imgup/$', ueditor_ImgUp), 8 | url(r'^ueditor_fileup/$', ueditor_FileUp), 9 | ] 10 | -------------------------------------------------------------------------------- /loonblog/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/loonblog/__init__.py -------------------------------------------------------------------------------- /loonblog/urls.py: -------------------------------------------------------------------------------- 1 | """loonblog URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/1.11/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.conf.urls import url, include 14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 15 | """ 16 | from django.conf.urls import url, include 17 | from django.contrib import admin 18 | from django.conf import settings 19 | from django.conf.urls.static import static 20 | from apps.homepage.views import index 21 | from apps.blog import urls as blog_urls 22 | from apps.ueditor import urls as ueditor_urls 23 | from apps.comment import urls as comment_urls 24 | from apps.about import urls as about_urls 25 | from apps.photo import urls as photo_urls 26 | from apps.interest import urls as interest_urls 27 | 28 | 29 | urlpatterns = [ 30 | url(r'^admin/', admin.site.urls), 31 | url(r'^$', index), 32 | url(r'^blog/', include(blog_urls, namespace="blog")), 33 | url(r'^ueditor/', include(ueditor_urls, namespace="ueditor")), 34 | url(r'^comment/', include(comment_urls, namespace="comment")), 35 | url(r'^about/', include(about_urls, namespace="about")), 36 | url(r'^photo/', include(photo_urls, namespace="photo")), 37 | url(r'^interest/', include(interest_urls, namespace="interest")), 38 | ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) 39 | -------------------------------------------------------------------------------- /loonblog/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for loonblog 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.11/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.pro") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | 6 | if __name__ == "__main__": 7 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.dev") 8 | try: 9 | from django.core.management import execute_from_command_line 10 | except ImportError: 11 | # The above import may fail for some other reason. Ensure that the 12 | # issue is really that Django is missing to avoid masking other 13 | # exceptions on Python 2. 14 | try: 15 | import django 16 | except ImportError: 17 | raise ImportError( 18 | "Couldn't import Django. Are you sure it's installed and " 19 | "available on your PYTHONPATH environment variable? Did you " 20 | "forget to activate a virtual environment?" 21 | ) 22 | raise 23 | execute_from_command_line(sys.argv) 24 | -------------------------------------------------------------------------------- /requirement/common.txt: -------------------------------------------------------------------------------- 1 | #python==3.5.3 2 | image==1.5.5 3 | django==1.11.2 4 | redis==2.10.5 5 | django-redis-cache==1.7.1 6 | mysqlclient==1.3.10 7 | django-widget-tweaks==1.4.1 8 | -------------------------------------------------------------------------------- /requirement/dev.txt: -------------------------------------------------------------------------------- 1 | #requirements/dev.txt 2 | -r common.txt -------------------------------------------------------------------------------- /requirement/pro.txt: -------------------------------------------------------------------------------- 1 | #requirements/pro.txt 2 | -r common.txt -------------------------------------------------------------------------------- /requirement/test.txt: -------------------------------------------------------------------------------- 1 | #requirements/test.txt 2 | -r common.txt -------------------------------------------------------------------------------- /services/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/services/__init__.py -------------------------------------------------------------------------------- /services/about/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/services/about/__init__.py -------------------------------------------------------------------------------- /services/about/about_service.py: -------------------------------------------------------------------------------- 1 | from apps.about.models import AboutMe, AboutLoonapp, AboutCopyright 2 | from services.base_service import BaseService 3 | from services.common.auto_log_service import auto_log 4 | 5 | 6 | class AboutService(BaseService): 7 | def __init__(self): 8 | pass 9 | 10 | @staticmethod 11 | @auto_log 12 | def get_about_me_list(): 13 | """关于我""" 14 | return AboutMe.objects.filter(is_deleted=False), '' 15 | 16 | @staticmethod 17 | @auto_log 18 | def get_about_loonapp_list(): 19 | """关于lonnapp""" 20 | return AboutLoonapp.objects.filter(is_deleted=False), '' 21 | 22 | @staticmethod 23 | @auto_log 24 | def get_about_copyright_list(): 25 | """关于""" 26 | return AboutCopyright.objects.filter(is_deleted=False), '' 27 | -------------------------------------------------------------------------------- /services/base_service.py: -------------------------------------------------------------------------------- 1 | 2 | class BaseService(object): 3 | """ 4 | 基础service 5 | """ 6 | def __init__(self): 7 | pass 8 | -------------------------------------------------------------------------------- /services/blog/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/services/blog/__init__.py -------------------------------------------------------------------------------- /services/blog/blog_tag_service.py: -------------------------------------------------------------------------------- 1 | from apps.blog.models import BlogTag 2 | from services.base_service import BaseService 3 | from services.blog.tag_service import TagService 4 | from services.common.auto_log_service import auto_log 5 | 6 | 7 | class BlogTagService(BaseService): 8 | """ 9 | 标签service 10 | """ 11 | 12 | def __init__(self): 13 | pass 14 | 15 | @staticmethod 16 | @auto_log 17 | def get_tags_by_blog_id(blog_id): 18 | """ 19 | 获取文章的标签信息 20 | :param blog_id: 21 | :return: 22 | """ 23 | 24 | tag_list = [] 25 | tag_query = BlogTag.objects.filter(blog_id=blog_id) 26 | for tag_query0 in tag_query: 27 | tag_id = tag_query0.tag_id 28 | taginfo, msg = TagService.get_tag_by_id(tag_id) 29 | tag_name = taginfo[0].name 30 | tag_list.append(tag_name) 31 | return ','.join(tag_list), '' 32 | 33 | @staticmethod 34 | @auto_log 35 | def get_tag_list_by_blog_id(blog_id): 36 | """ 37 | 获取文章标签列表 38 | :param blog_id: 39 | :return: 40 | """ 41 | tag_list = [] 42 | tag_query = BlogTag.objects.filter(blog_id=blog_id) 43 | for tag_query0 in tag_query: 44 | tag_id = tag_query0.tag_id 45 | tag_info, msg = TagService.get_tag_by_id(tag_id) 46 | tag_id = tag_info[0].id 47 | tag_list.append(tag_id) 48 | return tag_list, '' 49 | 50 | @staticmethod 51 | @auto_log 52 | def get_tag_obj_list_by_blog_id(blog_id): 53 | """ 54 | 获取文章标签对象列表 55 | :param blog_id: 56 | :return: 57 | """ 58 | tag_query = BlogTag.objects.raw('select *, b.name as tag_name from blog_blogtag a join blog_tag b on ' 59 | 'a.`tag_id`=b.`id` where a.is_deleted=0 and a.blog_id= {}'.format(blog_id)) 60 | 61 | return tag_query, '' 62 | 63 | -------------------------------------------------------------------------------- /services/blog/category_service.py: -------------------------------------------------------------------------------- 1 | from apps.blog.models import Category 2 | from services.base_service import BaseService 3 | from services.common.auto_log_service import auto_log 4 | 5 | 6 | class CategoryService(BaseService): 7 | """ 8 | 分类service 9 | """ 10 | def __init__(self): 11 | pass 12 | 13 | @staticmethod 14 | @auto_log 15 | def get_category_list(): 16 | """ 17 | 获取分类列表 18 | :return: 19 | """ 20 | return Category.objects.filter(is_deleted=False), '' 21 | 22 | @staticmethod 23 | @auto_log 24 | def get_category_by_id(id): 25 | """ 26 | 获取分类信息 27 | :param id: 28 | :return: 29 | """ 30 | return Category.objects.filter(id=id), '' 31 | 32 | @staticmethod 33 | @auto_log 34 | def get_top_category(top=5): 35 | """ 36 | 获取具有数量最多blog的前top分类 37 | :return: 38 | """ 39 | result = Category.objects.raw("select b.id, b.name, count(*) as count from blog_blog a join blog_category b on a.`category_id`=b.id group by(category_id)") 40 | return result[:top], '' 41 | -------------------------------------------------------------------------------- /services/blog/tag_service.py: -------------------------------------------------------------------------------- 1 | from apps.blog.models import Tag 2 | from services.base_service import BaseService 3 | from services.common.auto_log_service import auto_log 4 | 5 | 6 | class TagService(BaseService): 7 | """ 8 | 标签service 9 | """ 10 | 11 | def __init__(self): 12 | pass 13 | 14 | @staticmethod 15 | @auto_log 16 | def get_tag_list(): 17 | """ 18 | 获取标签列表 19 | :return: 20 | """ 21 | return Tag.objects.filter(is_deleted=False), '' 22 | 23 | @staticmethod 24 | @auto_log 25 | def get_tag_by_id(id): 26 | """ 27 | 获取标签信息 28 | :param id: 29 | :return: 30 | """ 31 | return Tag.objects.filter(id=id), '' 32 | -------------------------------------------------------------------------------- /services/blog/topic_service.py: -------------------------------------------------------------------------------- 1 | from apps.blog.models import Topic 2 | from services.base_service import BaseService 3 | from services.common.auto_log_service import auto_log 4 | 5 | 6 | class TopicService(BaseService): 7 | """ 8 | 专题service 9 | """ 10 | 11 | def __init__(self): 12 | pass 13 | 14 | @staticmethod 15 | @auto_log 16 | def get_topic_list(): 17 | """ 18 | 获取主题列表 19 | :return: 20 | """ 21 | return Topic.objects.filter(is_deleted=False), '' 22 | 23 | @staticmethod 24 | @auto_log 25 | def get_topic_by_id(id): 26 | """ 27 | 获取主题信息 28 | :param id: 29 | :return: 30 | """ 31 | return Topic.objects.filter(id=id), '' 32 | -------------------------------------------------------------------------------- /services/comment/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/services/comment/__init__.py -------------------------------------------------------------------------------- /services/comment/comment_service.py: -------------------------------------------------------------------------------- 1 | from services.base_service import BaseService 2 | from services.common.auto_log_service import auto_log 3 | from apps.comment.models import Comment 4 | from services.common.msg_service import MsgService 5 | import logging 6 | logger = logging.getLogger('default') 7 | 8 | 9 | class CommentService(BaseService): 10 | def __init__(self): 11 | pass 12 | 13 | @staticmethod 14 | @auto_log 15 | def get_comment_count_by_blog_id(obj_id, obj_type_id=1): 16 | """ 17 | 获取评论个数 18 | :param obj_id: 评论对象 19 | :param obj_type_id: 评论对象类别 #1.博客 2. 20 | :return: 21 | """ 22 | return Comment.objects.filter(obj_id=obj_id, obj_type_id=obj_type_id).count(), '' 23 | 24 | @staticmethod 25 | @auto_log 26 | def add_comment(kwargs): 27 | """ 28 | 新增评论 29 | :param kwargs: 30 | :return: 31 | """ 32 | # 不允许包含http 33 | if 'http://' in kwargs['content']: 34 | source_ip = kwargs['source_ip'] 35 | logger.info('*'*30) 36 | logger.info('评论中包含http,来源:%s' % source_ip) 37 | logger.info(kwargs['content']) 38 | logger.info('*' * 30) 39 | return False, '非法内容,禁止评论。如有疑问请直接联系博主(页面顶部"关于"中有联系方式)' 40 | 41 | blog_id = kwargs['blog_id'] 42 | recomment_email = kwargs['recomment_email'] 43 | kwargs.pop('blog_id') 44 | kwargs.pop('recomment_email') 45 | comment_obj = Comment(**kwargs) 46 | comment_obj.save() 47 | 48 | if kwargs['creator'] == 'admin' or kwargs['obj_type_id'] != 2: # 管理员留言或者给管理员留言的情况才发送邮件通知 49 | # MsgService().send_email_by_process('来自loonapp的留言提醒', 50 | # '你有一条新的留言,请登录查看: http://loonapp.com/blog/{}/'.format(blog_id), 51 | # [kwargs['email']]) 52 | 53 | MsgService().send_multi_email_by_process('来自loonapp的留言提醒', 54 | '
你有一条新的留言,请点击查看'.format(blog_id),
55 | [recomment_email])
56 |
57 | return True, comment_obj
58 |
59 | @staticmethod
60 | @auto_log
61 | def get_comment_by_blog_id(obj_id, obj_type_id=1):
62 | """
63 | 获取评论
64 | :param obj_id:
65 | :param obj_type_id:
66 | :return:
67 | """
68 | return Comment.objects.filter(obj_id=obj_id, obj_type_id=obj_type_id, is_deleted=False), ''
69 |
70 | @staticmethod
71 | @auto_log
72 | def get_comment_by_id(comment_id):
73 | """
74 | 获取评论
75 | :param comment_id:
76 | :return:
77 | """
78 | return Comment.objects.filter(id=comment_id, is_deleted=False), ''
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/services/common/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/blackholll/loonblog/63d1f06d04047f220f550de914e542f535bb61a3/services/common/__init__.py
--------------------------------------------------------------------------------
/services/common/auto_log_service.py:
--------------------------------------------------------------------------------
1 | import logging
2 | import traceback
3 |
4 | logger = logging.getLogger('default')
5 |
6 |
7 | def auto_log(func):
8 | """
9 | 自动记录日志的装饰器:
10 | :param func:
11 | :return:
12 | """
13 | def _deco(*args, **kwargs):
14 | try:
15 | real_func = func(*args, **kwargs)
16 | return real_func
17 | except Exception as e:
18 | logger.error(traceback.format_exc())
19 | return False, e.__str__()
20 |
21 | return _deco
22 |
23 |
24 | def auto_class_log(some_class):
25 | """
26 | 类装饰器
27 | :param some_class:
28 | :return:
29 | """
30 | pass
31 | # 貌似没法通过对类加装饰器实现类里面所有方法都加入装饰器处理, 以后有时间再研究下
--------------------------------------------------------------------------------
/services/common/context_processors.py:
--------------------------------------------------------------------------------
1 | from django.conf import settings
2 |
3 |
4 | def now_env(request):
5 | """
6 | 获取当前环境
7 | :param request:
8 | :return:
9 | """
10 | env = settings.ENV
11 | return {'now_env': env}
12 |
--------------------------------------------------------------------------------
/services/common/ip_service.py:
--------------------------------------------------------------------------------
1 | from services.base_service import BaseService
2 | from services.common.auto_log_service import auto_log
3 |
4 |
5 | class IpService(BaseService):
6 | """
7 | ip地址服务
8 | """
9 | def __int__(self):
10 | pass
11 |
12 | @staticmethod
13 | @auto_log
14 | def get_client_ip(request):
15 | """
16 | 获取客户端ip地址
17 | :param request:
18 | :return:
19 | """
20 | x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
21 | if x_forwarded_for:
22 | ip = x_forwarded_for.split(',')[-1].strip()
23 | else:
24 | ip = request.META.get('REMOTE_ADDR')
25 | return ip, ''
26 |
--------------------------------------------------------------------------------
/services/common/msg_service.py:
--------------------------------------------------------------------------------
1 | import os
2 | import multiprocessing
3 | from multiprocessing import Process
4 | from django.core.mail import send_mail,EmailMultiAlternatives
5 | from services.base_service import BaseService
6 | from services.common.auto_log_service import auto_log
7 | import logging
8 | logger = logging.getLogger('default')
9 |
10 | class MsgService(BaseService):
11 | """
12 | 消息服务
13 | """
14 | def __init__(self):
15 | pass
16 |
17 | @staticmethod
18 | @auto_log
19 | def send_email_by_process(subject, content, mail_to_list):
20 | """
21 | 发送邮件
22 | :param subject:
23 | :param content:
24 | :param mail_to_list:收件人
25 | :return:
26 | """
27 | # logger.info('同步发送')
28 | # a = send_mail(subject, content, 'LOONAPP').children("ul"),s);i!==m&&b(h).find("[data-dt-idx="+i+"]").focus()};return f});
9 |
--------------------------------------------------------------------------------
/static/js/loonapp.js:
--------------------------------------------------------------------------------
1 | function getCookie(name) {
2 | var cookieValue = null;
3 | if (document.cookie && document.cookie != '') {
4 | var cookies = document.cookie.split(';');
5 | for (var i = 0; i < cookies.length; i++) {
6 | var cookie = jQuery.trim(cookies[i]);
7 | // Does this cookie string begin with the name we want?
8 | if (cookie.substring(0, name.length + 1) == (name + '=')) {
9 | cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
10 | break;
11 | }
12 | }
13 | }
14 | return cookieValue;
15 | }
16 |
--------------------------------------------------------------------------------
/static/js/npm.js:
--------------------------------------------------------------------------------
1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.
2 | require('../../js/transition.js')
3 | require('../../js/alert.js')
4 | require('../../js/button.js')
5 | require('../../js/carousel.js')
6 | require('../../js/collapse.js')
7 | require('../../js/dropdown.js')
8 | require('../../js/modal.js')
9 | require('../../js/tooltip.js')
10 | require('../../js/popover.js')
11 | require('../../js/scrollspy.js')
12 | require('../../js/tab.js')
13 | require('../../js/affix.js')
--------------------------------------------------------------------------------
/static/js/placeholder.js:
--------------------------------------------------------------------------------
1 | (function($) {
2 | $.fn.placeholder = function() {
3 | if(typeof document.createElement("input").placeholder == 'undefined') {
4 | $('[placeholder]').focus(function() {
5 | var input = $(this);
6 | if (input.val() == input.attr('placeholder')) {
7 | input.val('');
8 | input.removeClass('placeholder');
9 | }
10 | }).blur(function() {
11 | var input = $(this);
12 | if (input.val() == '' || input.val() == input.attr('placeholder')) {
13 | input.addClass('placeholder');
14 | input.val(input.attr('placeholder'));
15 | }
16 | }).blur().parents('form').submit(function() {
17 | $(this).find('[placeholder]').each(function() {
18 | var input = $(this);
19 | if (input.val() == input.attr('placeholder')) {
20 | input.val('');
21 | }
22 | })
23 | });
24 | }
25 | }
26 | })(jQuery);
--------------------------------------------------------------------------------
/static/js/syntaxhighlighter_autoloads.js:
--------------------------------------------------------------------------------
1 | function path()
2 | {
3 | var args = arguments,
4 | result = []
5 | ;
6 |
7 | for(var i = 0; i < args.length; i++)
8 | result.push(args[i].replace('@', '/static/syntaxhighlighter/js/'));
9 |
10 | return result
11 | };
12 |
13 | $(document).ready(function(){
14 | SyntaxHighlighter.autoloader.apply(null, path(
15 | 'applescript @shBrushAppleScript.js',
16 | 'actionscript3 as3 @shBrushAS3.js',
17 | 'bash shell @shBrushBash.js',
18 | 'coldfusion cf @shBrushColdFusion.js',
19 | 'cpp c @shBrushCpp.js',
20 | 'c# c-sharp csharp @shBrushCSharp.js',
21 | 'css @shBrushCss.js',
22 | 'delphi pascal @shBrushDelphi.js',
23 | 'diff patch pas @shBrushDiff.js',
24 | 'erl erlang @shBrushErlang.js',
25 | 'groovy @shBrushGroovy.js',
26 | 'java @shBrushJava.js',
27 | 'jfx javafx @shBrushJavaFX.js',
28 | 'js jscript javascript @shBrushJScript.js',
29 | 'perl pl @shBrushPerl.js',
30 | 'php @shBrushPhp.js',
31 | 'text plain @shBrushPlain.js',
32 | 'py python @shBrushPython.js',
33 | 'ruby rails ror rb @shBrushRuby.js',
34 | 'sass scss @shBrushSass.js',
35 | 'scala @shBrushScala.js',
36 | 'sql @shBrushSql.js',
37 | 'vb vbnet @shBrushVb.js',
38 | 'xml xhtml xslt html @shBrushXml.js'
39 | ));
40 | SyntaxHighlighter.all();
41 | });
--------------------------------------------------------------------------------
/static/syntaxhighlighter/css/shThemeEmacs.css:
--------------------------------------------------------------------------------
1 | .syntaxhighlighter {
2 | background-color: black !important;
3 | }
4 | .syntaxhighlighter .line.alt1 {
5 | background-color: black !important;
6 | }
7 | .syntaxhighlighter .line.alt2 {
8 | background-color: black !important;
9 | }
10 | .syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 {
11 | background-color: #2a3133 !important;
12 | }
13 | .syntaxhighlighter .line.highlighted.number {
14 | color: white !important;
15 | }
16 | .syntaxhighlighter table caption {
17 | color: #d3d3d3 !important;
18 | }
19 | .syntaxhighlighter .gutter {
20 | color: #d3d3d3 !important;
21 | }
22 | .syntaxhighlighter .gutter .line {
23 | border-right: 3px solid #990000 !important;
24 | }
25 | .syntaxhighlighter .gutter .line.highlighted {
26 | background-color: #990000 !important;
27 | color: black !important;
28 | }
29 | .syntaxhighlighter.printing .line .content {
30 | border: none !important;
31 | }
32 | .syntaxhighlighter.collapsed {
33 | overflow: visible !important;
34 | }
35 | .syntaxhighlighter.collapsed .toolbar {
36 | color: #ebdb8d !important;
37 | background: black !important;
38 | border: 1px solid #990000 !important;
39 | }
40 | .syntaxhighlighter.collapsed .toolbar a {
41 | color: #ebdb8d !important;
42 | }
43 | .syntaxhighlighter.collapsed .toolbar a:hover {
44 | color: #ff7d27 !important;
45 | }
46 | .syntaxhighlighter .toolbar {
47 | color: white !important;
48 | background: #990000 !important;
49 | border: none !important;
50 | }
51 | .syntaxhighlighter .toolbar a {
52 | color: white !important;
53 | }
54 | .syntaxhighlighter .toolbar a:hover {
55 | color: #9ccff4 !important;
56 | }
57 | .syntaxhighlighter .plain, .syntaxhighlighter .plain a {
58 | color: #d3d3d3 !important;
59 | }
60 | .syntaxhighlighter .comments, .syntaxhighlighter .comments a {
61 | color: #ff7d27 !important;
62 | }
63 | .syntaxhighlighter .string, .syntaxhighlighter .string a {
64 | color: #ff9e7b !important;
65 | }
66 | .syntaxhighlighter .keyword {
67 | color: aqua !important;
68 | }
69 | .syntaxhighlighter .preprocessor {
70 | color: #aec4de !important;
71 | }
72 | .syntaxhighlighter .variable {
73 | color: #ffaa3e !important;
74 | }
75 | .syntaxhighlighter .value {
76 | color: #009900 !important;
77 | }
78 | .syntaxhighlighter .functions {
79 | color: #81cef9 !important;
80 | }
81 | .syntaxhighlighter .constants {
82 | color: #ff9e7b !important;
83 | }
84 | .syntaxhighlighter .script {
85 | font-weight: bold !important;
86 | color: aqua !important;
87 | background-color: none !important;
88 | }
89 | .syntaxhighlighter .color1, .syntaxhighlighter .color1 a {
90 | color: #ebdb8d !important;
91 | }
92 | .syntaxhighlighter .color2, .syntaxhighlighter .color2 a {
93 | color: #ff7d27 !important;
94 | }
95 | .syntaxhighlighter .color3, .syntaxhighlighter .color3 a {
96 | color: #aec4de !important;
97 | }
98 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/css/shThemeMDUltra.css:
--------------------------------------------------------------------------------
1 | .syntaxhighlighter {
2 | background-color: #222222 !important;
3 | }
4 | .syntaxhighlighter .line.alt1 {
5 | background-color: #222222 !important;
6 | }
7 | .syntaxhighlighter .line.alt2 {
8 | background-color: #222222 !important;
9 | }
10 | .syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 {
11 | background-color: #253e5a !important;
12 | }
13 | .syntaxhighlighter .line.highlighted.number {
14 | color: white !important;
15 | }
16 | .syntaxhighlighter table caption {
17 | color: lime !important;
18 | }
19 | .syntaxhighlighter .gutter {
20 | color: #38566f !important;
21 | }
22 | .syntaxhighlighter .gutter .line {
23 | border-right: 3px solid #435a5f !important;
24 | }
25 | .syntaxhighlighter .gutter .line.highlighted {
26 | background-color: #435a5f !important;
27 | color: #222222 !important;
28 | }
29 | .syntaxhighlighter.printing .line .content {
30 | border: none !important;
31 | }
32 | .syntaxhighlighter.collapsed {
33 | overflow: visible !important;
34 | }
35 | .syntaxhighlighter.collapsed .toolbar {
36 | color: #428bdd !important;
37 | background: black !important;
38 | border: 1px solid #435a5f !important;
39 | }
40 | .syntaxhighlighter.collapsed .toolbar a {
41 | color: #428bdd !important;
42 | }
43 | .syntaxhighlighter.collapsed .toolbar a:hover {
44 | color: lime !important;
45 | }
46 | .syntaxhighlighter .toolbar {
47 | color: #aaaaff !important;
48 | background: #435a5f !important;
49 | border: none !important;
50 | }
51 | .syntaxhighlighter .toolbar a {
52 | color: #aaaaff !important;
53 | }
54 | .syntaxhighlighter .toolbar a:hover {
55 | color: #9ccff4 !important;
56 | }
57 | .syntaxhighlighter .plain, .syntaxhighlighter .plain a {
58 | color: lime !important;
59 | }
60 | .syntaxhighlighter .comments, .syntaxhighlighter .comments a {
61 | color: #428bdd !important;
62 | }
63 | .syntaxhighlighter .string, .syntaxhighlighter .string a {
64 | color: lime !important;
65 | }
66 | .syntaxhighlighter .keyword {
67 | color: #aaaaff !important;
68 | }
69 | .syntaxhighlighter .preprocessor {
70 | color: #8aa6c1 !important;
71 | }
72 | .syntaxhighlighter .variable {
73 | color: aqua !important;
74 | }
75 | .syntaxhighlighter .value {
76 | color: #f7e741 !important;
77 | }
78 | .syntaxhighlighter .functions {
79 | color: #ff8000 !important;
80 | }
81 | .syntaxhighlighter .constants {
82 | color: yellow !important;
83 | }
84 | .syntaxhighlighter .script {
85 | font-weight: bold !important;
86 | color: #aaaaff !important;
87 | background-color: none !important;
88 | }
89 | .syntaxhighlighter .color1, .syntaxhighlighter .color1 a {
90 | color: red !important;
91 | }
92 | .syntaxhighlighter .color2, .syntaxhighlighter .color2 a {
93 | color: yellow !important;
94 | }
95 | .syntaxhighlighter .color3, .syntaxhighlighter .color3 a {
96 | color: #ffaa3e !important;
97 | }
98 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/js/shBrushAS3.js:
--------------------------------------------------------------------------------
1 | ;(function()
2 | {
3 | // CommonJS
4 | SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
5 |
6 | function Brush()
7 | {
8 | // Created by Peter Atoria @ http://iAtoria.com
9 |
10 | var inits = 'class interface function package';
11 |
12 | var keywords = '-Infinity ...rest Array as AS3 Boolean break case catch const continue Date decodeURI ' +
13 | 'decodeURIComponent default delete do dynamic each else encodeURI encodeURIComponent escape ' +
14 | 'extends false final finally flash_proxy for get if implements import in include Infinity ' +
15 | 'instanceof int internal is isFinite isNaN isXMLName label namespace NaN native new null ' +
16 | 'Null Number Object object_proxy override parseFloat parseInt private protected public ' +
17 | 'return set static String super switch this throw true try typeof uint undefined unescape ' +
18 | 'use void while with'
19 | ;
20 |
21 | this.regexList = [
22 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
23 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
24 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
25 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
26 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers
27 | { regex: new RegExp(this.getKeywords(inits), 'gm'), css: 'color3' }, // initializations
28 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
29 | { regex: new RegExp('var', 'gm'), css: 'variable' }, // variable
30 | { regex: new RegExp('trace', 'gm'), css: 'color1' } // trace
31 | ];
32 |
33 | this.forHtmlScript(SyntaxHighlighter.regexLib.scriptScriptTags);
34 | };
35 |
36 | Brush.prototype = new SyntaxHighlighter.Highlighter();
37 | Brush.aliases = ['actionscript3', 'as3'];
38 |
39 | SyntaxHighlighter.brushes.AS3 = Brush;
40 |
41 | // CommonJS
42 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
43 | })();
44 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/js/shBrushCSharp.js:
--------------------------------------------------------------------------------
1 | ;(function()
2 | {
3 | // CommonJS
4 | SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
5 |
6 | function Brush()
7 | {
8 | var keywords = 'abstract as base bool break byte case catch char checked class const ' +
9 | 'continue decimal default delegate do double else enum event explicit volatile ' +
10 | 'extern false finally fixed float for foreach get goto if implicit in int ' +
11 | 'interface internal is lock long namespace new null object operator out ' +
12 | 'override params private protected public readonly ref return sbyte sealed set ' +
13 | 'short sizeof stackalloc static string struct switch this throw true try ' +
14 | 'typeof uint ulong unchecked unsafe ushort using virtual void while var ' +
15 | 'from group by into select let where orderby join on equals ascending descending';
16 |
17 | function fixComments(match, regexInfo)
18 | {
19 | var css = (match[0].indexOf("///") == 0)
20 | ? 'color1'
21 | : 'comments'
22 | ;
23 |
24 | return [new SyntaxHighlighter.Match(match[0], match.index, css)];
25 | }
26 |
27 | this.regexList = [
28 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, func : fixComments }, // one line comments
29 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
30 | { regex: /@"(?:[^"]|"")*"/g, css: 'string' }, // @-quoted strings
31 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
32 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
33 | { regex: /^\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
34 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // c# keyword
35 | { regex: /\bpartial(?=\s+(?:class|interface|struct)\b)/g, css: 'keyword' }, // contextual keyword: 'partial'
36 | { regex: /\byield(?=\s+(?:return|break)\b)/g, css: 'keyword' } // contextual keyword: 'yield'
37 | ];
38 |
39 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
40 | };
41 |
42 | Brush.prototype = new SyntaxHighlighter.Highlighter();
43 | Brush.aliases = ['c#', 'c-sharp', 'csharp'];
44 |
45 | SyntaxHighlighter.brushes.CSharp = Brush;
46 |
47 | // CommonJS
48 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
49 | })();
50 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/js/shBrushDelphi.js:
--------------------------------------------------------------------------------
1 | ;(function()
2 | {
3 | // CommonJS
4 | SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
5 |
6 | function Brush()
7 | {
8 | var keywords = 'abs addr and ansichar ansistring array as asm begin boolean byte cardinal ' +
9 | 'case char class comp const constructor currency destructor div do double ' +
10 | 'downto else end except exports extended false file finalization finally ' +
11 | 'for function goto if implementation in inherited int64 initialization ' +
12 | 'integer interface is label library longint longword mod nil not object ' +
13 | 'of on or packed pansichar pansistring pchar pcurrency pdatetime pextended ' +
14 | 'pint64 pointer private procedure program property pshortstring pstring ' +
15 | 'pvariant pwidechar pwidestring protected public published raise real real48 ' +
16 | 'record repeat set shl shortint shortstring shr single smallint string then ' +
17 | 'threadvar to true try type unit until uses val var varirnt while widechar ' +
18 | 'widestring with word write writeln xor';
19 |
20 | this.regexList = [
21 | { regex: /\(\*[\s\S]*?\*\)/gm, css: 'comments' }, // multiline comments (* *)
22 | { regex: /{(?!\$)[\s\S]*?}/gm, css: 'comments' }, // multiline comments { }
23 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line
24 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
25 | { regex: /\{\$[a-zA-Z]+ .+\}/g, css: 'color1' }, // compiler Directives and Region tags
26 | { regex: /\b[\d\.]+\b/g, css: 'value' }, // numbers 12345
27 | { regex: /\$[a-zA-Z0-9]+\b/g, css: 'value' }, // numbers $F5D3
28 | { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword
29 | ];
30 | };
31 |
32 | Brush.prototype = new SyntaxHighlighter.Highlighter();
33 | Brush.aliases = ['delphi', 'pascal', 'pas'];
34 |
35 | SyntaxHighlighter.brushes.Delphi = Brush;
36 |
37 | // CommonJS
38 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
39 | })();
40 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/js/shBrushDiff.js:
--------------------------------------------------------------------------------
1 | ;(function()
2 | {
3 | // CommonJS
4 | SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
5 |
6 | function Brush()
7 | {
8 | this.regexList = [
9 | { regex: /^\+\+\+ .*$/gm, css: 'color2' }, // new file
10 | { regex: /^\-\-\- .*$/gm, css: 'color2' }, // old file
11 | { regex: /^\s.*$/gm, css: 'color1' }, // unchanged
12 | { regex: /^@@.*@@.*$/gm, css: 'variable' }, // location
13 | { regex: /^\+.*$/gm, css: 'string' }, // additions
14 | { regex: /^\-.*$/gm, css: 'color3' } // deletions
15 | ];
16 | };
17 |
18 | Brush.prototype = new SyntaxHighlighter.Highlighter();
19 | Brush.aliases = ['diff', 'patch'];
20 |
21 | SyntaxHighlighter.brushes.Diff = Brush;
22 |
23 | // CommonJS
24 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
25 | })();
26 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/js/shBrushErlang.js:
--------------------------------------------------------------------------------
1 | ;(function()
2 | {
3 | // CommonJS
4 | SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
5 |
6 | function Brush()
7 | {
8 | // Contributed by Jean-Lou Dupont
9 | // http://jldupont.blogspot.com/2009/06/erlang-syntax-highlighter.html
10 |
11 | // According to: http://erlang.org/doc/reference_manual/introduction.html#1.5
12 | var keywords = 'after and andalso band begin bnot bor bsl bsr bxor '+
13 | 'case catch cond div end fun if let not of or orelse '+
14 | 'query receive rem try when xor'+
15 | // additional
16 | ' module export import define';
17 |
18 | this.regexList = [
19 | { regex: new RegExp("[A-Z][A-Za-z0-9_]+", 'g'), css: 'constants' },
20 | { regex: new RegExp("\\%.+", 'gm'), css: 'comments' },
21 | { regex: new RegExp("\\?[A-Za-z0-9_]+", 'g'), css: 'preprocessor' },
22 | { regex: new RegExp("[a-z0-9_]+:[a-z0-9_]+", 'g'), css: 'functions' },
23 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' },
24 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' },
25 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }
26 | ];
27 | };
28 |
29 | Brush.prototype = new SyntaxHighlighter.Highlighter();
30 | Brush.aliases = ['erl', 'erlang'];
31 |
32 | SyntaxHighlighter.brushes.Erland = Brush;
33 |
34 | // CommonJS
35 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
36 | })();
37 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/js/shBrushGroovy.js:
--------------------------------------------------------------------------------
1 | ;(function()
2 | {
3 | // CommonJS
4 | SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
5 |
6 | function Brush()
7 | {
8 | // Contributed by Andres Almiray
9 | // http://jroller.com/aalmiray/entry/nice_source_code_syntax_highlighter
10 |
11 | var keywords = 'as assert break case catch class continue def default do else extends finally ' +
12 | 'if in implements import instanceof interface new package property return switch ' +
13 | 'throw throws try while public protected private static';
14 | var types = 'void boolean byte char short int long float double';
15 | var constants = 'null';
16 | var methods = 'allProperties count get size '+
17 | 'collect each eachProperty eachPropertyName eachWithIndex find findAll ' +
18 | 'findIndexOf grep inject max min reverseEach sort ' +
19 | 'asImmutable asSynchronized flatten intersect join pop reverse subMap toList ' +
20 | 'padRight padLeft contains eachMatch toCharacter toLong toUrl tokenize ' +
21 | 'eachFile eachFileRecurse eachB yte eachLine readBytes readLine getText ' +
22 | 'splitEachLine withReader append encodeBase64 decodeBase64 filterLine ' +
23 | 'transformChar transformLine withOutputStream withPrintWriter withStream ' +
24 | 'withStreams withWriter withWriterAppend write writeLine '+
25 | 'dump inspect invokeMethod print println step times upto use waitForOrKill '+
26 | 'getText';
27 |
28 | this.regexList = [
29 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
30 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
31 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
32 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
33 | { regex: /""".*"""/g, css: 'string' }, // GStrings
34 | { regex: new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b', 'gi'), css: 'value' }, // numbers
35 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // goovy keyword
36 | { regex: new RegExp(this.getKeywords(types), 'gm'), css: 'color1' }, // goovy/java type
37 | { regex: new RegExp(this.getKeywords(constants), 'gm'), css: 'constants' }, // constants
38 | { regex: new RegExp(this.getKeywords(methods), 'gm'), css: 'functions' } // methods
39 | ];
40 |
41 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
42 | }
43 |
44 | Brush.prototype = new SyntaxHighlighter.Highlighter();
45 | Brush.aliases = ['groovy'];
46 |
47 | SyntaxHighlighter.brushes.Groovy = Brush;
48 |
49 | // CommonJS
50 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
51 | })();
52 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/js/shBrushHaxe.js:
--------------------------------------------------------------------------------
1 | ;(function ()
2 | {
3 | // CommonJS
4 | SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
5 |
6 | function Brush ()
7 | {
8 |
9 | var inits = 'class interface package macro enum typedef extends implements dynamic in for if while else do try switch case catch';
10 |
11 | var keywords = 'return break continue new throw cast using import function public private inline static untyped callback true false null Int Float String Void Std Bool Dynamic Array Vector';
12 |
13 | this.regexList = [
14 | { regex:SyntaxHighlighter.regexLib.singleLineCComments , css:'comments' },
15 | // one line comments
16 | { regex:SyntaxHighlighter.regexLib.multiLineCComments , css:'comments' },
17 | // multiline comments
18 | { regex:SyntaxHighlighter.regexLib.doubleQuotedString , css:'string' },
19 | // double quoted strings
20 | { regex:SyntaxHighlighter.regexLib.singleQuotedString , css:'string' },
21 | // single quoted strings
22 | { regex:/\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi , css:'value' },
23 | // numbers
24 | { regex:new RegExp ( this.getKeywords ( inits ) , 'gm' ) , css:'color3' },
25 | // initializations
26 | { regex:new RegExp ( this.getKeywords ( keywords ) , 'gm' ) , css:'keyword' },
27 | // keywords
28 | { regex:new RegExp ( 'var' , 'gm' ) , css:'variable' },
29 | // variable
30 | { regex:new RegExp ( 'trace' , 'gm' ) , css:'color1' },
31 | //compiler conditionals
32 | { regex:new RegExp ( '#if' , 'gm' ) , css:'comments' },
33 | { regex:new RegExp ( '#elseif' , 'gm' ) , css:'comments' },
34 | { regex:new RegExp ( '#end' , 'gm' ) , css:'comments' },
35 | { regex:new RegExp ( '#error' , 'gm' ) , css:'comments' }
36 | ];
37 |
38 | //standard compiler conditionals flags
39 | var flags = [
40 | "debug", "error", "cpp", "js", "neko", "php", "flash", "flash8", "flash9", "flash10", "flash10", "mobile", "desktop", "web", "ios", "android", "iphone"
41 | ];
42 |
43 | //append the flags to the array with a ! operator
44 | var i;
45 | var length = flags.length;
46 | for ( i = 0 ; i <= length - 1 ; i ++ )
47 | {
48 | this.regexList.push ( {regex:new RegExp ( flags[i] , 'gm' ) , css:'comments'} );
49 | this.regexList.push ( {regex:new RegExp ( '!' + flags[i] , 'gm' ) , css:'comments'} );
50 | }
51 |
52 | this.forHtmlScript ( SyntaxHighlighter.regexLib.scriptScriptTags );
53 | }
54 |
55 | ;
56 |
57 | Brush.prototype = new SyntaxHighlighter.Highlighter ();
58 | Brush.aliases = ['haxe', 'hx'];
59 |
60 | SyntaxHighlighter.brushes.Haxe = Brush;
61 |
62 | // CommonJS
63 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
64 | }) ();
65 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/js/shBrushJScript.js:
--------------------------------------------------------------------------------
1 | ;(function()
2 | {
3 | // CommonJS
4 | SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
5 |
6 | function Brush()
7 | {
8 | var keywords = 'break case catch class continue ' +
9 | 'default delete do else enum export extends false ' +
10 | 'for function if implements import in instanceof ' +
11 | 'interface let new null package private protected ' +
12 | 'static return super switch ' +
13 | 'this throw true try typeof var while with yield';
14 |
15 | var r = SyntaxHighlighter.regexLib;
16 |
17 | this.regexList = [
18 | { regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings
19 | { regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings
20 | { regex: r.singleLineCComments, css: 'comments' }, // one line comments
21 | { regex: r.multiLineCComments, css: 'comments' }, // multiline comments
22 | { regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
23 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords
24 | ];
25 |
26 | this.forHtmlScript(r.scriptScriptTags);
27 | };
28 |
29 | Brush.prototype = new SyntaxHighlighter.Highlighter();
30 | Brush.aliases = ['js', 'jscript', 'javascript'];
31 |
32 | SyntaxHighlighter.brushes.JScript = Brush;
33 |
34 | // CommonJS
35 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
36 | })();
37 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/js/shBrushJava.js:
--------------------------------------------------------------------------------
1 | ;(function()
2 | {
3 | // CommonJS
4 | SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
5 |
6 | function Brush()
7 | {
8 | var keywords = 'abstract assert boolean break byte case catch char class const ' +
9 | 'continue default do double else enum extends ' +
10 | 'false final finally float for goto if implements import ' +
11 | 'instanceof int interface long native new null ' +
12 | 'package private protected public return ' +
13 | 'short static strictfp super switch synchronized this throw throws true ' +
14 | 'transient try void volatile while';
15 |
16 | this.regexList = [
17 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
18 | { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments
19 | { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments
20 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
21 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
22 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers
23 | { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno
24 | { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword
25 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword
26 | ];
27 |
28 | this.forHtmlScript({
29 | left : /(<|<)%[@!=]?/g,
30 | right : /%(>|>)/g
31 | });
32 | };
33 |
34 | Brush.prototype = new SyntaxHighlighter.Highlighter();
35 | Brush.aliases = ['java'];
36 |
37 | SyntaxHighlighter.brushes.Java = Brush;
38 |
39 | // CommonJS
40 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
41 | })();
42 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/js/shBrushJavaFX.js:
--------------------------------------------------------------------------------
1 | ;(function()
2 | {
3 | // CommonJS
4 | SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
5 |
6 | function Brush()
7 | {
8 | // Contributed by Patrick Webster
9 | // http://patrickwebster.blogspot.com/2009/04/javafx-brush-for-syntaxhighlighter.html
10 | var datatypes = 'Boolean Byte Character Double Duration '
11 | + 'Float Integer Long Number Short String Void'
12 | ;
13 |
14 | var keywords = 'abstract after and as assert at before bind bound break catch class '
15 | + 'continue def delete else exclusive extends false finally first for from '
16 | + 'function if import in indexof init insert instanceof into inverse last '
17 | + 'lazy mixin mod nativearray new not null on or override package postinit '
18 | + 'protected public public-init public-read replace return reverse sizeof '
19 | + 'step super then this throw true try tween typeof var where while with '
20 | + 'attribute let private readonly static trigger'
21 | ;
22 |
23 | this.regexList = [
24 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' },
25 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' },
26 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' },
27 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' },
28 | { regex: /(-?\.?)(\b(\d*\.?\d+|\d+\.?\d*)(e[+-]?\d+)?|0x[a-f\d]+)\b\.?/gi, css: 'color2' }, // numbers
29 | { regex: new RegExp(this.getKeywords(datatypes), 'gm'), css: 'variable' }, // datatypes
30 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }
31 | ];
32 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
33 | };
34 |
35 | Brush.prototype = new SyntaxHighlighter.Highlighter();
36 | Brush.aliases = ['jfx', 'javafx'];
37 |
38 | SyntaxHighlighter.brushes.JavaFX = Brush;
39 |
40 | // CommonJS
41 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
42 | })();
43 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/js/shBrushPlain.js:
--------------------------------------------------------------------------------
1 | ;(function()
2 | {
3 | // CommonJS
4 | SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
5 |
6 | function Brush()
7 | {
8 | };
9 |
10 | Brush.prototype = new SyntaxHighlighter.Highlighter();
11 | Brush.aliases = ['text', 'plain'];
12 |
13 | SyntaxHighlighter.brushes.Plain = Brush;
14 |
15 | // CommonJS
16 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
17 | })();
18 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/js/shBrushPython.js:
--------------------------------------------------------------------------------
1 | ;(function()
2 | {
3 | // CommonJS
4 | SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
5 |
6 | function Brush()
7 | {
8 | // Contributed by Gheorghe Milas and Ahmad Sherif
9 |
10 | var keywords = 'and assert break class continue def del elif else ' +
11 | 'except exec finally for from global if import in is ' +
12 | 'lambda not or pass raise return try yield while';
13 |
14 | var funcs = '__import__ abs all any apply basestring bin bool buffer callable ' +
15 | 'chr classmethod cmp coerce compile complex delattr dict dir ' +
16 | 'divmod enumerate eval execfile file filter float format frozenset ' +
17 | 'getattr globals hasattr hash help hex id input int intern ' +
18 | 'isinstance issubclass iter len list locals long map max min next ' +
19 | 'object oct open ord pow print property range raw_input reduce ' +
20 | 'reload repr reversed round set setattr slice sorted staticmethod ' +
21 | 'str sum super tuple type type unichr unicode vars xrange zip';
22 |
23 | var special = 'None True False self cls class_';
24 |
25 | this.regexList = [
26 | { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' },
27 | { regex: /^\s*@\w+/gm, css: 'decorator' },
28 | { regex: /(['\"]{3})([^\1])*?\1/gm, css: 'comments' },
29 | { regex: /"(?!")(?:\.|\\\"|[^\""\n])*"/gm, css: 'string' },
30 | { regex: /'(?!')(?:\.|(\\\')|[^\''\n])*'/gm, css: 'string' },
31 | { regex: /\+|\-|\*|\/|\%|=|==/gm, css: 'keyword' },
32 | { regex: /\b\d+\.?\w*/g, css: 'value' },
33 | { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' },
34 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' },
35 | { regex: new RegExp(this.getKeywords(special), 'gm'), css: 'color1' }
36 | ];
37 |
38 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
39 | };
40 |
41 | Brush.prototype = new SyntaxHighlighter.Highlighter();
42 | Brush.aliases = ['py', 'python'];
43 |
44 | SyntaxHighlighter.brushes.Python = Brush;
45 |
46 | // CommonJS
47 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
48 | })();
49 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/js/shBrushRuby.js:
--------------------------------------------------------------------------------
1 | ;(function()
2 | {
3 | // CommonJS
4 | SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
5 |
6 | function Brush()
7 | {
8 | // Contributed by Erik Peterson.
9 |
10 | var keywords = 'alias and BEGIN begin break case class def define_method defined do each else elsif ' +
11 | 'END end ensure false for if in module new next nil not or raise redo rescue retry return ' +
12 | 'self super then throw true undef unless until when while yield';
13 |
14 | var builtins = 'Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload ' +
15 | 'Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol ' +
16 | 'ThreadGroup Thread Time TrueClass';
17 |
18 | this.regexList = [
19 | { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments
20 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
21 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
22 | { regex: /\b[A-Z0-9_]+\b/g, css: 'constants' }, // constants
23 | { regex: /:[a-z][A-Za-z0-9_]*/g, css: 'color2' }, // symbols
24 | { regex: /(\$|@@|@)\w+/g, css: 'variable bold' }, // $global, @instance, and @@class variables
25 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
26 | { regex: new RegExp(this.getKeywords(builtins), 'gm'), css: 'color1' } // builtins
27 | ];
28 |
29 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
30 | };
31 |
32 | Brush.prototype = new SyntaxHighlighter.Highlighter();
33 | Brush.aliases = ['ruby', 'rails', 'ror', 'rb'];
34 |
35 | SyntaxHighlighter.brushes.Ruby = Brush;
36 |
37 | // CommonJS
38 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
39 | })();
40 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/js/shBrushScala.js:
--------------------------------------------------------------------------------
1 | ;(function()
2 | {
3 | // CommonJS
4 | SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
5 |
6 | function Brush()
7 | {
8 | // Contributed by Yegor Jbanov and David Bernard.
9 |
10 | var keywords = 'val sealed case def true trait implicit forSome import match object null finally super ' +
11 | 'override try lazy for var catch throw type extends class while with new final yield abstract ' +
12 | 'else do if return protected private this package false';
13 |
14 | var keyops = '[_:=><%#@]+';
15 |
16 | this.regexList = [
17 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
18 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
19 | { regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // multi-line strings
20 | { regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double-quoted string
21 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
22 | { regex: /0x[a-f0-9]+|\d+(\.\d+)?/gi, css: 'value' }, // numbers
23 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
24 | { regex: new RegExp(keyops, 'gm'), css: 'keyword' } // scala keyword
25 | ];
26 | }
27 |
28 | Brush.prototype = new SyntaxHighlighter.Highlighter();
29 | Brush.aliases = ['scala'];
30 |
31 | SyntaxHighlighter.brushes.Scala = Brush;
32 |
33 | // CommonJS
34 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
35 | })();
36 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/js/shBrushVb.js:
--------------------------------------------------------------------------------
1 | ;(function()
2 | {
3 | // CommonJS
4 | SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
5 |
6 | function Brush()
7 | {
8 | var keywords = 'AddHandler AddressOf AndAlso Alias And Ansi As Assembly Auto ' +
9 | 'Boolean ByRef Byte ByVal Call Case Catch CBool CByte CChar CDate ' +
10 | 'CDec CDbl Char CInt Class CLng CObj Const CShort CSng CStr CType ' +
11 | 'Date Decimal Declare Default Delegate Dim DirectCast Do Double Each ' +
12 | 'Else ElseIf End Enum Erase Error Event Exit False Finally For Friend ' +
13 | 'Function Get GetType GoSub GoTo Handles If Implements Imports In ' +
14 | 'Inherits Integer Interface Is Let Lib Like Long Loop Me Mod Module ' +
15 | 'MustInherit MustOverride MyBase MyClass Namespace New Next Not Nothing ' +
16 | 'NotInheritable NotOverridable Object On Option Optional Or OrElse ' +
17 | 'Overloads Overridable Overrides ParamArray Preserve Private Property ' +
18 | 'Protected Public RaiseEvent ReadOnly ReDim REM RemoveHandler Resume ' +
19 | 'Return Select Set Shadows Shared Short Single Static Step Stop String ' +
20 | 'Structure Sub SyncLock Then Throw To True Try TypeOf Unicode Until ' +
21 | 'Variant When While With WithEvents WriteOnly Xor';
22 |
23 | this.regexList = [
24 | { regex: /'.*$/gm, css: 'comments' }, // one line comments
25 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
26 | { regex: /^\s*#.*$/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
27 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // vb keyword
28 | ];
29 |
30 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
31 | };
32 |
33 | Brush.prototype = new SyntaxHighlighter.Highlighter();
34 | Brush.aliases = ['vb', 'vbnet'];
35 |
36 | SyntaxHighlighter.brushes.Vb = Brush;
37 |
38 | // CommonJS
39 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
40 | })();
41 |
--------------------------------------------------------------------------------
/static/syntaxhighlighter/js/shBrushXml.js:
--------------------------------------------------------------------------------
1 | ;(function()
2 | {
3 | // CommonJS
4 | SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
5 |
6 | function Brush()
7 | {
8 | function process(match, regexInfo)
9 | {
10 | var constructor = SyntaxHighlighter.Match,
11 | code = match[0],
12 | tag = new XRegExp('(<|<)[\\s\\/\\?]*(?
45 |
46 |
47 |
13 |
14 |
21 |
22 |
29 |
30 |
33 |
34 |
41 |
42 |
45 |
46 |
51 |
52 |
57 |
15 |
16 |
29 |
17 |
24 |
25 |
26 |
27 |
28 | 标题
18 | 分类
19 | 标签
20 | 评论数
21 | 已删除
22 | 创建时间
23 |
34 | {% for blog in relates %}
35 |
38 |
6 |
8 |
17 |
24 |
27 |
35 |
38 |
45 |