├── .gitignore ├── README.md ├── documentation └── Models.vsdx ├── mstc_website ├── Publish.db ├── Publish │ ├── __init__.py │ ├── admin.py │ ├── models.py │ ├── static │ │ ├── css │ │ │ ├── iconFont.min.css │ │ │ ├── metro-bootstrap-responsive.css │ │ │ └── metro-bootstrap.css │ │ ├── fonts │ │ │ ├── iconFont.dev.svg │ │ │ ├── iconFont.eot │ │ │ ├── iconFont.json │ │ │ ├── iconFont.svg │ │ │ ├── iconFont.ttf │ │ │ ├── iconFont.woff │ │ │ ├── metroSysIcons.svg │ │ │ ├── metroSysIcons.ttf │ │ │ └── metroSysIcons.woff │ │ ├── img │ │ │ ├── 01.jpg │ │ │ ├── 02.jpg │ │ │ ├── 03.jpg │ │ │ ├── 04.jpg │ │ │ ├── favicon.ico │ │ │ ├── logo.png │ │ │ ├── logo_1.png │ │ │ ├── party_hat.png │ │ │ ├── pencil.png │ │ │ ├── renren.png │ │ │ ├── sina_weibo.png │ │ │ ├── tie.png │ │ │ ├── wechat.png │ │ │ └── wrench.png │ │ └── js │ │ │ ├── add.js │ │ │ ├── jquery.min.js │ │ │ ├── jquery.mousewheel.js │ │ │ ├── jquery.widget.min.js │ │ │ └── metro.min.js │ ├── templates │ │ ├── addDynamics.html │ │ ├── base.html │ │ ├── dyndetail.html │ │ ├── dynlist.html │ │ ├── eventdetail.html │ │ ├── eventlst.html │ │ ├── imglist.html │ │ ├── imgupload.html │ │ ├── index.html │ │ ├── join.html │ │ ├── login.html │ │ ├── panel.html │ │ └── reseult.html │ ├── tests.py │ └── views.py ├── config.yaml ├── index.wsgi ├── index.wsgic ├── manage.py ├── mstc_website │ ├── __init__.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py └── static │ ├── admin │ ├── css │ │ ├── base.css │ │ ├── changelists.css │ │ ├── dashboard.css │ │ ├── forms.css │ │ ├── ie.css │ │ ├── login.css │ │ ├── rtl.css │ │ └── widgets.css │ ├── img │ │ ├── changelist-bg.gif │ │ ├── changelist-bg_rtl.gif │ │ ├── chooser-bg.gif │ │ ├── chooser_stacked-bg.gif │ │ ├── default-bg-reverse.gif │ │ ├── default-bg.gif │ │ ├── deleted-overlay.gif │ │ ├── gis │ │ │ ├── move_vertex_off.png │ │ │ └── move_vertex_on.png │ │ ├── icon-no.gif │ │ ├── icon-unknown.gif │ │ ├── icon-yes.gif │ │ ├── icon_addlink.gif │ │ ├── icon_alert.gif │ │ ├── icon_calendar.gif │ │ ├── icon_changelink.gif │ │ ├── icon_clock.gif │ │ ├── icon_deletelink.gif │ │ ├── icon_error.gif │ │ ├── icon_searchbox.png │ │ ├── icon_success.gif │ │ ├── inline-delete-8bit.png │ │ ├── inline-delete.png │ │ ├── inline-restore-8bit.png │ │ ├── inline-restore.png │ │ ├── inline-splitter-bg.gif │ │ ├── nav-bg-grabber.gif │ │ ├── nav-bg-reverse.gif │ │ ├── nav-bg-selected.gif │ │ ├── nav-bg.gif │ │ ├── selector-icons.gif │ │ ├── selector-search.gif │ │ ├── sorting-icons.gif │ │ ├── tool-left.gif │ │ ├── tool-left_over.gif │ │ ├── tool-right.gif │ │ ├── tool-right_over.gif │ │ ├── tooltag-add.gif │ │ ├── tooltag-add_over.gif │ │ ├── tooltag-arrowright.gif │ │ └── tooltag-arrowright_over.gif │ └── js │ │ ├── LICENSE-JQUERY.txt │ │ ├── SelectBox.js │ │ ├── SelectFilter2.js │ │ ├── actions.js │ │ ├── actions.min.js │ │ ├── admin │ │ ├── DateTimeShortcuts.js │ │ └── RelatedObjectLookups.js │ │ ├── calendar.js │ │ ├── collapse.js │ │ ├── collapse.min.js │ │ ├── core.js │ │ ├── inlines.js │ │ ├── inlines.min.js │ │ ├── jquery.init.js │ │ ├── jquery.js │ │ ├── jquery.min.js │ │ ├── prepopulate.js │ │ ├── prepopulate.min.js │ │ ├── timeparse.js │ │ └── urlify.js │ ├── css │ ├── iconFont.min.css │ ├── metro-bootstrap-responsive.css │ └── metro-bootstrap.css │ ├── fonts │ ├── iconFont.dev.svg │ ├── iconFont.eot │ ├── iconFont.json │ ├── iconFont.svg │ ├── iconFont.ttf │ ├── iconFont.woff │ ├── metroSysIcons.svg │ ├── metroSysIcons.ttf │ └── metroSysIcons.woff │ ├── img │ ├── 01.jpg │ ├── 02.jpg │ ├── 03.jpg │ ├── 04.jpg │ ├── favicon.ico │ ├── logo.png │ ├── logo_1.png │ ├── party_hat.png │ ├── pencil.png │ ├── renren.png │ ├── sina_weibo.png │ ├── tie.png │ ├── wechat.png │ └── wrench.png │ └── js │ ├── add.js │ ├── jquery.min.js │ ├── jquery.mousewheel.js │ ├── jquery.widget.min.js │ └── metro.min.js ├── resource ├── logo_1.png ├── logo_b.png └── logo_head.png └── site-packages ├── Markdown-2.5.egg-info ├── PKG-INFO ├── SOURCES.txt ├── dependency_links.txt ├── installed-files.txt └── top_level.txt └── markdown ├── __init__.py ├── __main__.py ├── __version__.py ├── blockparser.py ├── blockprocessors.py ├── extensions ├── __init__.py ├── abbr.py ├── admonition.py ├── attr_list.py ├── codehilite.py ├── def_list.py ├── extra.py ├── fenced_code.py ├── footnotes.py ├── headerid.py ├── meta.py ├── nl2br.py ├── sane_lists.py ├── smart_strong.py ├── smarty.py ├── tables.py ├── toc.py └── wikilinks.py ├── inlinepatterns.py ├── odict.py ├── postprocessors.py ├── preprocessors.py ├── serializers.py ├── treeprocessors.py └── util.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | Thumbs.db -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | mstc-website 2 | ============ 3 | -------------------------------------------------------------------------------- /documentation/Models.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/documentation/Models.vsdx -------------------------------------------------------------------------------- /mstc_website/Publish.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/Publish.db -------------------------------------------------------------------------------- /mstc_website/Publish/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/Publish/__init__.py -------------------------------------------------------------------------------- /mstc_website/Publish/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from Publish.models import * 3 | 4 | class DynamicsAdmin(admin.ModelAdmin): 5 | list_display = ('title', 'author', 'publish_time') 6 | 7 | class PartakeAdmin(admin.ModelAdmin): 8 | list_display = ('name', 'phone', 'event') 9 | 10 | class ImgAdmin(admin.ModelAdmin): 11 | list_display = ('name', 'author', 'uptime') 12 | # Register your models here. 13 | admin.site.register(Dynamics, DynamicsAdmin) 14 | admin.site.register(Event) 15 | admin.site.register(Tag) 16 | admin.site.register(Partake, PartakeAdmin) 17 | admin.site.register(Img, ImgAdmin) -------------------------------------------------------------------------------- /mstc_website/Publish/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.contrib.auth.models import User 3 | 4 | # Create your models here. 5 | 6 | class Dynamics(models.Model): 7 | title = models.CharField(max_length = 128) 8 | author = models.ForeignKey(User) 9 | publish_time = models.DateTimeField(auto_now = True) 10 | content = models.TextField(max_length = 5000) 11 | 12 | hasform = models.BooleanField(default = False) 13 | model = models.IntegerField(default = 1) 14 | 15 | def __unicode__(self): 16 | return self.title 17 | 18 | class Event(models.Model): 19 | name = models.CharField(max_length = 128) 20 | event_time = models.DateTimeField() 21 | number = models.IntegerField() 22 | now_num = models.IntegerField(default = 0) 23 | start_time = models.DateTimeField() 24 | end_time = models.DateTimeField() 25 | dynamics = models.OneToOneField(Dynamics) 26 | 27 | needname = models.BooleanField(default = False) 28 | needcollege = models.BooleanField(default = False) 29 | needgrade = models.BooleanField(default = False) 30 | needphone = models.BooleanField(default = False) 31 | needemail = models.BooleanField(default = False) 32 | needqq = models.BooleanField(default = False) 33 | needothername = models.BooleanField(default = False) 34 | othername = models.CharField(max_length = 128, default = 'Remark') 35 | 36 | def __unicode__(self): 37 | return self.name 38 | 39 | class Tag(models.Model): 40 | title = models.CharField(max_length = 128) 41 | event = models.ForeignKey(Dynamics) 42 | 43 | def __unicode__(self): 44 | return self.title 45 | 46 | class Partake(models.Model): 47 | name = models.CharField(max_length = 16) 48 | college = models.CharField(max_length = 32) 49 | grade = models.CharField(max_length = 4) 50 | phone = models.CharField(max_length = 11) 51 | email = models.EmailField(max_length = 75) 52 | qq = models.CharField(max_length = 12) 53 | other = models.CharField(max_length = 2048) 54 | event = models.ForeignKey(Event) 55 | 56 | def __unicode__(self): 57 | return self.name 58 | 59 | class Img(models.Model): 60 | name = models.CharField(max_length = 128, null = True) 61 | descripe = models.TextField(max_length = 512, null = True) 62 | uptime = models.DateTimeField(auto_now = True) 63 | author = models.ForeignKey(User) 64 | img = models.URLField() -------------------------------------------------------------------------------- /mstc_website/Publish/static/fonts/iconFont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/Publish/static/fonts/iconFont.eot -------------------------------------------------------------------------------- /mstc_website/Publish/static/fonts/iconFont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/Publish/static/fonts/iconFont.ttf -------------------------------------------------------------------------------- /mstc_website/Publish/static/fonts/iconFont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/Publish/static/fonts/iconFont.woff -------------------------------------------------------------------------------- /mstc_website/Publish/static/fonts/metroSysIcons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/Publish/static/fonts/metroSysIcons.ttf -------------------------------------------------------------------------------- /mstc_website/Publish/static/fonts/metroSysIcons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/Publish/static/fonts/metroSysIcons.woff -------------------------------------------------------------------------------- /mstc_website/Publish/static/img/01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/Publish/static/img/01.jpg -------------------------------------------------------------------------------- /mstc_website/Publish/static/img/02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/Publish/static/img/02.jpg -------------------------------------------------------------------------------- /mstc_website/Publish/static/img/03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/Publish/static/img/03.jpg -------------------------------------------------------------------------------- /mstc_website/Publish/static/img/04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/Publish/static/img/04.jpg -------------------------------------------------------------------------------- /mstc_website/Publish/static/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/Publish/static/img/favicon.ico -------------------------------------------------------------------------------- /mstc_website/Publish/static/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/Publish/static/img/logo.png -------------------------------------------------------------------------------- /mstc_website/Publish/static/img/logo_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/Publish/static/img/logo_1.png -------------------------------------------------------------------------------- /mstc_website/Publish/static/img/party_hat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/Publish/static/img/party_hat.png -------------------------------------------------------------------------------- /mstc_website/Publish/static/img/pencil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/Publish/static/img/pencil.png -------------------------------------------------------------------------------- /mstc_website/Publish/static/img/renren.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/Publish/static/img/renren.png -------------------------------------------------------------------------------- /mstc_website/Publish/static/img/sina_weibo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/Publish/static/img/sina_weibo.png -------------------------------------------------------------------------------- /mstc_website/Publish/static/img/tie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/Publish/static/img/tie.png -------------------------------------------------------------------------------- /mstc_website/Publish/static/img/wechat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/Publish/static/img/wechat.png -------------------------------------------------------------------------------- /mstc_website/Publish/static/img/wrench.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/Publish/static/img/wrench.png -------------------------------------------------------------------------------- /mstc_website/Publish/static/js/add.js: -------------------------------------------------------------------------------- 1 | function showform () { 2 | var a = document.getElementById('Switch'); 3 | var b = document.getElementById('infoform'); 4 | var c = document.getElementById('hasform'); 5 | if (a.getAttribute("data-s") == "off") { 6 | a.innerHTML="关闭报名"; 7 | a.setAttribute("data-s","on"); 8 | b.hidden = !b.hidden; 9 | c.setAttribute("value","True"); 10 | }else{ 11 | a.setAttribute("data-s","off"); 12 | a.innerHTML="开启报名"; 13 | b.hidden = !b.hidden; 14 | c.setAttribute("value","False"); 15 | }; 16 | } 17 | 18 | function showname () { 19 | var c = document.getElementById('needother'); 20 | var d = document.getElementById('showother'); 21 | if (c.checked) 22 | { 23 | d.hidden = !d.hidden; 24 | } 25 | else 26 | { 27 | d.hidden = true; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /mstc_website/Publish/static/js/jquery.mousewheel.js: -------------------------------------------------------------------------------- 1 | /*! Copyright (c) 2013 Brandon Aaron (http://brandonaaron.net) 2 | * Licensed under the MIT License (LICENSE.txt). 3 | * 4 | * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. 5 | * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. 6 | * Thanks to: Seamus Leahy for adding deltaX and deltaY 7 | * 8 | * Version: 3.1.3 9 | * 10 | * Requires: 1.2.2+ 11 | */ 12 | 13 | (function (factory) { 14 | if ( typeof define === 'function' && define.amd ) { 15 | // AMD. Register as an anonymous module. 16 | define(['jquery'], factory); 17 | } else if (typeof exports === 'object') { 18 | // Node/CommonJS style for Browserify 19 | module.exports = factory; 20 | } else { 21 | // Browser globals 22 | factory(jQuery); 23 | } 24 | }(function ($) { 25 | 26 | var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll']; 27 | var toBind = 'onwheel' in document || document.documentMode >= 9 ? ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll']; 28 | var lowestDelta, lowestDeltaXY; 29 | 30 | if ( $.event.fixHooks ) { 31 | for ( var i = toFix.length; i; ) { 32 | $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks; 33 | } 34 | } 35 | 36 | $.event.special.mousewheel = { 37 | setup: function() { 38 | if ( this.addEventListener ) { 39 | for ( var i = toBind.length; i; ) { 40 | this.addEventListener( toBind[--i], handler, false ); 41 | } 42 | } else { 43 | this.onmousewheel = handler; 44 | } 45 | }, 46 | 47 | teardown: function() { 48 | if ( this.removeEventListener ) { 49 | for ( var i = toBind.length; i; ) { 50 | this.removeEventListener( toBind[--i], handler, false ); 51 | } 52 | } else { 53 | this.onmousewheel = null; 54 | } 55 | } 56 | }; 57 | 58 | $.fn.extend({ 59 | mousewheel: function(fn) { 60 | return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); 61 | }, 62 | 63 | unmousewheel: function(fn) { 64 | return this.unbind("mousewheel", fn); 65 | } 66 | }); 67 | 68 | 69 | function handler(event) { 70 | var orgEvent = event || window.event, 71 | args = [].slice.call(arguments, 1), 72 | delta = 0, 73 | deltaX = 0, 74 | deltaY = 0, 75 | absDelta = 0, 76 | absDeltaXY = 0, 77 | fn; 78 | event = $.event.fix(orgEvent); 79 | event.type = "mousewheel"; 80 | 81 | // Old school scrollwheel delta 82 | if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta; } 83 | if ( orgEvent.detail ) { delta = orgEvent.detail * -1; } 84 | 85 | // New school wheel delta (wheel event) 86 | if ( orgEvent.deltaY ) { 87 | deltaY = orgEvent.deltaY * -1; 88 | delta = deltaY; 89 | } 90 | if ( orgEvent.deltaX ) { 91 | deltaX = orgEvent.deltaX; 92 | delta = deltaX * -1; 93 | } 94 | 95 | // Webkit 96 | if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY; } 97 | if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = orgEvent.wheelDeltaX * -1; } 98 | 99 | // Look for lowest delta to normalize the delta values 100 | absDelta = Math.abs(delta); 101 | if ( !lowestDelta || absDelta < lowestDelta ) { lowestDelta = absDelta; } 102 | absDeltaXY = Math.max(Math.abs(deltaY), Math.abs(deltaX)); 103 | if ( !lowestDeltaXY || absDeltaXY < lowestDeltaXY ) { lowestDeltaXY = absDeltaXY; } 104 | 105 | // Get a whole value for the deltas 106 | fn = delta > 0 ? 'floor' : 'ceil'; 107 | delta = Math[fn](delta / lowestDelta); 108 | deltaX = Math[fn](deltaX / lowestDeltaXY); 109 | deltaY = Math[fn](deltaY / lowestDeltaXY); 110 | 111 | // Add event and delta to the front of the arguments 112 | args.unshift(event, delta, deltaX, deltaY); 113 | 114 | return ($.event.dispatch || $.event.handle).apply(this, args); 115 | } 116 | 117 | })); 118 | -------------------------------------------------------------------------------- /mstc_website/Publish/static/js/jquery.widget.min.js: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.10.3 - 2013-05-28 2 | * http://jqueryui.com 3 | * Includes: jquery.ui.widget.js 4 | * Copyright 2013 jQuery Foundation and other contributors Licensed MIT */ 5 | 6 | (function(e,t){var i=0,s=Array.prototype.slice,n=e.cleanData;e.cleanData=function(t){for(var i,s=0;null!=(i=t[s]);s++)try{e(i).triggerHandler("remove")}catch(a){}n(t)},e.widget=function(i,s,n){var a,r,o,h,l={},u=i.split(".")[0];i=i.split(".")[1],a=u+"-"+i,n||(n=s,s=e.Widget),e.expr[":"][a.toLowerCase()]=function(t){return!!e.data(t,a)},e[u]=e[u]||{},r=e[u][i],o=e[u][i]=function(e,i){return this._createWidget?(arguments.length&&this._createWidget(e,i),t):new o(e,i)},e.extend(o,r,{version:n.version,_proto:e.extend({},n),_childConstructors:[]}),h=new s,h.options=e.widget.extend({},h.options),e.each(n,function(i,n){return e.isFunction(n)?(l[i]=function(){var e=function(){return s.prototype[i].apply(this,arguments)},t=function(e){return s.prototype[i].apply(this,e)};return function(){var i,s=this._super,a=this._superApply;return this._super=e,this._superApply=t,i=n.apply(this,arguments),this._super=s,this._superApply=a,i}}(),t):(l[i]=n,t)}),o.prototype=e.widget.extend(h,{widgetEventPrefix:r?h.widgetEventPrefix:i},l,{constructor:o,namespace:u,widgetName:i,widgetFullName:a}),r?(e.each(r._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete r._childConstructors):s._childConstructors.push(o),e.widget.bridge(i,o)},e.widget.extend=function(i){for(var n,a,r=s.call(arguments,1),o=0,h=r.length;h>o;o++)for(n in r[o])a=r[o][n],r[o].hasOwnProperty(n)&&a!==t&&(i[n]=e.isPlainObject(a)?e.isPlainObject(i[n])?e.widget.extend({},i[n],a):e.widget.extend({},a):a);return i},e.widget.bridge=function(i,n){var a=n.prototype.widgetFullName||i;e.fn[i]=function(r){var o="string"==typeof r,h=s.call(arguments,1),l=this;return r=!o&&h.length?e.widget.extend.apply(null,[r].concat(h)):r,o?this.each(function(){var s,n=e.data(this,a);return n?e.isFunction(n[r])&&"_"!==r.charAt(0)?(s=n[r].apply(n,h),s!==n&&s!==t?(l=s&&s.jquery?l.pushStack(s.get()):s,!1):t):e.error("no such method '"+r+"' for "+i+" widget instance"):e.error("cannot call methods on "+i+" prior to initialization; "+"attempted to call method '"+r+"'")}):this.each(function(){var t=e.data(this,a);t?t.option(r||{})._init():e.data(this,a,new n(r,this))}),l}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
",options:{disabled:!1,create:null},_createWidget:function(t,s){s=e(s||this.defaultElement||this)[0],this.element=e(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),s!==this&&(e.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===s&&this.destroy()}}),this.document=e(s.style?s.ownerDocument:s.document||s),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(i,s){var n,a,r,o=i;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof i)if(o={},n=i.split("."),i=n.shift(),n.length){for(a=o[i]=e.widget.extend({},this.options[i]),r=0;n.length-1>r;r++)a[n[r]]=a[n[r]]||{},a=a[n[r]];if(i=n.pop(),s===t)return a[i]===t?null:a[i];a[i]=s}else{if(s===t)return this.options[i]===t?null:this.options[i];o[i]=s}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(i,s,n){var a,r=this;"boolean"!=typeof i&&(n=s,s=i,i=!1),n?(s=a=e(s),this.bindings=this.bindings.add(s)):(n=s,s=this.element,a=this.widget()),e.each(n,function(n,o){function h(){return i||r.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?r[o]:o).apply(r,arguments):t}"string"!=typeof o&&(h.guid=o.guid=o.guid||h.guid||e.guid++);var l=n.match(/^(\w+)\s*(.*)$/),u=l[1]+r.eventNamespace,c=l[2];c?a.delegate(c,u,h):s.bind(u,h)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,r=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(r)&&r.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var r,o=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),r=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),r&&e.effects&&e.effects.effect[o]?s[t](n):o!==t&&s[o]?s[o](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i()})}})})(jQuery); -------------------------------------------------------------------------------- /mstc_website/Publish/templates/addDynamics.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load staticfiles %} 3 | 4 | {% block title %}添加动态{% endblock %} 5 | 6 | {% block content %} 7 | 8 | 9 |
10 |
11 |

添加动态

12 |
13 | 14 | 15 | 16 |
17 |
18 | {% csrf_token %} 19 | 20 |
21 | 22 | 23 |
24 | 25 | 26 |
27 | 28 |
29 | 30 |
31 | 36 |
37 | 38 | 114 | 115 |
116 | 117 |
118 | 119 |
120 | 121 |
122 |
123 | 124 | 125 | {% endblock %} -------------------------------------------------------------------------------- /mstc_website/Publish/templates/base.html: -------------------------------------------------------------------------------- 1 | {% load staticfiles %} 2 | 3 | 4 | 5 | 6 | {% block title %}{% endblock %} 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 33 | 34 | 35 | {% block content %} 36 | {% endblock %} 37 | 38 | 39 |
40 |
41 |
42 |
43 |

关注我们:   

44 |
45 |
46 |
Powered by Duan Yi
47 |
48 |
49 |
HIT  MSTC
©All rights reserved
50 |
51 |
52 |
53 |
54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /mstc_website/Publish/templates/dyndetail.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load staticfiles %} 3 | 4 | {% block title %}动态详情{% endblock %} 5 | 6 | {% block content %} 7 | 8 |
9 |

{{ dyn.title }}

10 |
{{dyn.author}}  {{ dyn.publish_time|date:"Y-m-d H:i:s" }}
11 | {% if dyn.model == 1 %} 12 |
{{ dyn.content }}
13 | {% else %} 14 |
15 | {{ dyn.content|safe }} 16 |
17 | {% endif %} 18 | {% if dyn.hasform %} 19 | 20 |
21 | 参加活动 22 | {% endif %} 23 |
24 | 25 | {% endblock %} -------------------------------------------------------------------------------- /mstc_website/Publish/templates/dynlist.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load staticfiles %} 3 | 4 | {% block title %}全部动态{% endblock %} 5 | 6 | {% block content %} 7 | 8 |
9 |

全部动态

10 | 27 |
28 | 29 | {% endblock %} -------------------------------------------------------------------------------- /mstc_website/Publish/templates/eventdetail.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load staticfiles %} 3 | 4 | {% block title %}活动详情{% endblock %} 5 | 6 | {% block content %} 7 | 8 |
9 |

{{ event.name }}

10 |

活动时间:{{ event.event_time|date:"Y-m-d H:i:s" }}

11 |

报名人数:{{ event.now_num }}

12 |
13 | {% if partakelst|length > 0 %} 14 | 15 | 16 | 17 | {% if event.needname %} 18 | 19 | {% endif %} 20 | {% if event.needcollege %} 21 | 22 | {% endif %} 23 | {% if event.needgrade %} 24 | 25 | {% endif %} 26 | {% if event.needphone %} 27 | 28 | {% endif %} 29 | {% if event.needemail %} 30 | 31 | {% endif %} 32 | {% if event.needqq %} 33 | 34 | {% endif %} 35 | {% if event.needothername %} 36 | 37 | {% endif %} 38 | 39 | 40 | 41 | {% for item in partakelst %} 42 | 43 | {% if event.needname %} 44 | 45 | {% endif %} 46 | {% if event.needcollege %} 47 | 48 | {% endif %} 49 | {% if event.needgrade %} 50 | 51 | {% endif %} 52 | {% if event.needphone %} 53 | 54 | {% endif %} 55 | {% if event.needemail %} 56 | 57 | {% endif %} 58 | {% if event.needqq %} 59 | 60 | {% endif %} 61 | {% if event.needothername %} 62 | 63 | {% endif %} 64 | 65 | {% endfor %} 66 | 67 |
姓名专业年级电话邮箱QQ{{ event.othername }}
{{ item.name }}{{ item.college }}{{ item.grade }}{{ item.phone }}{{ item.email }}{{ item.qq }}{{ item.other }}
68 | {% else %} 69 |

暂无人报名

70 | {% endif %} 71 |
72 |
73 | 74 | {% endblock %} -------------------------------------------------------------------------------- /mstc_website/Publish/templates/eventlst.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load staticfiles %} 3 | 4 | {% block title %}全部活动{% endblock %} 5 | 6 | {% block content %} 7 | 8 |
9 |

全部活动

10 | 27 |
28 | 29 | {% endblock %} -------------------------------------------------------------------------------- /mstc_website/Publish/templates/imglist.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load staticfiles %} 3 | 4 | {% block title %}全部图片{% endblock %} 5 | 6 | {% block content %} 7 | 8 |
9 |

全部图片

10 |
11 | {% for item in imglst %} 12 |
13 |
14 | {{ item.name }} 15 | {{ item.descripe }} 16 | {{ item.img }} 17 | {{ item.author }} 18 | {{ item.uptime|date:"Y-m-d H:i:s" }} 19 | 20 |
21 |
22 | {% empty %} 23 | 24 |
25 | 暂无图片 26 |
27 |
28 | {% endfor %} 29 |
30 |
31 | 32 | {% endblock %} -------------------------------------------------------------------------------- /mstc_website/Publish/templates/imgupload.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load staticfiles %} 3 | 4 | {% block title %}图片上传{% endblock %} 5 | 6 | {% block content %} 7 | 8 |
9 |
10 |
11 | {% csrf_token %} 12 | 13 |
14 | 15 | 16 |
17 | 18 |
19 | 20 |
21 | 22 |
23 | 24 | 25 |
26 |
27 | 28 |
29 |
30 |
31 |
32 | 33 | 34 | {% endblock %} -------------------------------------------------------------------------------- /mstc_website/Publish/templates/index.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load staticfiles %} 3 | 4 | {% block title %}哈工大微软技术俱乐部{% endblock %} 5 | 6 | {% block content %} 7 | 8 | 9 |
10 |
11 |

哈工大微软技术俱乐部

12 |

13 | 欢迎加入微软大家庭。 14 |

15 | 16 |

加入我们 

17 |
18 |
19 |
20 |
21 |
22 |

更多活动

23 |
24 |
25 |
26 |
27 |
28 |
29 |

Who we are

30 |

我们是哈工大首批成立的技术俱乐部,受到微软亚洲研究院的重点培养和鼎力支持。

31 |
32 |
33 | 34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |

技术部

45 | 46 |

德技双馨,功夫到家

47 |
48 |
49 |
50 |
51 |
52 |
53 |

活动部

54 | 55 |

我们都是大玩家

56 |
57 |
58 |
59 |
60 |
61 |
62 |

宣传部

63 | 64 |

关注美,更关注设计

65 |
66 |
67 |
68 |
69 |
70 |
71 |

公关部

72 | 73 |

为自己带盐

74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 | 82 |
83 |
84 |
85 |
86 |
87 | 91 | 92 |
93 |
94 |
95 |
96 | 97 |
98 |
99 |
100 |
101 | 102 |
103 |
104 |

What you will get

105 |

学习最新的技术和文化
找到志同道合的朋友
收获你的大学

106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |

微  俱  有  你  ,  由  微  至  巨

115 |
116 |
117 |
118 |
119 | 120 | {% endblock %} -------------------------------------------------------------------------------- /mstc_website/Publish/templates/join.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load staticfiles %} 3 | 4 | {% block title %}活动报名{% endblock %} 5 | 6 | {% block content %} 7 | 8 |
9 |
10 |

{{ event.name }}

11 |

截止时间: {{ event.end_time|date:"Y-m-d H:i:s" }}

12 |
13 | {% csrf_token %} 14 | {% if event.needname %} 15 | 16 |
17 | 18 | 19 |
20 | {% endif %} 21 | {% if event.needcollege %} 22 | 23 |
24 | 25 | 26 |
27 | {% endif %} 28 | {% if event.needgrade %} 29 | 30 |
31 | 36 |
37 | {% endif %} 38 | {% if event.needphone %} 39 | 40 |
41 | 42 | 43 |
44 | {% endif %} 45 | {% if event.needemail %} 46 | 47 |
48 | 49 | 50 |
51 | {% endif %} 52 | {% if event.needqq %} 53 | 54 |
55 | 56 | 57 |
58 | {% endif %} 59 | {% if event.needothername %} 60 | 61 |
62 | 63 |
64 | {% endif %} 65 |
66 | 67 |
68 |
69 | 70 |
71 |
72 | 73 | 74 | 75 | {% endblock %} -------------------------------------------------------------------------------- /mstc_website/Publish/templates/login.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load staticfiles %} 3 | 4 | {% block title %}后台登陆{% endblock %} 5 | 6 | {% block content %} 7 | 8 |
9 | 10 |
11 |
12 | {% csrf_token %} 13 | 14 |
15 | 16 | 17 |
18 | 19 |
20 | 21 | 22 |
23 |
24 | 25 |
26 |
27 |
28 |
29 | 30 | 31 | {% endblock %} -------------------------------------------------------------------------------- /mstc_website/Publish/templates/panel.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load staticfiles %} 3 | 4 | {% block title %}仪表盘{% endblock %} 5 | 6 | {% block content %} 7 | 8 |
9 | 16 | 23 | 30 |
31 | 32 | {% endblock %} -------------------------------------------------------------------------------- /mstc_website/Publish/templates/reseult.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load staticfiles %} 3 | 4 | {% block title %}活动报名{% endblock %} 5 | 6 | {% block content %} 7 | 8 |
9 |
10 |
11 |
12 | 报名状态 13 |
14 |
15 | {% if state == "time_out" %} 16 |

已经超过报名时间。

17 | {% endif %} 18 | {% if state == "over_number" %} 19 |

已经达到人数限制。

20 | {% endif %} 21 | {% if state == "success" %} 22 |

报名成功。

23 | {% endif %} 24 |
25 |
26 | 27 |
28 |
29 | 30 | 31 | 32 | {% endblock %} -------------------------------------------------------------------------------- /mstc_website/Publish/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /mstc_website/config.yaml: -------------------------------------------------------------------------------- 1 | name: hitmstc 2 | version: 1 3 | 4 | libraries: 5 | - name: "django" 6 | version: "1.5" 7 | handlers: 8 | - url: /static 9 | static_dir: static -------------------------------------------------------------------------------- /mstc_website/index.wsgi: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import sae 4 | 5 | root = os.path.dirname(__file__) 6 | 7 | sys.path.insert(0, os.path.join(root,'site-packages')) 8 | 9 | from mstc_website import wsgi 10 | 11 | application = sae.create_wsgi_app(wsgi.application) -------------------------------------------------------------------------------- /mstc_website/index.wsgic: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/index.wsgic -------------------------------------------------------------------------------- /mstc_website/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mstc_website.settings") 7 | 8 | from django.core.management import execute_from_command_line 9 | 10 | execute_from_command_line(sys.argv) 11 | -------------------------------------------------------------------------------- /mstc_website/mstc_website/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/mstc_website/__init__.py -------------------------------------------------------------------------------- /mstc_website/mstc_website/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for mstc_website project. 3 | 4 | For more information on this file, see 5 | https://docs.djangoproject.com/en/1.6/topics/settings/ 6 | 7 | For the full list of settings and their values, see 8 | https://docs.djangoproject.com/en/1.6/ref/settings/ 9 | """ 10 | 11 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 12 | import os 13 | BASE_DIR = os.path.dirname(os.path.dirname(__file__)) 14 | 15 | 16 | # Quick-start development settings - unsuitable for production 17 | # See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ 18 | 19 | # SECURITY WARNING: keep the secret key used in production secret! 20 | SECRET_KEY = 'duu_zs58@azl)^d^hn5at0qnq13@z!x#n1bd$fyqcy265+-p#r' 21 | 22 | # SECURITY WARNING: don't run with debug turned on in production! 23 | DEBUG = True 24 | 25 | TEMPLATE_DEBUG = True 26 | 27 | ALLOWED_HOSTS = [] 28 | 29 | 30 | # Application definition 31 | 32 | INSTALLED_APPS = ( 33 | 'django.contrib.admin', 34 | 'django.contrib.auth', 35 | 'django.contrib.contenttypes', 36 | 'django.contrib.sessions', 37 | 'django.contrib.messages', 38 | 'django.contrib.staticfiles', 39 | 'Publish', 40 | ) 41 | 42 | MIDDLEWARE_CLASSES = ( 43 | 'django.contrib.sessions.middleware.SessionMiddleware', 44 | 'django.middleware.common.CommonMiddleware', 45 | 'django.middleware.csrf.CsrfViewMiddleware', 46 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 47 | 'django.contrib.messages.middleware.MessageMiddleware', 48 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 49 | ) 50 | 51 | ROOT_URLCONF = 'mstc_website.urls' 52 | 53 | WSGI_APPLICATION = 'mstc_website.wsgi.application' 54 | 55 | 56 | # Database 57 | # https://docs.djangoproject.com/en/1.6/ref/settings/#databases 58 | 59 | DATABASES = { 60 | 'default': { 61 | 'ENGINE': 'django.db.backends.mysql', 62 | 'NAME': 'mstcweb', 63 | 'USER': 'mstcweb', 64 | 'PASSWORD': 'mstcweb', 65 | 'HOST': '127.0.0.1', 66 | 'PORT': '3306' , 67 | } 68 | } 69 | 70 | # Internationalization 71 | # https://docs.djangoproject.com/en/1.6/topics/i18n/ 72 | 73 | LANGUAGE_CODE = 'zh-cn' 74 | 75 | TIME_ZONE = 'UTC' 76 | 77 | USE_I18N = True 78 | 79 | USE_L10N = True 80 | 81 | USE_TZ = True 82 | 83 | 84 | # Static files (CSS, JavaScript, Images) 85 | # https://docs.djangoproject.com/en/1.6/howto/static-files/ 86 | 87 | STATIC_URL = '/static/' 88 | STATIC_ROOT = './static/' 89 | MEDIA_ROOT = './Publish/media/' 90 | MEDIA_URL = '/media/' -------------------------------------------------------------------------------- /mstc_website/mstc_website/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import patterns, include, url 2 | from django.conf.urls.static import static 3 | from django.conf import settings 4 | from Publish import views 5 | from django.contrib import admin 6 | admin.autodiscover() 7 | 8 | urlpatterns = patterns('', 9 | # Examples: 10 | # url(r'^$', 'mstc_website.views.home', name='home'), 11 | # url(r'^blog/', include('blog.urls')), 12 | 13 | url(r'^djangoadmin/', include(admin.site.urls)), 14 | url(r'^admin$',views.admin), 15 | url(r'^logout/$',views.logout), 16 | url(r'^$',views.home), 17 | url(r'^addDynamics/$',views.addDynamics), 18 | url(r'^dynlist$',views.dynlist), 19 | url(r'^dynlist/detail/$',views.dyndetail), 20 | url(r'^join/$',views.join), 21 | url(r'^eventlst$',views.eventlst), 22 | url(r'^eventlst/detail/$',views.eventdetail), 23 | url(r'^imgupload/$',views.imgupload), 24 | url(r'^imglist/$',views.imglist), 25 | ) 26 | -------------------------------------------------------------------------------- /mstc_website/mstc_website/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for mstc_website 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.6/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mstc_website.settings") 12 | 13 | from django.core.wsgi import get_wsgi_application 14 | application = get_wsgi_application() 15 | -------------------------------------------------------------------------------- /mstc_website/static/admin/css/changelists.css: -------------------------------------------------------------------------------- 1 | /* CHANGELISTS */ 2 | 3 | #changelist { 4 | position: relative; 5 | width: 100%; 6 | } 7 | 8 | #changelist table { 9 | width: 100%; 10 | } 11 | 12 | .change-list .hiddenfields { display:none; } 13 | 14 | .change-list .filtered table { 15 | border-right: 1px solid #ddd; 16 | } 17 | 18 | .change-list .filtered { 19 | min-height: 400px; 20 | } 21 | 22 | .change-list .filtered { 23 | background: white url(../img/changelist-bg.gif) top right repeat-y !important; 24 | } 25 | 26 | .change-list .filtered .results, .change-list .filtered .paginator, .filtered #toolbar, .filtered div.xfull { 27 | margin-right: 160px !important; 28 | width: auto !important; 29 | } 30 | 31 | .change-list .filtered table tbody th { 32 | padding-right: 1em; 33 | } 34 | 35 | #changelist-form .results { 36 | overflow-x: auto; 37 | } 38 | 39 | #changelist .toplinks { 40 | border-bottom: 1px solid #ccc !important; 41 | } 42 | 43 | #changelist .paginator { 44 | color: #666; 45 | border-top: 1px solid #eee; 46 | border-bottom: 1px solid #eee; 47 | background: white url(../img/nav-bg.gif) 0 180% repeat-x; 48 | overflow: hidden; 49 | } 50 | 51 | .change-list .filtered .paginator { 52 | border-right: 1px solid #ddd; 53 | } 54 | 55 | /* CHANGELIST TABLES */ 56 | 57 | #changelist table thead th { 58 | padding: 0; 59 | white-space: nowrap; 60 | vertical-align: middle; 61 | } 62 | 63 | #changelist table thead th.action-checkbox-column { 64 | width: 1.5em; 65 | text-align: center; 66 | } 67 | 68 | #changelist table tbody td, #changelist table tbody th { 69 | border-left: 1px solid #ddd; 70 | } 71 | 72 | #changelist table tbody td:first-child, #changelist table tbody th:first-child { 73 | border-left: 0; 74 | border-right: 1px solid #ddd; 75 | } 76 | 77 | #changelist table tbody td.action-checkbox { 78 | text-align:center; 79 | } 80 | 81 | #changelist table tfoot { 82 | color: #666; 83 | } 84 | 85 | /* TOOLBAR */ 86 | 87 | #changelist #toolbar { 88 | padding: 3px; 89 | border-bottom: 1px solid #ddd; 90 | background: #e1e1e1 url(../img/nav-bg.gif) top left repeat-x; 91 | color: #666; 92 | } 93 | 94 | #changelist #toolbar form input { 95 | font-size: 11px; 96 | padding: 1px 2px; 97 | } 98 | 99 | #changelist #toolbar form #searchbar { 100 | padding: 2px; 101 | } 102 | 103 | #changelist #changelist-search img { 104 | vertical-align: middle; 105 | } 106 | 107 | /* FILTER COLUMN */ 108 | 109 | #changelist-filter { 110 | position: absolute; 111 | top: 0; 112 | right: 0; 113 | z-index: 1000; 114 | width: 160px; 115 | border-left: 1px solid #ddd; 116 | background: #efefef; 117 | margin: 0; 118 | } 119 | 120 | #changelist-filter h2 { 121 | font-size: 11px; 122 | padding: 2px 5px; 123 | border-bottom: 1px solid #ddd; 124 | } 125 | 126 | #changelist-filter h3 { 127 | font-size: 12px; 128 | margin-bottom: 0; 129 | } 130 | 131 | #changelist-filter ul { 132 | padding-left: 0; 133 | margin-left: 10px; 134 | } 135 | 136 | #changelist-filter li { 137 | list-style-type: none; 138 | margin-left: 0; 139 | padding-left: 0; 140 | } 141 | 142 | #changelist-filter a { 143 | color: #999; 144 | } 145 | 146 | #changelist-filter a:hover { 147 | color: #036; 148 | } 149 | 150 | #changelist-filter li.selected { 151 | border-left: 5px solid #ccc; 152 | padding-left: 5px; 153 | margin-left: -10px; 154 | } 155 | 156 | #changelist-filter li.selected a { 157 | color: #5b80b2 !important; 158 | } 159 | 160 | /* DATE DRILLDOWN */ 161 | 162 | .change-list ul.toplinks { 163 | display: block; 164 | background: white url(../img/nav-bg-reverse.gif) 0 -10px repeat-x; 165 | border-top: 1px solid white; 166 | float: left; 167 | padding: 0 !important; 168 | margin: 0 !important; 169 | width: 100%; 170 | } 171 | 172 | .change-list ul.toplinks li { 173 | padding: 3px 6px; 174 | font-weight: bold; 175 | list-style-type: none; 176 | display: inline-block; 177 | } 178 | 179 | .change-list ul.toplinks .date-back a { 180 | color: #999; 181 | } 182 | 183 | .change-list ul.toplinks .date-back a:hover { 184 | color: #036; 185 | } 186 | 187 | /* PAGINATOR */ 188 | 189 | .paginator { 190 | font-size: 11px; 191 | padding-top: 10px; 192 | padding-bottom: 10px; 193 | line-height: 22px; 194 | margin: 0; 195 | border-top: 1px solid #ddd; 196 | } 197 | 198 | .paginator a:link, .paginator a:visited { 199 | padding: 2px 6px; 200 | border: solid 1px #ccc; 201 | background: white; 202 | text-decoration: none; 203 | } 204 | 205 | .paginator a.showall { 206 | padding: 0 !important; 207 | border: none !important; 208 | } 209 | 210 | .paginator a.showall:hover { 211 | color: #036 !important; 212 | background: transparent !important; 213 | } 214 | 215 | .paginator .end { 216 | border-width: 2px !important; 217 | margin-right: 6px; 218 | } 219 | 220 | .paginator .this-page { 221 | padding: 2px 6px; 222 | font-weight: bold; 223 | font-size: 13px; 224 | vertical-align: top; 225 | } 226 | 227 | .paginator a:hover { 228 | color: white; 229 | background: #5b80b2; 230 | border-color: #036; 231 | } 232 | 233 | /* ACTIONS */ 234 | 235 | .filtered .actions { 236 | margin-right: 160px !important; 237 | border-right: 1px solid #ddd; 238 | } 239 | 240 | #changelist table input { 241 | margin: 0; 242 | } 243 | 244 | #changelist table tbody tr.selected { 245 | background-color: #FFFFCC; 246 | } 247 | 248 | #changelist .actions { 249 | color: #999; 250 | padding: 3px; 251 | border-top: 1px solid #fff; 252 | border-bottom: 1px solid #ddd; 253 | background: white url(../img/nav-bg-reverse.gif) 0 -10px repeat-x; 254 | } 255 | 256 | #changelist .actions.selected { 257 | background: #fffccf; 258 | border-top: 1px solid #fffee8; 259 | border-bottom: 1px solid #edecd6; 260 | } 261 | 262 | #changelist .actions span.all, 263 | #changelist .actions span.action-counter, 264 | #changelist .actions span.clear, 265 | #changelist .actions span.question { 266 | font-size: 11px; 267 | margin: 0 0.5em; 268 | display: none; 269 | } 270 | 271 | #changelist .actions:last-child { 272 | border-bottom: none; 273 | } 274 | 275 | #changelist .actions select { 276 | border: 1px solid #aaa; 277 | margin-left: 0.5em; 278 | padding: 1px 2px; 279 | } 280 | 281 | #changelist .actions label { 282 | font-size: 11px; 283 | margin-left: 0.5em; 284 | } 285 | 286 | #changelist #action-toggle { 287 | display: none; 288 | } 289 | 290 | #changelist .actions .button { 291 | font-size: 11px; 292 | padding: 1px 2px; 293 | } 294 | -------------------------------------------------------------------------------- /mstc_website/static/admin/css/dashboard.css: -------------------------------------------------------------------------------- 1 | /* DASHBOARD */ 2 | 3 | .dashboard .module table th { 4 | width: 100%; 5 | } 6 | 7 | .dashboard .module table td { 8 | white-space: nowrap; 9 | } 10 | 11 | .dashboard .module table td a { 12 | display: block; 13 | padding-right: .6em; 14 | } 15 | 16 | /* RECENT ACTIONS MODULE */ 17 | 18 | .module ul.actionlist { 19 | margin-left: 0; 20 | } 21 | 22 | ul.actionlist li { 23 | list-style-type: none; 24 | } 25 | 26 | ul.actionlist li { 27 | overflow: hidden; 28 | text-overflow: ellipsis; 29 | -o-text-overflow: ellipsis; 30 | } 31 | -------------------------------------------------------------------------------- /mstc_website/static/admin/css/ie.css: -------------------------------------------------------------------------------- 1 | /* IE 6 & 7 */ 2 | 3 | /* Proper fixed width for dashboard in IE6 */ 4 | 5 | .dashboard #content { 6 | *width: 768px; 7 | } 8 | 9 | .dashboard #content-main { 10 | *width: 535px; 11 | } 12 | 13 | /* IE 6 ONLY */ 14 | 15 | /* Keep header from flowing off the page */ 16 | 17 | #container { 18 | _position: static; 19 | } 20 | 21 | /* Put the right sidebars back on the page */ 22 | 23 | .colMS #content-related { 24 | _margin-right: 0; 25 | _margin-left: 10px; 26 | _position: static; 27 | } 28 | 29 | /* Put the left sidebars back on the page */ 30 | 31 | .colSM #content-related { 32 | _margin-right: 10px; 33 | _margin-left: -115px; 34 | _position: static; 35 | } 36 | 37 | .form-row { 38 | _height: 1%; 39 | } 40 | 41 | /* Fix right margin for changelist filters in IE6 */ 42 | 43 | #changelist-filter ul { 44 | _margin-right: -10px; 45 | } 46 | 47 | /* IE ignores min-height, but treats height as if it were min-height */ 48 | 49 | .change-list .filtered { 50 | _height: 400px; 51 | } 52 | 53 | /* IE doesn't know alpha transparency in PNGs */ 54 | 55 | .inline-deletelink { 56 | background: transparent url(../img/inline-delete-8bit.png) no-repeat; 57 | } 58 | 59 | /* IE7 doesn't support inline-block */ 60 | .change-list ul.toplinks li { 61 | zoom: 1; 62 | *display: inline; 63 | } -------------------------------------------------------------------------------- /mstc_website/static/admin/css/login.css: -------------------------------------------------------------------------------- 1 | /* LOGIN FORM */ 2 | 3 | body.login { 4 | background: #eee; 5 | } 6 | 7 | .login #container { 8 | background: white; 9 | border: 1px solid #ccc; 10 | width: 28em; 11 | min-width: 300px; 12 | margin-left: auto; 13 | margin-right: auto; 14 | margin-top: 100px; 15 | } 16 | 17 | .login #content-main { 18 | width: 100%; 19 | } 20 | 21 | .login form { 22 | margin-top: 1em; 23 | } 24 | 25 | .login .form-row { 26 | padding: 4px 0; 27 | float: left; 28 | width: 100%; 29 | } 30 | 31 | .login .form-row label { 32 | padding-right: 0.5em; 33 | line-height: 2em; 34 | font-size: 1em; 35 | clear: both; 36 | color: #333; 37 | } 38 | 39 | .login .form-row #id_username, .login .form-row #id_password { 40 | clear: both; 41 | padding: 6px; 42 | width: 100%; 43 | -webkit-box-sizing: border-box; 44 | -moz-box-sizing: border-box; 45 | box-sizing: border-box; 46 | } 47 | 48 | .login span.help { 49 | font-size: 10px; 50 | display: block; 51 | } 52 | 53 | .login .submit-row { 54 | clear: both; 55 | padding: 1em 0 0 9.4em; 56 | } 57 | 58 | .login .password-reset-link { 59 | text-align: center; 60 | } 61 | -------------------------------------------------------------------------------- /mstc_website/static/admin/css/rtl.css: -------------------------------------------------------------------------------- 1 | body { 2 | direction: rtl; 3 | } 4 | 5 | /* LOGIN */ 6 | 7 | .login .form-row { 8 | float: right; 9 | } 10 | 11 | .login .form-row label { 12 | float: right; 13 | padding-left: 0.5em; 14 | padding-right: 0; 15 | text-align: left; 16 | } 17 | 18 | .login .submit-row { 19 | clear: both; 20 | padding: 1em 9.4em 0 0; 21 | } 22 | 23 | /* GLOBAL */ 24 | 25 | th { 26 | text-align: right; 27 | } 28 | 29 | .module h2, .module caption { 30 | text-align: right; 31 | } 32 | 33 | .addlink, .changelink { 34 | padding-left: 0px; 35 | padding-right: 12px; 36 | background-position: 100% 0.2em; 37 | } 38 | 39 | .deletelink { 40 | padding-left: 0px; 41 | padding-right: 12px; 42 | background-position: 100% 0.25em; 43 | } 44 | 45 | .object-tools { 46 | float: left; 47 | } 48 | 49 | thead th:first-child, 50 | tfoot td:first-child { 51 | border-left: 1px solid #ddd !important; 52 | } 53 | 54 | /* LAYOUT */ 55 | 56 | #user-tools { 57 | right: auto; 58 | left: 0; 59 | text-align: left; 60 | } 61 | 62 | div.breadcrumbs { 63 | text-align: right; 64 | } 65 | 66 | #content-main { 67 | float: right; 68 | } 69 | 70 | #content-related { 71 | float: left; 72 | margin-left: -19em; 73 | margin-right: auto; 74 | } 75 | 76 | .colMS { 77 | margin-left: 20em !important; 78 | margin-right: 10px !important; 79 | } 80 | 81 | /* SORTABLE TABLES */ 82 | 83 | table thead th.sorted .sortoptions { 84 | float: left; 85 | } 86 | 87 | thead th.sorted .text { 88 | padding-right: 0; 89 | padding-left: 42px; 90 | } 91 | 92 | /* dashboard styles */ 93 | 94 | .dashboard .module table td a { 95 | padding-left: .6em; 96 | padding-right: 12px; 97 | } 98 | 99 | /* changelists styles */ 100 | 101 | .change-list .filtered { 102 | background: white url(../img/changelist-bg_rtl.gif) top left repeat-y !important; 103 | } 104 | 105 | .change-list .filtered table { 106 | border-left: 1px solid #ddd; 107 | border-right: 0px none; 108 | } 109 | 110 | #changelist-filter { 111 | right: auto; 112 | left: 0; 113 | border-left: 0px none; 114 | border-right: 1px solid #ddd; 115 | } 116 | 117 | .change-list .filtered .results, .change-list .filtered .paginator, .filtered #toolbar, .filtered div.xfull { 118 | margin-right: 0px !important; 119 | margin-left: 160px !important; 120 | } 121 | 122 | #changelist-filter li.selected { 123 | border-left: 0px none; 124 | padding-left: 0px; 125 | margin-left: 0; 126 | border-right: 5px solid #ccc; 127 | padding-right: 5px; 128 | margin-right: -10px; 129 | } 130 | 131 | .filtered .actions { 132 | border-left:1px solid #DDDDDD; 133 | margin-left:160px !important; 134 | border-right: 0 none; 135 | margin-right:0 !important; 136 | } 137 | 138 | #changelist table tbody td:first-child, #changelist table tbody th:first-child { 139 | border-right: 0; 140 | border-left: 1px solid #ddd; 141 | } 142 | 143 | /* FORMS */ 144 | 145 | .aligned label { 146 | padding: 0 0 3px 1em; 147 | float: right; 148 | } 149 | 150 | .submit-row { 151 | text-align: left 152 | } 153 | 154 | .submit-row p.deletelink-box { 155 | float: right; 156 | } 157 | 158 | .submit-row .deletelink { 159 | background: url(../img/icon_deletelink.gif) 0 50% no-repeat; 160 | padding-right: 14px; 161 | } 162 | 163 | .vDateField, .vTimeField { 164 | margin-left: 2px; 165 | } 166 | 167 | form ul.inline li { 168 | float: right; 169 | padding-right: 0; 170 | padding-left: 7px; 171 | } 172 | 173 | input[type=submit].default, .submit-row input.default { 174 | float: left; 175 | } 176 | 177 | fieldset .field-box { 178 | float: right; 179 | margin-left: 20px; 180 | margin-right: 0; 181 | } 182 | 183 | .errorlist li { 184 | background-position: 100% .3em; 185 | padding: 4px 25px 4px 5px; 186 | } 187 | 188 | .errornote { 189 | background-position: 100% .3em; 190 | padding: 4px 25px 4px 5px; 191 | } 192 | 193 | /* WIDGETS */ 194 | 195 | .calendarnav-previous { 196 | top: 0; 197 | left: auto; 198 | right: 0; 199 | } 200 | 201 | .calendarnav-next { 202 | top: 0; 203 | right: auto; 204 | left: 0; 205 | } 206 | 207 | .calendar caption, .calendarbox h2 { 208 | text-align: center; 209 | } 210 | 211 | .selector { 212 | float: right; 213 | } 214 | 215 | .selector .selector-filter { 216 | text-align: right; 217 | } 218 | 219 | .inline-deletelink { 220 | float: left; 221 | } 222 | 223 | /* MISC */ 224 | 225 | .inline-related h2, .inline-group h2 { 226 | text-align: right 227 | } 228 | 229 | .inline-related h3 span.delete { 230 | padding-right: 20px; 231 | padding-left: inherit; 232 | left: 10px; 233 | right: inherit; 234 | float:left; 235 | } 236 | 237 | .inline-related h3 span.delete label { 238 | margin-left: inherit; 239 | margin-right: 2px; 240 | } 241 | 242 | /* IE7 specific bug fixes */ 243 | 244 | div.colM { 245 | position: relative; 246 | } 247 | 248 | .submit-row input { 249 | float: left; 250 | } -------------------------------------------------------------------------------- /mstc_website/static/admin/img/changelist-bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/changelist-bg.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/changelist-bg_rtl.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/changelist-bg_rtl.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/chooser-bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/chooser-bg.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/chooser_stacked-bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/chooser_stacked-bg.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/default-bg-reverse.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/default-bg-reverse.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/default-bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/default-bg.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/deleted-overlay.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/deleted-overlay.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/gis/move_vertex_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/gis/move_vertex_off.png -------------------------------------------------------------------------------- /mstc_website/static/admin/img/gis/move_vertex_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/gis/move_vertex_on.png -------------------------------------------------------------------------------- /mstc_website/static/admin/img/icon-no.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/icon-no.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/icon-unknown.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/icon-unknown.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/icon-yes.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/icon-yes.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/icon_addlink.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/icon_addlink.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/icon_alert.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/icon_alert.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/icon_calendar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/icon_calendar.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/icon_changelink.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/icon_changelink.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/icon_clock.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/icon_clock.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/icon_deletelink.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/icon_deletelink.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/icon_error.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/icon_error.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/icon_searchbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/icon_searchbox.png -------------------------------------------------------------------------------- /mstc_website/static/admin/img/icon_success.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/icon_success.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/inline-delete-8bit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/inline-delete-8bit.png -------------------------------------------------------------------------------- /mstc_website/static/admin/img/inline-delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/inline-delete.png -------------------------------------------------------------------------------- /mstc_website/static/admin/img/inline-restore-8bit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/inline-restore-8bit.png -------------------------------------------------------------------------------- /mstc_website/static/admin/img/inline-restore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/inline-restore.png -------------------------------------------------------------------------------- /mstc_website/static/admin/img/inline-splitter-bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/inline-splitter-bg.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/nav-bg-grabber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/nav-bg-grabber.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/nav-bg-reverse.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/nav-bg-reverse.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/nav-bg-selected.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/nav-bg-selected.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/nav-bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/nav-bg.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/selector-icons.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/selector-icons.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/selector-search.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/selector-search.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/sorting-icons.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/sorting-icons.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/tool-left.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/tool-left.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/tool-left_over.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/tool-left_over.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/tool-right.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/tool-right.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/tool-right_over.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/tool-right_over.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/tooltag-add.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/tooltag-add.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/tooltag-add_over.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/tooltag-add_over.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/tooltag-arrowright.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/tooltag-arrowright.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/img/tooltag-arrowright_over.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/admin/img/tooltag-arrowright_over.gif -------------------------------------------------------------------------------- /mstc_website/static/admin/js/LICENSE-JQUERY.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 John Resig, http://jquery.com/ 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /mstc_website/static/admin/js/SelectBox.js: -------------------------------------------------------------------------------- 1 | var SelectBox = { 2 | cache: new Object(), 3 | init: function(id) { 4 | var box = document.getElementById(id); 5 | var node; 6 | SelectBox.cache[id] = new Array(); 7 | var cache = SelectBox.cache[id]; 8 | for (var i = 0; (node = box.options[i]); i++) { 9 | cache.push({value: node.value, text: node.text, displayed: 1}); 10 | } 11 | }, 12 | redisplay: function(id) { 13 | // Repopulate HTML select box from cache 14 | var box = document.getElementById(id); 15 | box.options.length = 0; // clear all options 16 | for (var i = 0, j = SelectBox.cache[id].length; i < j; i++) { 17 | var node = SelectBox.cache[id][i]; 18 | if (node.displayed) { 19 | box.options[box.options.length] = new Option(node.text, node.value, false, false); 20 | } 21 | } 22 | }, 23 | filter: function(id, text) { 24 | // Redisplay the HTML select box, displaying only the choices containing ALL 25 | // the words in text. (It's an AND search.) 26 | var tokens = text.toLowerCase().split(/\s+/); 27 | var node, token; 28 | for (var i = 0; (node = SelectBox.cache[id][i]); i++) { 29 | node.displayed = 1; 30 | for (var j = 0; (token = tokens[j]); j++) { 31 | if (node.text.toLowerCase().indexOf(token) == -1) { 32 | node.displayed = 0; 33 | } 34 | } 35 | } 36 | SelectBox.redisplay(id); 37 | }, 38 | delete_from_cache: function(id, value) { 39 | var node, delete_index = null; 40 | for (var i = 0; (node = SelectBox.cache[id][i]); i++) { 41 | if (node.value == value) { 42 | delete_index = i; 43 | break; 44 | } 45 | } 46 | var j = SelectBox.cache[id].length - 1; 47 | for (var i = delete_index; i < j; i++) { 48 | SelectBox.cache[id][i] = SelectBox.cache[id][i+1]; 49 | } 50 | SelectBox.cache[id].length--; 51 | }, 52 | add_to_cache: function(id, option) { 53 | SelectBox.cache[id].push({value: option.value, text: option.text, displayed: 1}); 54 | }, 55 | cache_contains: function(id, value) { 56 | // Check if an item is contained in the cache 57 | var node; 58 | for (var i = 0; (node = SelectBox.cache[id][i]); i++) { 59 | if (node.value == value) { 60 | return true; 61 | } 62 | } 63 | return false; 64 | }, 65 | move: function(from, to) { 66 | var from_box = document.getElementById(from); 67 | var to_box = document.getElementById(to); 68 | var option; 69 | for (var i = 0; (option = from_box.options[i]); i++) { 70 | if (option.selected && SelectBox.cache_contains(from, option.value)) { 71 | SelectBox.add_to_cache(to, {value: option.value, text: option.text, displayed: 1}); 72 | SelectBox.delete_from_cache(from, option.value); 73 | } 74 | } 75 | SelectBox.redisplay(from); 76 | SelectBox.redisplay(to); 77 | }, 78 | move_all: function(from, to) { 79 | var from_box = document.getElementById(from); 80 | var to_box = document.getElementById(to); 81 | var option; 82 | for (var i = 0; (option = from_box.options[i]); i++) { 83 | if (SelectBox.cache_contains(from, option.value)) { 84 | SelectBox.add_to_cache(to, {value: option.value, text: option.text, displayed: 1}); 85 | SelectBox.delete_from_cache(from, option.value); 86 | } 87 | } 88 | SelectBox.redisplay(from); 89 | SelectBox.redisplay(to); 90 | }, 91 | sort: function(id) { 92 | SelectBox.cache[id].sort( function(a, b) { 93 | a = a.text.toLowerCase(); 94 | b = b.text.toLowerCase(); 95 | try { 96 | if (a > b) return 1; 97 | if (a < b) return -1; 98 | } 99 | catch (e) { 100 | // silently fail on IE 'unknown' exception 101 | } 102 | return 0; 103 | } ); 104 | }, 105 | select_all: function(id) { 106 | var box = document.getElementById(id); 107 | for (var i = 0; i < box.options.length; i++) { 108 | box.options[i].selected = 'selected'; 109 | } 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /mstc_website/static/admin/js/actions.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | $.fn.actions = function(opts) { 3 | var options = $.extend({}, $.fn.actions.defaults, opts); 4 | var actionCheckboxes = $(this); 5 | var list_editable_changed = false; 6 | var checker = function(checked) { 7 | if (checked) { 8 | showQuestion(); 9 | } else { 10 | reset(); 11 | } 12 | $(actionCheckboxes).prop("checked", checked) 13 | .parent().parent().toggleClass(options.selectedClass, checked); 14 | }, 15 | updateCounter = function() { 16 | var sel = $(actionCheckboxes).filter(":checked").length; 17 | $(options.counterContainer).html(interpolate( 18 | ngettext('%(sel)s of %(cnt)s selected', '%(sel)s of %(cnt)s selected', sel), { 19 | sel: sel, 20 | cnt: _actions_icnt 21 | }, true)); 22 | $(options.allToggle).prop("checked", function() { 23 | if (sel == actionCheckboxes.length) { 24 | value = true; 25 | showQuestion(); 26 | } else { 27 | value = false; 28 | clearAcross(); 29 | } 30 | return value; 31 | }); 32 | }, 33 | showQuestion = function() { 34 | $(options.acrossClears).hide(); 35 | $(options.acrossQuestions).show(); 36 | $(options.allContainer).hide(); 37 | }, 38 | showClear = function() { 39 | $(options.acrossClears).show(); 40 | $(options.acrossQuestions).hide(); 41 | $(options.actionContainer).toggleClass(options.selectedClass); 42 | $(options.allContainer).show(); 43 | $(options.counterContainer).hide(); 44 | }, 45 | reset = function() { 46 | $(options.acrossClears).hide(); 47 | $(options.acrossQuestions).hide(); 48 | $(options.allContainer).hide(); 49 | $(options.counterContainer).show(); 50 | }, 51 | clearAcross = function() { 52 | reset(); 53 | $(options.acrossInput).val(0); 54 | $(options.actionContainer).removeClass(options.selectedClass); 55 | }; 56 | // Show counter by default 57 | $(options.counterContainer).show(); 58 | // Check state of checkboxes and reinit state if needed 59 | $(this).filter(":checked").each(function(i) { 60 | $(this).parent().parent().toggleClass(options.selectedClass); 61 | updateCounter(); 62 | if ($(options.acrossInput).val() == 1) { 63 | showClear(); 64 | } 65 | }); 66 | $(options.allToggle).show().click(function() { 67 | checker($(this).prop("checked")); 68 | updateCounter(); 69 | }); 70 | $("div.actions span.question a").click(function(event) { 71 | event.preventDefault(); 72 | $(options.acrossInput).val(1); 73 | showClear(); 74 | }); 75 | $("div.actions span.clear a").click(function(event) { 76 | event.preventDefault(); 77 | $(options.allToggle).prop("checked", false); 78 | clearAcross(); 79 | checker(0); 80 | updateCounter(); 81 | }); 82 | lastChecked = null; 83 | $(actionCheckboxes).click(function(event) { 84 | if (!event) { event = window.event; } 85 | var target = event.target ? event.target : event.srcElement; 86 | if (lastChecked && $.data(lastChecked) != $.data(target) && event.shiftKey === true) { 87 | var inrange = false; 88 | $(lastChecked).prop("checked", target.checked) 89 | .parent().parent().toggleClass(options.selectedClass, target.checked); 90 | $(actionCheckboxes).each(function() { 91 | if ($.data(this) == $.data(lastChecked) || $.data(this) == $.data(target)) { 92 | inrange = (inrange) ? false : true; 93 | } 94 | if (inrange) { 95 | $(this).prop("checked", target.checked) 96 | .parent().parent().toggleClass(options.selectedClass, target.checked); 97 | } 98 | }); 99 | } 100 | $(target).parent().parent().toggleClass(options.selectedClass, target.checked); 101 | lastChecked = target; 102 | updateCounter(); 103 | }); 104 | $('form#changelist-form table#result_list tr').find('td:gt(0) :input').change(function() { 105 | list_editable_changed = true; 106 | }); 107 | $('form#changelist-form button[name="index"]').click(function(event) { 108 | if (list_editable_changed) { 109 | return confirm(gettext("You have unsaved changes on individual editable fields. If you run an action, your unsaved changes will be lost.")); 110 | } 111 | }); 112 | $('form#changelist-form input[name="_save"]').click(function(event) { 113 | var action_changed = false; 114 | $('div.actions select option:selected').each(function() { 115 | if ($(this).val()) { 116 | action_changed = true; 117 | } 118 | }); 119 | if (action_changed) { 120 | if (list_editable_changed) { 121 | return confirm(gettext("You have selected an action, but you haven't saved your changes to individual fields yet. Please click OK to save. You'll need to re-run the action.")); 122 | } else { 123 | return confirm(gettext("You have selected an action, and you haven't made any changes on individual fields. You're probably looking for the Go button rather than the Save button.")); 124 | } 125 | } 126 | }); 127 | }; 128 | /* Setup plugin defaults */ 129 | $.fn.actions.defaults = { 130 | actionContainer: "div.actions", 131 | counterContainer: "span.action-counter", 132 | allContainer: "div.actions span.all", 133 | acrossInput: "div.actions input.select-across", 134 | acrossQuestions: "div.actions span.question", 135 | acrossClears: "div.actions span.clear", 136 | allToggle: "#action-toggle", 137 | selectedClass: "selected" 138 | }; 139 | })(django.jQuery); 140 | -------------------------------------------------------------------------------- /mstc_website/static/admin/js/actions.min.js: -------------------------------------------------------------------------------- 1 | (function(a){a.fn.actions=function(n){var b=a.extend({},a.fn.actions.defaults,n),e=a(this),g=false,k=function(c){c?i():j();a(e).prop("checked",c).parent().parent().toggleClass(b.selectedClass,c)},f=function(){var c=a(e).filter(":checked").length;a(b.counterContainer).html(interpolate(ngettext("%(sel)s of %(cnt)s selected","%(sel)s of %(cnt)s selected",c),{sel:c,cnt:_actions_icnt},true));a(b.allToggle).prop("checked",function(){if(c==e.length){value=true;i()}else{value=false;l()}return value})},i= 2 | function(){a(b.acrossClears).hide();a(b.acrossQuestions).show();a(b.allContainer).hide()},m=function(){a(b.acrossClears).show();a(b.acrossQuestions).hide();a(b.actionContainer).toggleClass(b.selectedClass);a(b.allContainer).show();a(b.counterContainer).hide()},j=function(){a(b.acrossClears).hide();a(b.acrossQuestions).hide();a(b.allContainer).hide();a(b.counterContainer).show()},l=function(){j();a(b.acrossInput).val(0);a(b.actionContainer).removeClass(b.selectedClass)};a(b.counterContainer).show(); 3 | a(this).filter(":checked").each(function(){a(this).parent().parent().toggleClass(b.selectedClass);f();a(b.acrossInput).val()==1&&m()});a(b.allToggle).show().click(function(){k(a(this).prop("checked"));f()});a("div.actions span.question a").click(function(c){c.preventDefault();a(b.acrossInput).val(1);m()});a("div.actions span.clear a").click(function(c){c.preventDefault();a(b.allToggle).prop("checked",false);l();k(0);f()});lastChecked=null;a(e).click(function(c){if(!c)c=window.event;var d=c.target? 4 | c.target:c.srcElement;if(lastChecked&&a.data(lastChecked)!=a.data(d)&&c.shiftKey===true){var h=false;a(lastChecked).prop("checked",d.checked).parent().parent().toggleClass(b.selectedClass,d.checked);a(e).each(function(){if(a.data(this)==a.data(lastChecked)||a.data(this)==a.data(d))h=h?false:true;h&&a(this).prop("checked",d.checked).parent().parent().toggleClass(b.selectedClass,d.checked)})}a(d).parent().parent().toggleClass(b.selectedClass,d.checked);lastChecked=d;f()});a("form#changelist-form table#result_list tr").find("td:gt(0) :input").change(function(){g= 5 | true});a('form#changelist-form button[name="index"]').click(function(){if(g)return confirm(gettext("You have unsaved changes on individual editable fields. If you run an action, your unsaved changes will be lost."))});a('form#changelist-form input[name="_save"]').click(function(){var c=false;a("div.actions select option:selected").each(function(){if(a(this).val())c=true});if(c)return g?confirm(gettext("You have selected an action, but you haven't saved your changes to individual fields yet. Please click OK to save. You'll need to re-run the action.")): 6 | confirm(gettext("You have selected an action, and you haven't made any changes on individual fields. You're probably looking for the Go button rather than the Save button."))})};a.fn.actions.defaults={actionContainer:"div.actions",counterContainer:"span.action-counter",allContainer:"div.actions span.all",acrossInput:"div.actions input.select-across",acrossQuestions:"div.actions span.question",acrossClears:"div.actions span.clear",allToggle:"#action-toggle",selectedClass:"selected"}})(django.jQuery); 7 | -------------------------------------------------------------------------------- /mstc_website/static/admin/js/admin/RelatedObjectLookups.js: -------------------------------------------------------------------------------- 1 | // Handles related-objects functionality: lookup link for raw_id_fields 2 | // and Add Another links. 3 | 4 | function html_unescape(text) { 5 | // Unescape a string that was escaped using django.utils.html.escape. 6 | text = text.replace(/</g, '<'); 7 | text = text.replace(/>/g, '>'); 8 | text = text.replace(/"/g, '"'); 9 | text = text.replace(/'/g, "'"); 10 | text = text.replace(/&/g, '&'); 11 | return text; 12 | } 13 | 14 | // IE doesn't accept periods or dashes in the window name, but the element IDs 15 | // we use to generate popup window names may contain them, therefore we map them 16 | // to allowed characters in a reversible way so that we can locate the correct 17 | // element when the popup window is dismissed. 18 | function id_to_windowname(text) { 19 | text = text.replace(/\./g, '__dot__'); 20 | text = text.replace(/\-/g, '__dash__'); 21 | return text; 22 | } 23 | 24 | function windowname_to_id(text) { 25 | text = text.replace(/__dot__/g, '.'); 26 | text = text.replace(/__dash__/g, '-'); 27 | return text; 28 | } 29 | 30 | function showRelatedObjectLookupPopup(triggeringLink) { 31 | var name = triggeringLink.id.replace(/^lookup_/, ''); 32 | name = id_to_windowname(name); 33 | var href; 34 | if (triggeringLink.href.search(/\?/) >= 0) { 35 | href = triggeringLink.href + '&_popup=1'; 36 | } else { 37 | href = triggeringLink.href + '?_popup=1'; 38 | } 39 | var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes'); 40 | win.focus(); 41 | return false; 42 | } 43 | 44 | function dismissRelatedLookupPopup(win, chosenId) { 45 | var name = windowname_to_id(win.name); 46 | var elem = document.getElementById(name); 47 | if (elem.className.indexOf('vManyToManyRawIdAdminField') != -1 && elem.value) { 48 | elem.value += ',' + chosenId; 49 | } else { 50 | document.getElementById(name).value = chosenId; 51 | } 52 | win.close(); 53 | } 54 | 55 | function showAddAnotherPopup(triggeringLink) { 56 | var name = triggeringLink.id.replace(/^add_/, ''); 57 | name = id_to_windowname(name); 58 | href = triggeringLink.href 59 | if (href.indexOf('?') == -1) { 60 | href += '?_popup=1'; 61 | } else { 62 | href += '&_popup=1'; 63 | } 64 | var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes'); 65 | win.focus(); 66 | return false; 67 | } 68 | 69 | function dismissAddAnotherPopup(win, newId, newRepr) { 70 | // newId and newRepr are expected to have previously been escaped by 71 | // django.utils.html.escape. 72 | newId = html_unescape(newId); 73 | newRepr = html_unescape(newRepr); 74 | var name = windowname_to_id(win.name); 75 | var elem = document.getElementById(name); 76 | if (elem) { 77 | var elemName = elem.nodeName.toUpperCase(); 78 | if (elemName == 'SELECT') { 79 | var o = new Option(newRepr, newId); 80 | elem.options[elem.options.length] = o; 81 | o.selected = true; 82 | } else if (elemName == 'INPUT') { 83 | if (elem.className.indexOf('vManyToManyRawIdAdminField') != -1 && elem.value) { 84 | elem.value += ',' + newId; 85 | } else { 86 | elem.value = newId; 87 | } 88 | } 89 | } else { 90 | var toId = name + "_to"; 91 | elem = document.getElementById(toId); 92 | var o = new Option(newRepr, newId); 93 | SelectBox.add_to_cache(toId, o); 94 | SelectBox.redisplay(toId); 95 | } 96 | win.close(); 97 | } 98 | -------------------------------------------------------------------------------- /mstc_website/static/admin/js/calendar.js: -------------------------------------------------------------------------------- 1 | /* 2 | calendar.js - Calendar functions by Adrian Holovaty 3 | depends on core.js for utility functions like removeChildren or quickElement 4 | */ 5 | 6 | // CalendarNamespace -- Provides a collection of HTML calendar-related helper functions 7 | var CalendarNamespace = { 8 | monthsOfYear: gettext('January February March April May June July August September October November December').split(' '), 9 | daysOfWeek: gettext('S M T W T F S').split(' '), 10 | firstDayOfWeek: parseInt(get_format('FIRST_DAY_OF_WEEK')), 11 | isLeapYear: function(year) { 12 | return (((year % 4)==0) && ((year % 100)!=0) || ((year % 400)==0)); 13 | }, 14 | getDaysInMonth: function(month,year) { 15 | var days; 16 | if (month==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12) { 17 | days = 31; 18 | } 19 | else if (month==4 || month==6 || month==9 || month==11) { 20 | days = 30; 21 | } 22 | else if (month==2 && CalendarNamespace.isLeapYear(year)) { 23 | days = 29; 24 | } 25 | else { 26 | days = 28; 27 | } 28 | return days; 29 | }, 30 | draw: function(month, year, div_id, callback) { // month = 1-12, year = 1-9999 31 | var today = new Date(); 32 | var todayDay = today.getDate(); 33 | var todayMonth = today.getMonth()+1; 34 | var todayYear = today.getFullYear(); 35 | var todayClass = ''; 36 | 37 | month = parseInt(month); 38 | year = parseInt(year); 39 | var calDiv = document.getElementById(div_id); 40 | removeChildren(calDiv); 41 | var calTable = document.createElement('table'); 42 | quickElement('caption', calTable, CalendarNamespace.monthsOfYear[month-1] + ' ' + year); 43 | var tableBody = quickElement('tbody', calTable); 44 | 45 | // Draw days-of-week header 46 | var tableRow = quickElement('tr', tableBody); 47 | for (var i = 0; i < 7; i++) { 48 | quickElement('th', tableRow, CalendarNamespace.daysOfWeek[(i + CalendarNamespace.firstDayOfWeek) % 7]); 49 | } 50 | 51 | var startingPos = new Date(year, month-1, 1 - CalendarNamespace.firstDayOfWeek).getDay(); 52 | var days = CalendarNamespace.getDaysInMonth(month, year); 53 | 54 | // Draw blanks before first of month 55 | tableRow = quickElement('tr', tableBody); 56 | for (var i = 0; i < startingPos; i++) { 57 | var _cell = quickElement('td', tableRow, ' '); 58 | _cell.style.backgroundColor = '#f3f3f3'; 59 | } 60 | 61 | // Draw days of month 62 | var currentDay = 1; 63 | for (var i = startingPos; currentDay <= days; i++) { 64 | if (i%7 == 0 && currentDay != 1) { 65 | tableRow = quickElement('tr', tableBody); 66 | } 67 | if ((currentDay==todayDay) && (month==todayMonth) && (year==todayYear)) { 68 | todayClass='today'; 69 | } else { 70 | todayClass=''; 71 | } 72 | var cell = quickElement('td', tableRow, '', 'class', todayClass); 73 | 74 | quickElement('a', cell, currentDay, 'href', 'javascript:void(' + callback + '('+year+','+month+','+currentDay+'));'); 75 | currentDay++; 76 | } 77 | 78 | // Draw blanks after end of month (optional, but makes for valid code) 79 | while (tableRow.childNodes.length < 7) { 80 | var _cell = quickElement('td', tableRow, ' '); 81 | _cell.style.backgroundColor = '#f3f3f3'; 82 | } 83 | 84 | calDiv.appendChild(calTable); 85 | } 86 | } 87 | 88 | // Calendar -- A calendar instance 89 | function Calendar(div_id, callback) { 90 | // div_id (string) is the ID of the element in which the calendar will 91 | // be displayed 92 | // callback (string) is the name of a JavaScript function that will be 93 | // called with the parameters (year, month, day) when a day in the 94 | // calendar is clicked 95 | this.div_id = div_id; 96 | this.callback = callback; 97 | this.today = new Date(); 98 | this.currentMonth = this.today.getMonth() + 1; 99 | this.currentYear = this.today.getFullYear(); 100 | } 101 | Calendar.prototype = { 102 | drawCurrent: function() { 103 | CalendarNamespace.draw(this.currentMonth, this.currentYear, this.div_id, this.callback); 104 | }, 105 | drawDate: function(month, year) { 106 | this.currentMonth = month; 107 | this.currentYear = year; 108 | this.drawCurrent(); 109 | }, 110 | drawPreviousMonth: function() { 111 | if (this.currentMonth == 1) { 112 | this.currentMonth = 12; 113 | this.currentYear--; 114 | } 115 | else { 116 | this.currentMonth--; 117 | } 118 | this.drawCurrent(); 119 | }, 120 | drawNextMonth: function() { 121 | if (this.currentMonth == 12) { 122 | this.currentMonth = 1; 123 | this.currentYear++; 124 | } 125 | else { 126 | this.currentMonth++; 127 | } 128 | this.drawCurrent(); 129 | }, 130 | drawPreviousYear: function() { 131 | this.currentYear--; 132 | this.drawCurrent(); 133 | }, 134 | drawNextYear: function() { 135 | this.currentYear++; 136 | this.drawCurrent(); 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /mstc_website/static/admin/js/collapse.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | $(document).ready(function() { 3 | // Add anchor tag for Show/Hide link 4 | $("fieldset.collapse").each(function(i, elem) { 5 | // Don't hide if fields in this fieldset have errors 6 | if ($(elem).find("div.errors").length == 0) { 7 | $(elem).addClass("collapsed").find("h2").first().append(' (' + gettext("Show") + 9 | ')'); 10 | } 11 | }); 12 | // Add toggle to anchor tag 13 | $("fieldset.collapse a.collapse-toggle").click(function(ev) { 14 | if ($(this).closest("fieldset").hasClass("collapsed")) { 15 | // Show 16 | $(this).text(gettext("Hide")).closest("fieldset").removeClass("collapsed").trigger("show.fieldset", [$(this).attr("id")]); 17 | } else { 18 | // Hide 19 | $(this).text(gettext("Show")).closest("fieldset").addClass("collapsed").trigger("hide.fieldset", [$(this).attr("id")]); 20 | } 21 | return false; 22 | }); 23 | }); 24 | })(django.jQuery); 25 | -------------------------------------------------------------------------------- /mstc_website/static/admin/js/collapse.min.js: -------------------------------------------------------------------------------- 1 | (function(a){a(document).ready(function(){a("fieldset.collapse").each(function(c,b){0==a(b).find("div.errors").length&&a(b).addClass("collapsed").find("h2").first().append(' ('+gettext("Show")+")")});a("fieldset.collapse a.collapse-toggle").click(function(){a(this).closest("fieldset").hasClass("collapsed")?a(this).text(gettext("Hide")).closest("fieldset").removeClass("collapsed").trigger("show.fieldset",[a(this).attr("id")]):a(this).text(gettext("Show")).closest("fieldset").addClass("collapsed").trigger("hide.fieldset", 2 | [a(this).attr("id")]);return!1})})})(django.jQuery); 3 | -------------------------------------------------------------------------------- /mstc_website/static/admin/js/inlines.min.js: -------------------------------------------------------------------------------- 1 | (function(b){b.fn.formset=function(d){var a=b.extend({},b.fn.formset.defaults,d),c=b(this),d=c.parent(),i=function(a,e,g){var d=RegExp("("+e+"-(\\d+|__prefix__))"),e=e+"-"+g;b(a).prop("for")&&b(a).prop("for",b(a).prop("for").replace(d,e));a.id&&(a.id=a.id.replace(d,e));a.name&&(a.name=a.name.replace(d,e))},f=b("#id_"+a.prefix+"-TOTAL_FORMS").prop("autocomplete","off"),g=parseInt(f.val(),10),e=b("#id_"+a.prefix+"-MAX_NUM_FORMS").prop("autocomplete","off"),f=""===e.val()||0'+a.addText+""),h=d.find("tr:last a")):(c.filter(":last").after('"),h=c.filter(":last").next().find("a"));h.click(function(d){d.preventDefault();var f=b("#id_"+a.prefix+"-TOTAL_FORMS"),d=b("#"+a.prefix+ 3 | "-empty"),c=d.clone(true);c.removeClass(a.emptyCssClass).addClass(a.formCssClass).attr("id",a.prefix+"-"+g);c.is("tr")?c.children(":last").append('
'+a.deleteText+"
"):c.is("ul")||c.is("ol")?c.append('
  • '+a.deleteText+"
  • "):c.children(":first").append(''+a.deleteText+"");c.find("*").each(function(){i(this, 4 | a.prefix,f.val())});c.insertBefore(b(d));b(f).val(parseInt(f.val(),10)+1);g=g+1;e.val()!==""&&e.val()-f.val()<=0&&h.parent().hide();c.find("a."+a.deleteCssClass).click(function(d){d.preventDefault();d=b(this).parents("."+a.formCssClass);d.remove();g=g-1;a.removed&&a.removed(d);d=b("."+a.formCssClass);b("#id_"+a.prefix+"-TOTAL_FORMS").val(d.length);(e.val()===""||e.val()-d.length>0)&&h.parent().show();for(var c=0,f=d.length;c 0) { 25 | values.push($(field).val()); 26 | } 27 | }) 28 | field.val(URLify(values.join(' '), maxLength)); 29 | }; 30 | 31 | $(dependencies.join(',')).keyup(populate).change(populate).focus(populate); 32 | }); 33 | }; 34 | })(django.jQuery); 35 | -------------------------------------------------------------------------------- /mstc_website/static/admin/js/prepopulate.min.js: -------------------------------------------------------------------------------- 1 | (function(a){a.fn.prepopulate=function(d,g){return this.each(function(){var b=a(this);b.data("_changed",false);b.change(function(){b.data("_changed",true)});var c=function(){if(b.data("_changed")!=true){var e=[];a.each(d,function(h,f){a(f).val().length>0&&e.push(a(f).val())});b.val(URLify(e.join(" "),g))}};a(d.join(",")).keyup(c).change(c).focus(c)})}})(django.jQuery); 2 | -------------------------------------------------------------------------------- /mstc_website/static/admin/js/timeparse.js: -------------------------------------------------------------------------------- 1 | var timeParsePatterns = [ 2 | // 9 3 | { re: /^\d{1,2}$/i, 4 | handler: function(bits) { 5 | if (bits[0].length == 1) { 6 | return '0' + bits[0] + ':00'; 7 | } else { 8 | return bits[0] + ':00'; 9 | } 10 | } 11 | }, 12 | // 13:00 13 | { re: /^\d{2}[:.]\d{2}$/i, 14 | handler: function(bits) { 15 | return bits[0].replace('.', ':'); 16 | } 17 | }, 18 | // 9:00 19 | { re: /^\d[:.]\d{2}$/i, 20 | handler: function(bits) { 21 | return '0' + bits[0].replace('.', ':'); 22 | } 23 | }, 24 | // 3 am / 3 a.m. / 3am 25 | { re: /^(\d+)\s*([ap])(?:.?m.?)?$/i, 26 | handler: function(bits) { 27 | var hour = parseInt(bits[1]); 28 | if (hour == 12) { 29 | hour = 0; 30 | } 31 | if (bits[2].toLowerCase() == 'p') { 32 | if (hour == 12) { 33 | hour = 0; 34 | } 35 | return (hour + 12) + ':00'; 36 | } else { 37 | if (hour < 10) { 38 | return '0' + hour + ':00'; 39 | } else { 40 | return hour + ':00'; 41 | } 42 | } 43 | } 44 | }, 45 | // 3.30 am / 3:15 a.m. / 3.00am 46 | { re: /^(\d+)[.:](\d{2})\s*([ap]).?m.?$/i, 47 | handler: function(bits) { 48 | var hour = parseInt(bits[1]); 49 | var mins = parseInt(bits[2]); 50 | if (mins < 10) { 51 | mins = '0' + mins; 52 | } 53 | if (hour == 12) { 54 | hour = 0; 55 | } 56 | if (bits[3].toLowerCase() == 'p') { 57 | if (hour == 12) { 58 | hour = 0; 59 | } 60 | return (hour + 12) + ':' + mins; 61 | } else { 62 | if (hour < 10) { 63 | return '0' + hour + ':' + mins; 64 | } else { 65 | return hour + ':' + mins; 66 | } 67 | } 68 | } 69 | }, 70 | // noon 71 | { re: /^no/i, 72 | handler: function(bits) { 73 | return '12:00'; 74 | } 75 | }, 76 | // midnight 77 | { re: /^mid/i, 78 | handler: function(bits) { 79 | return '00:00'; 80 | } 81 | } 82 | ]; 83 | 84 | function parseTimeString(s) { 85 | for (var i = 0; i < timeParsePatterns.length; i++) { 86 | var re = timeParsePatterns[i].re; 87 | var handler = timeParsePatterns[i].handler; 88 | var bits = re.exec(s); 89 | if (bits) { 90 | return handler(bits); 91 | } 92 | } 93 | return s; 94 | } 95 | -------------------------------------------------------------------------------- /mstc_website/static/admin/js/urlify.js: -------------------------------------------------------------------------------- 1 | var LATIN_MAP = { 2 | 'À': 'A', 'Á': 'A', 'Â': 'A', 'Ã': 'A', 'Ä': 'A', 'Å': 'A', 'Æ': 'AE', 'Ç': 3 | 'C', 'È': 'E', 'É': 'E', 'Ê': 'E', 'Ë': 'E', 'Ì': 'I', 'Í': 'I', 'Î': 'I', 4 | 'Ï': 'I', 'Ð': 'D', 'Ñ': 'N', 'Ò': 'O', 'Ó': 'O', 'Ô': 'O', 'Õ': 'O', 'Ö': 5 | 'O', 'Ő': 'O', 'Ø': 'O', 'Ù': 'U', 'Ú': 'U', 'Û': 'U', 'Ü': 'U', 'Ű': 'U', 6 | 'Ý': 'Y', 'Þ': 'TH', 'ß': 'ss', 'à':'a', 'á':'a', 'â': 'a', 'ã': 'a', 'ä': 7 | 'a', 'å': 'a', 'æ': 'ae', 'ç': 'c', 'è': 'e', 'é': 'e', 'ê': 'e', 'ë': 'e', 8 | 'ì': 'i', 'í': 'i', 'î': 'i', 'ï': 'i', 'ð': 'd', 'ñ': 'n', 'ò': 'o', 'ó': 9 | 'o', 'ô': 'o', 'õ': 'o', 'ö': 'o', 'ő': 'o', 'ø': 'o', 'ù': 'u', 'ú': 'u', 10 | 'û': 'u', 'ü': 'u', 'ű': 'u', 'ý': 'y', 'þ': 'th', 'ÿ': 'y' 11 | } 12 | var LATIN_SYMBOLS_MAP = { 13 | '©':'(c)' 14 | } 15 | var GREEK_MAP = { 16 | 'α':'a', 'β':'b', 'γ':'g', 'δ':'d', 'ε':'e', 'ζ':'z', 'η':'h', 'θ':'8', 17 | 'ι':'i', 'κ':'k', 'λ':'l', 'μ':'m', 'ν':'n', 'ξ':'3', 'ο':'o', 'π':'p', 18 | 'ρ':'r', 'σ':'s', 'τ':'t', 'υ':'y', 'φ':'f', 'χ':'x', 'ψ':'ps', 'ω':'w', 19 | 'ά':'a', 'έ':'e', 'ί':'i', 'ό':'o', 'ύ':'y', 'ή':'h', 'ώ':'w', 'ς':'s', 20 | 'ϊ':'i', 'ΰ':'y', 'ϋ':'y', 'ΐ':'i', 21 | 'Α':'A', 'Β':'B', 'Γ':'G', 'Δ':'D', 'Ε':'E', 'Ζ':'Z', 'Η':'H', 'Θ':'8', 22 | 'Ι':'I', 'Κ':'K', 'Λ':'L', 'Μ':'M', 'Ν':'N', 'Ξ':'3', 'Ο':'O', 'Π':'P', 23 | 'Ρ':'R', 'Σ':'S', 'Τ':'T', 'Υ':'Y', 'Φ':'F', 'Χ':'X', 'Ψ':'PS', 'Ω':'W', 24 | 'Ά':'A', 'Έ':'E', 'Ί':'I', 'Ό':'O', 'Ύ':'Y', 'Ή':'H', 'Ώ':'W', 'Ϊ':'I', 25 | 'Ϋ':'Y' 26 | } 27 | var TURKISH_MAP = { 28 | 'ş':'s', 'Ş':'S', 'ı':'i', 'İ':'I', 'ç':'c', 'Ç':'C', 'ü':'u', 'Ü':'U', 29 | 'ö':'o', 'Ö':'O', 'ğ':'g', 'Ğ':'G' 30 | } 31 | var RUSSIAN_MAP = { 32 | 'а':'a', 'б':'b', 'в':'v', 'г':'g', 'д':'d', 'е':'e', 'ё':'yo', 'ж':'zh', 33 | 'з':'z', 'и':'i', 'й':'j', 'к':'k', 'л':'l', 'м':'m', 'н':'n', 'о':'o', 34 | 'п':'p', 'р':'r', 'с':'s', 'т':'t', 'у':'u', 'ф':'f', 'х':'h', 'ц':'c', 35 | 'ч':'ch', 'ш':'sh', 'щ':'sh', 'ъ':'', 'ы':'y', 'ь':'', 'э':'e', 'ю':'yu', 36 | 'я':'ya', 37 | 'А':'A', 'Б':'B', 'В':'V', 'Г':'G', 'Д':'D', 'Е':'E', 'Ё':'Yo', 'Ж':'Zh', 38 | 'З':'Z', 'И':'I', 'Й':'J', 'К':'K', 'Л':'L', 'М':'M', 'Н':'N', 'О':'O', 39 | 'П':'P', 'Р':'R', 'С':'S', 'Т':'T', 'У':'U', 'Ф':'F', 'Х':'H', 'Ц':'C', 40 | 'Ч':'Ch', 'Ш':'Sh', 'Щ':'Sh', 'Ъ':'', 'Ы':'Y', 'Ь':'', 'Э':'E', 'Ю':'Yu', 41 | 'Я':'Ya' 42 | } 43 | var UKRAINIAN_MAP = { 44 | 'Є':'Ye', 'І':'I', 'Ї':'Yi', 'Ґ':'G', 'є':'ye', 'і':'i', 'ї':'yi', 'ґ':'g' 45 | } 46 | var CZECH_MAP = { 47 | 'č':'c', 'ď':'d', 'ě':'e', 'ň': 'n', 'ř':'r', 'š':'s', 'ť':'t', 'ů':'u', 48 | 'ž':'z', 'Č':'C', 'Ď':'D', 'Ě':'E', 'Ň': 'N', 'Ř':'R', 'Š':'S', 'Ť':'T', 49 | 'Ů':'U', 'Ž':'Z' 50 | } 51 | 52 | var POLISH_MAP = { 53 | 'ą':'a', 'ć':'c', 'ę':'e', 'ł':'l', 'ń':'n', 'ó':'o', 'ś':'s', 'ź':'z', 54 | 'ż':'z', 'Ą':'A', 'Ć':'C', 'Ę':'e', 'Ł':'L', 'Ń':'N', 'Ó':'o', 'Ś':'S', 55 | 'Ź':'Z', 'Ż':'Z' 56 | } 57 | 58 | var LATVIAN_MAP = { 59 | 'ā':'a', 'č':'c', 'ē':'e', 'ģ':'g', 'ī':'i', 'ķ':'k', 'ļ':'l', 'ņ':'n', 60 | 'š':'s', 'ū':'u', 'ž':'z', 'Ā':'A', 'Č':'C', 'Ē':'E', 'Ģ':'G', 'Ī':'i', 61 | 'Ķ':'k', 'Ļ':'L', 'Ņ':'N', 'Š':'S', 'Ū':'u', 'Ž':'Z' 62 | } 63 | 64 | var ALL_DOWNCODE_MAPS=new Array() 65 | ALL_DOWNCODE_MAPS[0]=LATIN_MAP 66 | ALL_DOWNCODE_MAPS[1]=LATIN_SYMBOLS_MAP 67 | ALL_DOWNCODE_MAPS[2]=GREEK_MAP 68 | ALL_DOWNCODE_MAPS[3]=TURKISH_MAP 69 | ALL_DOWNCODE_MAPS[4]=RUSSIAN_MAP 70 | ALL_DOWNCODE_MAPS[5]=UKRAINIAN_MAP 71 | ALL_DOWNCODE_MAPS[6]=CZECH_MAP 72 | ALL_DOWNCODE_MAPS[7]=POLISH_MAP 73 | ALL_DOWNCODE_MAPS[8]=LATVIAN_MAP 74 | 75 | var Downcoder = new Object(); 76 | Downcoder.Initialize = function() 77 | { 78 | if (Downcoder.map) // already made 79 | return ; 80 | Downcoder.map ={} 81 | Downcoder.chars = '' ; 82 | for(var i in ALL_DOWNCODE_MAPS) 83 | { 84 | var lookup = ALL_DOWNCODE_MAPS[i] 85 | for (var c in lookup) 86 | { 87 | Downcoder.map[c] = lookup[c] ; 88 | Downcoder.chars += c ; 89 | } 90 | } 91 | Downcoder.regex = new RegExp('[' + Downcoder.chars + ']|[^' + Downcoder.chars + ']+','g') ; 92 | } 93 | 94 | downcode= function( slug ) 95 | { 96 | Downcoder.Initialize() ; 97 | var downcoded ="" 98 | var pieces = slug.match(Downcoder.regex); 99 | if(pieces) 100 | { 101 | for (var i = 0 ; i < pieces.length ; i++) 102 | { 103 | if (pieces[i].length == 1) 104 | { 105 | var mapped = Downcoder.map[pieces[i]] ; 106 | if (mapped != null) 107 | { 108 | downcoded+=mapped; 109 | continue ; 110 | } 111 | } 112 | downcoded+=pieces[i]; 113 | } 114 | } 115 | else 116 | { 117 | downcoded = slug; 118 | } 119 | return downcoded; 120 | } 121 | 122 | 123 | function URLify(s, num_chars) { 124 | // changes, e.g., "Petty theft" to "petty_theft" 125 | // remove all these words from the string before urlifying 126 | s = downcode(s); 127 | removelist = ["a", "an", "as", "at", "before", "but", "by", "for", "from", 128 | "is", "in", "into", "like", "of", "off", "on", "onto", "per", 129 | "since", "than", "the", "this", "that", "to", "up", "via", 130 | "with"]; 131 | r = new RegExp('\\b(' + removelist.join('|') + ')\\b', 'gi'); 132 | s = s.replace(r, ''); 133 | // if downcode doesn't hit, the char will be stripped here 134 | s = s.replace(/[^-\w\s]/g, ''); // remove unneeded chars 135 | s = s.replace(/^\s+|\s+$/g, ''); // trim leading/trailing spaces 136 | s = s.replace(/[-\s]+/g, '-'); // convert spaces to hyphens 137 | s = s.toLowerCase(); // convert to lowercase 138 | return s.substring(0, num_chars);// trim to first num_chars chars 139 | } 140 | 141 | -------------------------------------------------------------------------------- /mstc_website/static/fonts/iconFont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/fonts/iconFont.eot -------------------------------------------------------------------------------- /mstc_website/static/fonts/iconFont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/fonts/iconFont.ttf -------------------------------------------------------------------------------- /mstc_website/static/fonts/iconFont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/fonts/iconFont.woff -------------------------------------------------------------------------------- /mstc_website/static/fonts/metroSysIcons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/fonts/metroSysIcons.ttf -------------------------------------------------------------------------------- /mstc_website/static/fonts/metroSysIcons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/fonts/metroSysIcons.woff -------------------------------------------------------------------------------- /mstc_website/static/img/01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/img/01.jpg -------------------------------------------------------------------------------- /mstc_website/static/img/02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/img/02.jpg -------------------------------------------------------------------------------- /mstc_website/static/img/03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/img/03.jpg -------------------------------------------------------------------------------- /mstc_website/static/img/04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/img/04.jpg -------------------------------------------------------------------------------- /mstc_website/static/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/img/favicon.ico -------------------------------------------------------------------------------- /mstc_website/static/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/img/logo.png -------------------------------------------------------------------------------- /mstc_website/static/img/logo_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/img/logo_1.png -------------------------------------------------------------------------------- /mstc_website/static/img/party_hat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/img/party_hat.png -------------------------------------------------------------------------------- /mstc_website/static/img/pencil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/img/pencil.png -------------------------------------------------------------------------------- /mstc_website/static/img/renren.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/img/renren.png -------------------------------------------------------------------------------- /mstc_website/static/img/sina_weibo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/img/sina_weibo.png -------------------------------------------------------------------------------- /mstc_website/static/img/tie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/img/tie.png -------------------------------------------------------------------------------- /mstc_website/static/img/wechat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/img/wechat.png -------------------------------------------------------------------------------- /mstc_website/static/img/wrench.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/mstc_website/static/img/wrench.png -------------------------------------------------------------------------------- /mstc_website/static/js/add.js: -------------------------------------------------------------------------------- 1 | function showform () { 2 | var a = document.getElementById('Switch'); 3 | var b = document.getElementById('infoform'); 4 | var c = document.getElementById('hasform'); 5 | if (a.getAttribute("data-s") == "off") { 6 | a.innerHTML="关闭报名"; 7 | a.setAttribute("data-s","on"); 8 | b.hidden = !b.hidden; 9 | c.setAttribute("value","True"); 10 | }else{ 11 | a.setAttribute("data-s","off"); 12 | a.innerHTML="开启报名"; 13 | b.hidden = !b.hidden; 14 | c.setAttribute("value","False"); 15 | }; 16 | } 17 | 18 | function showname () { 19 | var c = document.getElementById('needother'); 20 | var d = document.getElementById('showother'); 21 | if (c.checked) 22 | { 23 | d.hidden = !d.hidden; 24 | } 25 | else 26 | { 27 | d.hidden = true; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /mstc_website/static/js/jquery.mousewheel.js: -------------------------------------------------------------------------------- 1 | /*! Copyright (c) 2013 Brandon Aaron (http://brandonaaron.net) 2 | * Licensed under the MIT License (LICENSE.txt). 3 | * 4 | * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. 5 | * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. 6 | * Thanks to: Seamus Leahy for adding deltaX and deltaY 7 | * 8 | * Version: 3.1.3 9 | * 10 | * Requires: 1.2.2+ 11 | */ 12 | 13 | (function (factory) { 14 | if ( typeof define === 'function' && define.amd ) { 15 | // AMD. Register as an anonymous module. 16 | define(['jquery'], factory); 17 | } else if (typeof exports === 'object') { 18 | // Node/CommonJS style for Browserify 19 | module.exports = factory; 20 | } else { 21 | // Browser globals 22 | factory(jQuery); 23 | } 24 | }(function ($) { 25 | 26 | var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll']; 27 | var toBind = 'onwheel' in document || document.documentMode >= 9 ? ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll']; 28 | var lowestDelta, lowestDeltaXY; 29 | 30 | if ( $.event.fixHooks ) { 31 | for ( var i = toFix.length; i; ) { 32 | $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks; 33 | } 34 | } 35 | 36 | $.event.special.mousewheel = { 37 | setup: function() { 38 | if ( this.addEventListener ) { 39 | for ( var i = toBind.length; i; ) { 40 | this.addEventListener( toBind[--i], handler, false ); 41 | } 42 | } else { 43 | this.onmousewheel = handler; 44 | } 45 | }, 46 | 47 | teardown: function() { 48 | if ( this.removeEventListener ) { 49 | for ( var i = toBind.length; i; ) { 50 | this.removeEventListener( toBind[--i], handler, false ); 51 | } 52 | } else { 53 | this.onmousewheel = null; 54 | } 55 | } 56 | }; 57 | 58 | $.fn.extend({ 59 | mousewheel: function(fn) { 60 | return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); 61 | }, 62 | 63 | unmousewheel: function(fn) { 64 | return this.unbind("mousewheel", fn); 65 | } 66 | }); 67 | 68 | 69 | function handler(event) { 70 | var orgEvent = event || window.event, 71 | args = [].slice.call(arguments, 1), 72 | delta = 0, 73 | deltaX = 0, 74 | deltaY = 0, 75 | absDelta = 0, 76 | absDeltaXY = 0, 77 | fn; 78 | event = $.event.fix(orgEvent); 79 | event.type = "mousewheel"; 80 | 81 | // Old school scrollwheel delta 82 | if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta; } 83 | if ( orgEvent.detail ) { delta = orgEvent.detail * -1; } 84 | 85 | // New school wheel delta (wheel event) 86 | if ( orgEvent.deltaY ) { 87 | deltaY = orgEvent.deltaY * -1; 88 | delta = deltaY; 89 | } 90 | if ( orgEvent.deltaX ) { 91 | deltaX = orgEvent.deltaX; 92 | delta = deltaX * -1; 93 | } 94 | 95 | // Webkit 96 | if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY; } 97 | if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = orgEvent.wheelDeltaX * -1; } 98 | 99 | // Look for lowest delta to normalize the delta values 100 | absDelta = Math.abs(delta); 101 | if ( !lowestDelta || absDelta < lowestDelta ) { lowestDelta = absDelta; } 102 | absDeltaXY = Math.max(Math.abs(deltaY), Math.abs(deltaX)); 103 | if ( !lowestDeltaXY || absDeltaXY < lowestDeltaXY ) { lowestDeltaXY = absDeltaXY; } 104 | 105 | // Get a whole value for the deltas 106 | fn = delta > 0 ? 'floor' : 'ceil'; 107 | delta = Math[fn](delta / lowestDelta); 108 | deltaX = Math[fn](deltaX / lowestDeltaXY); 109 | deltaY = Math[fn](deltaY / lowestDeltaXY); 110 | 111 | // Add event and delta to the front of the arguments 112 | args.unshift(event, delta, deltaX, deltaY); 113 | 114 | return ($.event.dispatch || $.event.handle).apply(this, args); 115 | } 116 | 117 | })); 118 | -------------------------------------------------------------------------------- /mstc_website/static/js/jquery.widget.min.js: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.10.3 - 2013-05-28 2 | * http://jqueryui.com 3 | * Includes: jquery.ui.widget.js 4 | * Copyright 2013 jQuery Foundation and other contributors Licensed MIT */ 5 | 6 | (function(e,t){var i=0,s=Array.prototype.slice,n=e.cleanData;e.cleanData=function(t){for(var i,s=0;null!=(i=t[s]);s++)try{e(i).triggerHandler("remove")}catch(a){}n(t)},e.widget=function(i,s,n){var a,r,o,h,l={},u=i.split(".")[0];i=i.split(".")[1],a=u+"-"+i,n||(n=s,s=e.Widget),e.expr[":"][a.toLowerCase()]=function(t){return!!e.data(t,a)},e[u]=e[u]||{},r=e[u][i],o=e[u][i]=function(e,i){return this._createWidget?(arguments.length&&this._createWidget(e,i),t):new o(e,i)},e.extend(o,r,{version:n.version,_proto:e.extend({},n),_childConstructors:[]}),h=new s,h.options=e.widget.extend({},h.options),e.each(n,function(i,n){return e.isFunction(n)?(l[i]=function(){var e=function(){return s.prototype[i].apply(this,arguments)},t=function(e){return s.prototype[i].apply(this,e)};return function(){var i,s=this._super,a=this._superApply;return this._super=e,this._superApply=t,i=n.apply(this,arguments),this._super=s,this._superApply=a,i}}(),t):(l[i]=n,t)}),o.prototype=e.widget.extend(h,{widgetEventPrefix:r?h.widgetEventPrefix:i},l,{constructor:o,namespace:u,widgetName:i,widgetFullName:a}),r?(e.each(r._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete r._childConstructors):s._childConstructors.push(o),e.widget.bridge(i,o)},e.widget.extend=function(i){for(var n,a,r=s.call(arguments,1),o=0,h=r.length;h>o;o++)for(n in r[o])a=r[o][n],r[o].hasOwnProperty(n)&&a!==t&&(i[n]=e.isPlainObject(a)?e.isPlainObject(i[n])?e.widget.extend({},i[n],a):e.widget.extend({},a):a);return i},e.widget.bridge=function(i,n){var a=n.prototype.widgetFullName||i;e.fn[i]=function(r){var o="string"==typeof r,h=s.call(arguments,1),l=this;return r=!o&&h.length?e.widget.extend.apply(null,[r].concat(h)):r,o?this.each(function(){var s,n=e.data(this,a);return n?e.isFunction(n[r])&&"_"!==r.charAt(0)?(s=n[r].apply(n,h),s!==n&&s!==t?(l=s&&s.jquery?l.pushStack(s.get()):s,!1):t):e.error("no such method '"+r+"' for "+i+" widget instance"):e.error("cannot call methods on "+i+" prior to initialization; "+"attempted to call method '"+r+"'")}):this.each(function(){var t=e.data(this,a);t?t.option(r||{})._init():e.data(this,a,new n(r,this))}),l}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
    ",options:{disabled:!1,create:null},_createWidget:function(t,s){s=e(s||this.defaultElement||this)[0],this.element=e(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),s!==this&&(e.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===s&&this.destroy()}}),this.document=e(s.style?s.ownerDocument:s.document||s),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(i,s){var n,a,r,o=i;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof i)if(o={},n=i.split("."),i=n.shift(),n.length){for(a=o[i]=e.widget.extend({},this.options[i]),r=0;n.length-1>r;r++)a[n[r]]=a[n[r]]||{},a=a[n[r]];if(i=n.pop(),s===t)return a[i]===t?null:a[i];a[i]=s}else{if(s===t)return this.options[i]===t?null:this.options[i];o[i]=s}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(i,s,n){var a,r=this;"boolean"!=typeof i&&(n=s,s=i,i=!1),n?(s=a=e(s),this.bindings=this.bindings.add(s)):(n=s,s=this.element,a=this.widget()),e.each(n,function(n,o){function h(){return i||r.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?r[o]:o).apply(r,arguments):t}"string"!=typeof o&&(h.guid=o.guid=o.guid||h.guid||e.guid++);var l=n.match(/^(\w+)\s*(.*)$/),u=l[1]+r.eventNamespace,c=l[2];c?a.delegate(c,u,h):s.bind(u,h)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,r=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(r)&&r.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var r,o=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),r=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),r&&e.effects&&e.effects.effect[o]?s[t](n):o!==t&&s[o]?s[o](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i()})}})})(jQuery); -------------------------------------------------------------------------------- /resource/logo_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/resource/logo_1.png -------------------------------------------------------------------------------- /resource/logo_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/resource/logo_b.png -------------------------------------------------------------------------------- /resource/logo_head.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HIT-MSTC/mstc-website/d24e77a1a08a65fdf2bc1a8bef9b19e97ead8100/resource/logo_head.png -------------------------------------------------------------------------------- /site-packages/Markdown-2.5.egg-info/PKG-INFO: -------------------------------------------------------------------------------- 1 | Metadata-Version: 1.1 2 | Name: Markdown 3 | Version: 2.5 4 | Summary: Python implementation of Markdown. 5 | Home-page: https://pythonhosted.org/Markdown/ 6 | Author: Waylan Limberg 7 | Author-email: waylan [at] gmail.com 8 | License: BSD License 9 | Download-URL: http://pypi.python.org/packages/source/M/Markdown/Markdown-2.5.tar.gz 10 | Description: This is a Python implementation of John Gruber's Markdown_. 11 | It is almost completely compliant with the reference implementation, 12 | though there are a few known issues. See Features_ for information 13 | on what exactly is supported and what is not. Additional features are 14 | supported by the `Available Extensions`_. 15 | 16 | .. _Markdown: http://daringfireball.net/projects/markdown/ 17 | .. _Features: https://pythonhosted.org/Markdown/index.html#Features 18 | .. _`Available Extensions`: https://pythonhosted.org/Markdown/extensions/index.html 19 | 20 | Support 21 | ======= 22 | 23 | You may ask for help and discuss various other issues on the 24 | `mailing list`_ and report bugs on the `bug tracker`_. 25 | 26 | .. _`mailing list`: http://lists.sourceforge.net/lists/listinfo/python-markdown-discuss 27 | .. _`bug tracker`: http://github.com/waylan/Python-Markdown/issues 28 | 29 | Platform: UNKNOWN 30 | Classifier: Development Status :: 5 - Production/Stable 31 | Classifier: License :: OSI Approved :: BSD License 32 | Classifier: Operating System :: OS Independent 33 | Classifier: Programming Language :: Python 34 | Classifier: Programming Language :: Python :: 2 35 | Classifier: Programming Language :: Python :: 2.7 36 | Classifier: Programming Language :: Python :: 3 37 | Classifier: Programming Language :: Python :: 3.2 38 | Classifier: Programming Language :: Python :: 3.3 39 | Classifier: Programming Language :: Python :: 3.4 40 | Classifier: Topic :: Communications :: Email :: Filters 41 | Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries 42 | Classifier: Topic :: Internet :: WWW/HTTP :: Site Management 43 | Classifier: Topic :: Software Development :: Documentation 44 | Classifier: Topic :: Software Development :: Libraries :: Python Modules 45 | Classifier: Topic :: Text Processing :: Filters 46 | Classifier: Topic :: Text Processing :: Markup :: HTML 47 | -------------------------------------------------------------------------------- /site-packages/Markdown-2.5.egg-info/SOURCES.txt: -------------------------------------------------------------------------------- 1 | setup.cfg 2 | Markdown.egg-info/PKG-INFO 3 | Markdown.egg-info/SOURCES.txt 4 | Markdown.egg-info/dependency_links.txt 5 | Markdown.egg-info/top_level.txt 6 | bin/markdown_py 7 | markdown/__init__.py 8 | markdown/__main__.py 9 | markdown/__version__.py 10 | markdown/blockparser.py 11 | markdown/blockprocessors.py 12 | markdown/inlinepatterns.py 13 | markdown/odict.py 14 | markdown/postprocessors.py 15 | markdown/preprocessors.py 16 | markdown/serializers.py 17 | markdown/treeprocessors.py 18 | markdown/util.py 19 | markdown/extensions/__init__.py 20 | markdown/extensions/abbr.py 21 | markdown/extensions/admonition.py 22 | markdown/extensions/attr_list.py 23 | markdown/extensions/codehilite.py 24 | markdown/extensions/def_list.py 25 | markdown/extensions/extra.py 26 | markdown/extensions/fenced_code.py 27 | markdown/extensions/footnotes.py 28 | markdown/extensions/headerid.py 29 | markdown/extensions/meta.py 30 | markdown/extensions/nl2br.py 31 | markdown/extensions/sane_lists.py 32 | markdown/extensions/smart_strong.py 33 | markdown/extensions/smarty.py 34 | markdown/extensions/tables.py 35 | markdown/extensions/toc.py 36 | markdown/extensions/wikilinks.py -------------------------------------------------------------------------------- /site-packages/Markdown-2.5.egg-info/dependency_links.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /site-packages/Markdown-2.5.egg-info/installed-files.txt: -------------------------------------------------------------------------------- 1 | ../markdown/util.py 2 | ../markdown/serializers.py 3 | ../markdown/odict.py 4 | ../markdown/blockprocessors.py 5 | ../markdown/treeprocessors.py 6 | ../markdown/inlinepatterns.py 7 | ../markdown/__version__.py 8 | ../markdown/__main__.py 9 | ../markdown/postprocessors.py 10 | ../markdown/__init__.py 11 | ../markdown/preprocessors.py 12 | ../markdown/blockparser.py 13 | ../markdown/extensions/footnotes.py 14 | ../markdown/extensions/sane_lists.py 15 | ../markdown/extensions/smarty.py 16 | ../markdown/extensions/abbr.py 17 | ../markdown/extensions/fenced_code.py 18 | ../markdown/extensions/headerid.py 19 | ../markdown/extensions/tables.py 20 | ../markdown/extensions/nl2br.py 21 | ../markdown/extensions/attr_list.py 22 | ../markdown/extensions/smart_strong.py 23 | ../markdown/extensions/meta.py 24 | ../markdown/extensions/wikilinks.py 25 | ../markdown/extensions/def_list.py 26 | ../markdown/extensions/__init__.py 27 | ../markdown/extensions/toc.py 28 | ../markdown/extensions/codehilite.py 29 | ../markdown/extensions/extra.py 30 | ../markdown/extensions/admonition.py 31 | ../markdown/util.pyc 32 | ../markdown/serializers.pyc 33 | ../markdown/odict.pyc 34 | ../markdown/blockprocessors.pyc 35 | ../markdown/treeprocessors.pyc 36 | ../markdown/inlinepatterns.pyc 37 | ../markdown/__version__.pyc 38 | ../markdown/__main__.pyc 39 | ../markdown/postprocessors.pyc 40 | ../markdown/__init__.pyc 41 | ../markdown/preprocessors.pyc 42 | ../markdown/blockparser.pyc 43 | ../markdown/extensions/footnotes.pyc 44 | ../markdown/extensions/sane_lists.pyc 45 | ../markdown/extensions/smarty.pyc 46 | ../markdown/extensions/abbr.pyc 47 | ../markdown/extensions/fenced_code.pyc 48 | ../markdown/extensions/headerid.pyc 49 | ../markdown/extensions/tables.pyc 50 | ../markdown/extensions/nl2br.pyc 51 | ../markdown/extensions/attr_list.pyc 52 | ../markdown/extensions/smart_strong.pyc 53 | ../markdown/extensions/meta.pyc 54 | ../markdown/extensions/wikilinks.pyc 55 | ../markdown/extensions/def_list.pyc 56 | ../markdown/extensions/__init__.pyc 57 | ../markdown/extensions/toc.pyc 58 | ../markdown/extensions/codehilite.pyc 59 | ../markdown/extensions/extra.pyc 60 | ../markdown/extensions/admonition.pyc 61 | ./ 62 | top_level.txt 63 | PKG-INFO 64 | dependency_links.txt 65 | SOURCES.txt 66 | ../../../../../tmp/markdown_py 67 | -------------------------------------------------------------------------------- /site-packages/Markdown-2.5.egg-info/top_level.txt: -------------------------------------------------------------------------------- 1 | markdown 2 | -------------------------------------------------------------------------------- /site-packages/markdown/__main__.py: -------------------------------------------------------------------------------- 1 | """ 2 | COMMAND-LINE SPECIFIC STUFF 3 | ============================================================================= 4 | 5 | """ 6 | 7 | import markdown 8 | import sys 9 | import optparse 10 | import codecs 11 | try: 12 | import yaml 13 | except ImportError: #pragma: no cover 14 | import json as yaml 15 | 16 | import logging 17 | from logging import DEBUG, INFO, CRITICAL 18 | 19 | logger = logging.getLogger('MARKDOWN') 20 | 21 | def parse_options(args=None, values=None): 22 | """ 23 | Define and parse `optparse` options for command-line usage. 24 | """ 25 | usage = """%prog [options] [INPUTFILE] 26 | (STDIN is assumed if no INPUTFILE is given)""" 27 | desc = "A Python implementation of John Gruber's Markdown. " \ 28 | "https://pythonhosted.org/Markdown/" 29 | ver = "%%prog %s" % markdown.version 30 | 31 | parser = optparse.OptionParser(usage=usage, description=desc, version=ver) 32 | parser.add_option("-f", "--file", dest="filename", default=None, 33 | help="Write output to OUTPUT_FILE. Defaults to STDOUT.", 34 | metavar="OUTPUT_FILE") 35 | parser.add_option("-e", "--encoding", dest="encoding", 36 | help="Encoding for input and output files.",) 37 | parser.add_option("-s", "--safe", dest="safe", default=False, 38 | metavar="SAFE_MODE", 39 | help="Deprecated! 'replace', 'remove' or 'escape' HTML tags in input") 40 | parser.add_option("-o", "--output_format", dest="output_format", 41 | default='xhtml1', metavar="OUTPUT_FORMAT", 42 | help="'xhtml1' (default), 'html4' or 'html5'.") 43 | parser.add_option("-n", "--no_lazy_ol", dest="lazy_ol", 44 | action='store_false', default=True, 45 | help="Observe number of first item of ordered lists.") 46 | parser.add_option("-x", "--extension", action="append", dest="extensions", 47 | help = "Load extension EXTENSION.", metavar="EXTENSION") 48 | parser.add_option("-c", "--extension_configs", dest="configfile", default=None, 49 | help="Read extension configurations from CONFIG_FILE. " 50 | "CONFIG_FILE must be of JSON or YAML format. YAML format requires " 51 | "that a python YAML library be installed. The parsed JSON or YAML " 52 | "must result in a python dictionary which would be accepted by the " 53 | "'extension_configs' keyword on the markdown.Markdown class. " 54 | "The extensions must also be loaded with the `--extension` option.", 55 | metavar="CONFIG_FILE") 56 | parser.add_option("-q", "--quiet", default = CRITICAL, 57 | action="store_const", const=CRITICAL+10, dest="verbose", 58 | help="Suppress all warnings.") 59 | parser.add_option("-v", "--verbose", 60 | action="store_const", const=INFO, dest="verbose", 61 | help="Print all warnings.") 62 | parser.add_option("--noisy", 63 | action="store_const", const=DEBUG, dest="verbose", 64 | help="Print debug messages.") 65 | 66 | (options, args) = parser.parse_args(args, values) 67 | 68 | if len(args) == 0: 69 | input_file = None 70 | else: 71 | input_file = args[0] 72 | 73 | if not options.extensions: 74 | options.extensions = [] 75 | 76 | extension_configs = {} 77 | if options.configfile: 78 | with codecs.open(options.configfile, mode="r", encoding=options.encoding) as fp: 79 | try: 80 | extension_configs = yaml.load(fp) 81 | except Exception as e: 82 | message = "Failed parsing extension config file: %s" % options.configfile 83 | e.args = (message,) + e.args[1:] 84 | raise 85 | 86 | return {'input': input_file, 87 | 'output': options.filename, 88 | 'safe_mode': options.safe, 89 | 'extensions': options.extensions, 90 | 'extension_configs': extension_configs, 91 | 'encoding': options.encoding, 92 | 'output_format': options.output_format, 93 | 'lazy_ol': options.lazy_ol}, options.verbose 94 | 95 | def run(): #pragma: no cover 96 | """Run Markdown from the command line.""" 97 | 98 | # Parse options and adjust logging level if necessary 99 | options, logging_level = parse_options() 100 | if not options: sys.exit(2) 101 | logger.setLevel(logging_level) 102 | logger.addHandler(logging.StreamHandler()) 103 | 104 | # Run 105 | markdown.markdownFromFile(**options) 106 | 107 | if __name__ == '__main__': #pragma: no cover 108 | # Support running module as a commandline command. 109 | # Python 2.5 & 2.6 do: `python -m markdown.__main__ [options] [args]`. 110 | # Python 2.7 & 3.x do: `python -m markdown [options] [args]`. 111 | run() 112 | -------------------------------------------------------------------------------- /site-packages/markdown/__version__.py: -------------------------------------------------------------------------------- 1 | # 2 | # markdown/__version__.py 3 | # 4 | # version_info should conform to PEP 386 5 | # (major, minor, micro, alpha/beta/rc/final, #) 6 | # (1, 1, 2, 'alpha', 0) => "1.1.2.dev" 7 | # (1, 2, 0, 'beta', 2) => "1.2b2" 8 | version_info = (2, 5, 0, 'final', 0) 9 | 10 | def _get_version(): 11 | " Returns a PEP 386-compliant version number from version_info. " 12 | assert len(version_info) == 5 13 | assert version_info[3] in ('alpha', 'beta', 'rc', 'final') 14 | 15 | parts = 2 if version_info[2] == 0 else 3 16 | main = '.'.join(map(str, version_info[:parts])) 17 | 18 | sub = '' 19 | if version_info[3] == 'alpha' and version_info[4] == 0: 20 | # TODO: maybe append some sort of git info here?? 21 | sub = '.dev' 22 | elif version_info[3] != 'final': 23 | mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'} 24 | sub = mapping[version_info[3]] + str(version_info[4]) 25 | 26 | return str(main + sub) 27 | 28 | version = _get_version() 29 | -------------------------------------------------------------------------------- /site-packages/markdown/blockparser.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | from __future__ import absolute_import 3 | from . import util 4 | from . import odict 5 | 6 | class State(list): 7 | """ Track the current and nested state of the parser. 8 | 9 | This utility class is used to track the state of the BlockParser and 10 | support multiple levels if nesting. It's just a simple API wrapped around 11 | a list. Each time a state is set, that state is appended to the end of the 12 | list. Each time a state is reset, that state is removed from the end of 13 | the list. 14 | 15 | Therefore, each time a state is set for a nested block, that state must be 16 | reset when we back out of that level of nesting or the state could be 17 | corrupted. 18 | 19 | While all the methods of a list object are available, only the three 20 | defined below need be used. 21 | 22 | """ 23 | 24 | def set(self, state): 25 | """ Set a new state. """ 26 | self.append(state) 27 | 28 | def reset(self): 29 | """ Step back one step in nested state. """ 30 | self.pop() 31 | 32 | def isstate(self, state): 33 | """ Test that top (current) level is of given state. """ 34 | if len(self): 35 | return self[-1] == state 36 | else: 37 | return False 38 | 39 | class BlockParser: 40 | """ Parse Markdown blocks into an ElementTree object. 41 | 42 | A wrapper class that stitches the various BlockProcessors together, 43 | looping through them and creating an ElementTree object. 44 | """ 45 | 46 | def __init__(self, markdown): 47 | self.blockprocessors = odict.OrderedDict() 48 | self.state = State() 49 | self.markdown = markdown 50 | 51 | def parseDocument(self, lines): 52 | """ Parse a markdown document into an ElementTree. 53 | 54 | Given a list of lines, an ElementTree object (not just a parent Element) 55 | is created and the root element is passed to the parser as the parent. 56 | The ElementTree object is returned. 57 | 58 | This should only be called on an entire document, not pieces. 59 | 60 | """ 61 | # Create a ElementTree from the lines 62 | self.root = util.etree.Element(self.markdown.doc_tag) 63 | self.parseChunk(self.root, '\n'.join(lines)) 64 | return util.etree.ElementTree(self.root) 65 | 66 | def parseChunk(self, parent, text): 67 | """ Parse a chunk of markdown text and attach to given etree node. 68 | 69 | While the ``text`` argument is generally assumed to contain multiple 70 | blocks which will be split on blank lines, it could contain only one 71 | block. Generally, this method would be called by extensions when 72 | block parsing is required. 73 | 74 | The ``parent`` etree Element passed in is altered in place. 75 | Nothing is returned. 76 | 77 | """ 78 | self.parseBlocks(parent, text.split('\n\n')) 79 | 80 | def parseBlocks(self, parent, blocks): 81 | """ Process blocks of markdown text and attach to given etree node. 82 | 83 | Given a list of ``blocks``, each blockprocessor is stepped through 84 | until there are no blocks left. While an extension could potentially 85 | call this method directly, it's generally expected to be used internally. 86 | 87 | This is a public method as an extension may need to add/alter additional 88 | BlockProcessors which call this method to recursively parse a nested 89 | block. 90 | 91 | """ 92 | while blocks: 93 | for processor in self.blockprocessors.values(): 94 | if processor.test(parent, blocks[0]): 95 | if processor.run(parent, blocks) is not False: 96 | # run returns True or None 97 | break 98 | 99 | 100 | -------------------------------------------------------------------------------- /site-packages/markdown/extensions/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Extensions 3 | ----------------------------------------------------------------------------- 4 | """ 5 | 6 | from __future__ import unicode_literals 7 | from ..util import parseBoolValue 8 | import warnings 9 | 10 | class Extension(object): 11 | """ Base class for extensions to subclass. """ 12 | 13 | # Default config -- to be overriden by a subclass 14 | # Must be of the following format: 15 | # { 16 | # 'key': ['value', 'description'] 17 | # } 18 | # Note that Extension.setConfig will raise a KeyError 19 | # if a default is not set here. 20 | config = {} 21 | 22 | def __init__(self, *args, **kwargs): 23 | """ Initiate Extension and set up configs. """ 24 | 25 | # check for configs arg for backward compat. 26 | # (there only ever used to be one so we use arg[0]) 27 | if len(args): 28 | self.setConfigs(args[0]) 29 | warnings.warn('Extension classes accepting positional args is pending Deprecation. ' 30 | 'Each setting should be passed into the Class as a keyword. Positional ' 31 | 'args will be deprecated in version 2.6 and raise an error in version ' 32 | '2.7. See the Release Notes for Python-Markdown version 2.5 for more info.', 33 | PendingDeprecationWarning) 34 | # check for configs kwarg for backward compat. 35 | if 'configs' in kwargs.keys(): 36 | self.setConfigs(kwargs.pop('configs', {})) 37 | warnings.warn('Extension classes accepting a dict on the single keyword "config" is ' 38 | 'pending Deprecation. Each setting should be passed into the Class as ' 39 | 'a keyword directly. The "config" keyword will be deprecated in version ' 40 | '2.6 and raise an error in version 2.7. See the Release Notes for ' 41 | 'Python-Markdown version 2.5 for more info.', 42 | PendingDeprecationWarning) 43 | # finally, use kwargs 44 | self.setConfigs(kwargs) 45 | 46 | 47 | def getConfig(self, key, default=''): 48 | """ Return a setting for the given key or an empty string. """ 49 | if key in self.config: 50 | return self.config[key][0] 51 | else: 52 | return default 53 | 54 | def getConfigs(self): 55 | """ Return all configs settings as a dict. """ 56 | return dict([(key, self.getConfig(key)) for key in self.config.keys()]) 57 | 58 | def getConfigInfo(self): 59 | """ Return all config descriptions as a list of tuples. """ 60 | return [(key, self.config[key][1]) for key in self.config.keys()] 61 | 62 | def setConfig(self, key, value): 63 | """ Set a config setting for `key` with the given `value`. """ 64 | if isinstance(self.config[key][0], bool): 65 | value = parseBoolValue(value) 66 | if self.config[key][0] is None: 67 | value = parseBoolValue(value, preserve_none=True) 68 | self.config[key][0] = value 69 | 70 | def setConfigs(self, items): 71 | """ Set multiple config settings given a dict or list of tuples. """ 72 | if hasattr(items, 'items'): 73 | # it's a dict 74 | items = items.items() 75 | for key, value in items: 76 | self.setConfig(key, value) 77 | 78 | def extendMarkdown(self, md, md_globals): 79 | """ 80 | Add the various proccesors and patterns to the Markdown Instance. 81 | 82 | This method must be overriden by every extension. 83 | 84 | Keyword arguments: 85 | 86 | * md: The Markdown instance. 87 | 88 | * md_globals: Global variables in the markdown module namespace. 89 | 90 | """ 91 | raise NotImplementedError('Extension "%s.%s" must define an "extendMarkdown"' \ 92 | 'method.' % (self.__class__.__module__, self.__class__.__name__)) 93 | 94 | -------------------------------------------------------------------------------- /site-packages/markdown/extensions/abbr.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Abbreviation Extension for Python-Markdown 3 | ========================================== 4 | 5 | This extension adds abbreviation handling to Python-Markdown. 6 | 7 | See 8 | for documentation. 9 | 10 | Oringinal code Copyright 2007-2008 [Waylan Limberg](http://achinghead.com/) and 11 | [Seemant Kulleen](http://www.kulleen.org/) 12 | 13 | All changes Copyright 2008-2014 The Python Markdown Project 14 | 15 | License: [BSD](http://www.opensource.org/licenses/bsd-license.php) 16 | 17 | ''' 18 | 19 | from __future__ import absolute_import 20 | from __future__ import unicode_literals 21 | from . import Extension 22 | from ..preprocessors import Preprocessor 23 | from ..inlinepatterns import Pattern 24 | from ..util import etree, AtomicString 25 | import re 26 | 27 | # Global Vars 28 | ABBR_REF_RE = re.compile(r'[*]\[(?P[^\]]*)\][ ]?:\s*(?P.*)') 29 | 30 | class AbbrExtension(Extension): 31 | """ Abbreviation Extension for Python-Markdown. """ 32 | 33 | def extendMarkdown(self, md, md_globals): 34 | """ Insert AbbrPreprocessor before ReferencePreprocessor. """ 35 | md.preprocessors.add('abbr', AbbrPreprocessor(md), '<reference') 36 | 37 | 38 | class AbbrPreprocessor(Preprocessor): 39 | """ Abbreviation Preprocessor - parse text for abbr references. """ 40 | 41 | def run(self, lines): 42 | ''' 43 | Find and remove all Abbreviation references from the text. 44 | Each reference is set as a new AbbrPattern in the markdown instance. 45 | 46 | ''' 47 | new_text = [] 48 | for line in lines: 49 | m = ABBR_REF_RE.match(line) 50 | if m: 51 | abbr = m.group('abbr').strip() 52 | title = m.group('title').strip() 53 | self.markdown.inlinePatterns['abbr-%s'%abbr] = \ 54 | AbbrPattern(self._generate_pattern(abbr), title) 55 | else: 56 | new_text.append(line) 57 | return new_text 58 | 59 | def _generate_pattern(self, text): 60 | ''' 61 | Given a string, returns an regex pattern to match that string. 62 | 63 | 'HTML' -> r'(?P<abbr>[H][T][M][L])' 64 | 65 | Note: we force each char as a literal match (in brackets) as we don't 66 | know what they will be beforehand. 67 | 68 | ''' 69 | chars = list(text) 70 | for i in range(len(chars)): 71 | chars[i] = r'[%s]' % chars[i] 72 | return r'(?P<abbr>\b%s\b)' % (r''.join(chars)) 73 | 74 | 75 | class AbbrPattern(Pattern): 76 | """ Abbreviation inline pattern. """ 77 | 78 | def __init__(self, pattern, title): 79 | super(AbbrPattern, self).__init__(pattern) 80 | self.title = title 81 | 82 | def handleMatch(self, m): 83 | abbr = etree.Element('abbr') 84 | abbr.text = AtomicString(m.group('abbr')) 85 | abbr.set('title', self.title) 86 | return abbr 87 | 88 | def makeExtension(*args, **kwargs): 89 | return AbbrExtension(*args, **kwargs) 90 | -------------------------------------------------------------------------------- /site-packages/markdown/extensions/admonition.py: -------------------------------------------------------------------------------- 1 | """ 2 | Admonition extension for Python-Markdown 3 | ======================================== 4 | 5 | Adds rST-style admonitions. Inspired by [rST][] feature with the same name. 6 | 7 | [rST]: http://docutils.sourceforge.net/docs/ref/rst/directives.html#specific-admonitions 8 | 9 | See <https://pythonhosted.org/Markdown/extensions/admonition.html> 10 | for documentation. 11 | 12 | Original code Copyright [Tiago Serafim](http://www.tiagoserafim.com/). 13 | 14 | All changes Copyright The Python Markdown Project 15 | 16 | License: [BSD](http://www.opensource.org/licenses/bsd-license.php) 17 | 18 | """ 19 | 20 | from __future__ import absolute_import 21 | from __future__ import unicode_literals 22 | from . import Extension 23 | from ..blockprocessors import BlockProcessor 24 | from ..util import etree 25 | import re 26 | 27 | 28 | class AdmonitionExtension(Extension): 29 | """ Admonition extension for Python-Markdown. """ 30 | 31 | def extendMarkdown(self, md, md_globals): 32 | """ Add Admonition to Markdown instance. """ 33 | md.registerExtension(self) 34 | 35 | md.parser.blockprocessors.add('admonition', 36 | AdmonitionProcessor(md.parser), 37 | '_begin') 38 | 39 | 40 | class AdmonitionProcessor(BlockProcessor): 41 | 42 | CLASSNAME = 'admonition' 43 | CLASSNAME_TITLE = 'admonition-title' 44 | RE = re.compile(r'(?:^|\n)!!!\ ?([\w\-]+)(?:\ "(.*?)")?') 45 | 46 | def test(self, parent, block): 47 | sibling = self.lastChild(parent) 48 | return self.RE.search(block) or \ 49 | (block.startswith(' ' * self.tab_length) and sibling and \ 50 | sibling.get('class', '').find(self.CLASSNAME) != -1) 51 | 52 | def run(self, parent, blocks): 53 | sibling = self.lastChild(parent) 54 | block = blocks.pop(0) 55 | m = self.RE.search(block) 56 | 57 | if m: 58 | block = block[m.end() + 1:] # removes the first line 59 | 60 | block, theRest = self.detab(block) 61 | 62 | if m: 63 | klass, title = self.get_class_and_title(m) 64 | div = etree.SubElement(parent, 'div') 65 | div.set('class', '%s %s' % (self.CLASSNAME, klass)) 66 | if title: 67 | p = etree.SubElement(div, 'p') 68 | p.text = title 69 | p.set('class', self.CLASSNAME_TITLE) 70 | else: 71 | div = sibling 72 | 73 | self.parser.parseChunk(div, block) 74 | 75 | if theRest: 76 | # This block contained unindented line(s) after the first indented 77 | # line. Insert these lines as the first block of the master blocks 78 | # list for future processing. 79 | blocks.insert(0, theRest) 80 | 81 | def get_class_and_title(self, match): 82 | klass, title = match.group(1).lower(), match.group(2) 83 | if title is None: 84 | # no title was provided, use the capitalized classname as title 85 | # e.g.: `!!! note` will render `<p class="admonition-title">Note</p>` 86 | title = klass.capitalize() 87 | elif title == '': 88 | # an explicit blank title should not be rendered 89 | # e.g.: `!!! warning ""` will *not* render `p` with a title 90 | title = None 91 | return klass, title 92 | 93 | 94 | def makeExtension(*args, **kwargs): 95 | return AdmonitionExtension(*args, **kwargs) 96 | 97 | -------------------------------------------------------------------------------- /site-packages/markdown/extensions/attr_list.py: -------------------------------------------------------------------------------- 1 | """ 2 | Attribute List Extension for Python-Markdown 3 | ============================================ 4 | 5 | Adds attribute list syntax. Inspired by 6 | [maruku](http://maruku.rubyforge.org/proposal.html#attribute_lists)'s 7 | feature of the same name. 8 | 9 | See <https://pythonhosted.org/Markdown/extensions/attr_list.html> 10 | for documentation. 11 | 12 | Original code Copyright 2011 [Waylan Limberg](http://achinghead.com/). 13 | 14 | All changes Copyright 2011-2014 The Python Markdown Project 15 | 16 | License: [BSD](http://www.opensource.org/licenses/bsd-license.php) 17 | 18 | """ 19 | 20 | from __future__ import absolute_import 21 | from __future__ import unicode_literals 22 | from . import Extension 23 | from ..treeprocessors import Treeprocessor 24 | from ..util import isBlockLevel 25 | import re 26 | 27 | try: 28 | Scanner = re.Scanner 29 | except AttributeError: #pragma: no cover 30 | # must be on Python 2.4 31 | from sre import Scanner 32 | 33 | def _handle_double_quote(s, t): 34 | k, v = t.split('=') 35 | return k, v.strip('"') 36 | 37 | def _handle_single_quote(s, t): 38 | k, v = t.split('=') 39 | return k, v.strip("'") 40 | 41 | def _handle_key_value(s, t): 42 | return t.split('=') 43 | 44 | def _handle_word(s, t): 45 | if t.startswith('.'): 46 | return '.', t[1:] 47 | if t.startswith('#'): 48 | return 'id', t[1:] 49 | return t, t 50 | 51 | _scanner = Scanner([ 52 | (r'[^ ]+=".*?"', _handle_double_quote), 53 | (r"[^ ]+='.*?'", _handle_single_quote), 54 | (r'[^ ]+=[^ ]*', _handle_key_value), 55 | (r'[^ ]+', _handle_word), 56 | (r' ', None) 57 | ]) 58 | 59 | def get_attrs(str): 60 | """ Parse attribute list and return a list of attribute tuples. """ 61 | return _scanner.scan(str)[0] 62 | 63 | def isheader(elem): 64 | return elem.tag in ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] 65 | 66 | class AttrListTreeprocessor(Treeprocessor): 67 | 68 | BASE_RE = r'\{\:?([^\}]*)\}' 69 | HEADER_RE = re.compile(r'[ ]+%s[ ]*$' % BASE_RE) 70 | BLOCK_RE = re.compile(r'\n[ ]*%s[ ]*$' % BASE_RE) 71 | INLINE_RE = re.compile(r'^%s' % BASE_RE) 72 | NAME_RE = re.compile(r'[^A-Z_a-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02ff\u0370-\u037d' 73 | r'\u037f-\u1fff\u200c-\u200d\u2070-\u218f\u2c00-\u2fef' 74 | r'\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd' 75 | r'\:\-\.0-9\u00b7\u0300-\u036f\u203f-\u2040]+') 76 | 77 | def run(self, doc): 78 | for elem in doc.getiterator(): 79 | if isBlockLevel(elem.tag): 80 | # Block level: check for attrs on last line of text 81 | RE = self.BLOCK_RE 82 | if isheader(elem) or elem.tag == 'dt': 83 | # header or def-term: check for attrs at end of line 84 | RE = self.HEADER_RE 85 | if len(elem) and elem.tag == 'li': 86 | # special case list items. children may include a ul or ol. 87 | pos = None 88 | # find the ul or ol position 89 | for i, child in enumerate(elem): 90 | if child.tag in ['ul', 'ol']: 91 | pos = i 92 | break 93 | if pos is None and elem[-1].tail: 94 | # use tail of last child. no ul or ol. 95 | m = RE.search(elem[-1].tail) 96 | if m: 97 | self.assign_attrs(elem, m.group(1)) 98 | elem[-1].tail = elem[-1].tail[:m.start()] 99 | elif pos is not None and pos > 0 and elem[pos-1].tail: 100 | # use tail of last child before ul or ol 101 | m = RE.search(elem[pos-1].tail) 102 | if m: 103 | self.assign_attrs(elem, m.group(1)) 104 | elem[pos-1].tail = elem[pos-1].tail[:m.start()] 105 | elif elem.text: 106 | # use text. ul is first child. 107 | m = RE.search(elem.text) 108 | if m: 109 | self.assign_attrs(elem, m.group(1)) 110 | elem.text = elem.text[:m.start()] 111 | elif len(elem) and elem[-1].tail: 112 | # has children. Get from tail of last child 113 | m = RE.search(elem[-1].tail) 114 | if m: 115 | self.assign_attrs(elem, m.group(1)) 116 | elem[-1].tail = elem[-1].tail[:m.start()] 117 | if isheader(elem): 118 | # clean up trailing #s 119 | elem[-1].tail = elem[-1].tail.rstrip('#').rstrip() 120 | elif elem.text: 121 | # no children. Get from text. 122 | m = RE.search(elem.text) 123 | if not m and elem.tag == 'td': 124 | m = re.search(self.BASE_RE, elem.text) 125 | if m: 126 | self.assign_attrs(elem, m.group(1)) 127 | elem.text = elem.text[:m.start()] 128 | if isheader(elem): 129 | # clean up trailing #s 130 | elem.text = elem.text.rstrip('#').rstrip() 131 | else: 132 | # inline: check for attrs at start of tail 133 | if elem.tail: 134 | m = self.INLINE_RE.match(elem.tail) 135 | if m: 136 | self.assign_attrs(elem, m.group(1)) 137 | elem.tail = elem.tail[m.end():] 138 | 139 | def assign_attrs(self, elem, attrs): 140 | """ Assign attrs to element. """ 141 | for k, v in get_attrs(attrs): 142 | if k == '.': 143 | # add to class 144 | cls = elem.get('class') 145 | if cls: 146 | elem.set('class', '%s %s' % (cls, v)) 147 | else: 148 | elem.set('class', v) 149 | else: 150 | # assign attr k with v 151 | elem.set(self.sanitize_name(k), v) 152 | 153 | def sanitize_name(self, name): 154 | """ 155 | Sanitize name as 'an XML Name, minus the ":"'. 156 | See http://www.w3.org/TR/REC-xml-names/#NT-NCName 157 | """ 158 | return self.NAME_RE.sub('_', name) 159 | 160 | 161 | class AttrListExtension(Extension): 162 | def extendMarkdown(self, md, md_globals): 163 | md.treeprocessors.add('attr_list', AttrListTreeprocessor(md), '>prettify') 164 | 165 | 166 | def makeExtension(*args, **kwargs): 167 | return AttrListExtension(*args, **kwargs) 168 | -------------------------------------------------------------------------------- /site-packages/markdown/extensions/def_list.py: -------------------------------------------------------------------------------- 1 | """ 2 | Definition List Extension for Python-Markdown 3 | ============================================= 4 | 5 | Adds parsing of Definition Lists to Python-Markdown. 6 | 7 | See <https://pythonhosted.org/Markdown/extensions/definition_lists.html> 8 | for documentation. 9 | 10 | Original code Copyright 2008 [Waylan Limberg](http://achinghead.com) 11 | 12 | All changes Copyright 2008-2014 The Python Markdown Project 13 | 14 | License: [BSD](http://www.opensource.org/licenses/bsd-license.php) 15 | 16 | """ 17 | 18 | from __future__ import absolute_import 19 | from __future__ import unicode_literals 20 | from . import Extension 21 | from ..blockprocessors import BlockProcessor, ListIndentProcessor 22 | from ..util import etree 23 | import re 24 | 25 | 26 | class DefListProcessor(BlockProcessor): 27 | """ Process Definition Lists. """ 28 | 29 | RE = re.compile(r'(^|\n)[ ]{0,3}:[ ]{1,3}(.*?)(\n|$)') 30 | NO_INDENT_RE = re.compile(r'^[ ]{0,3}[^ :]') 31 | 32 | def test(self, parent, block): 33 | return bool(self.RE.search(block)) 34 | 35 | def run(self, parent, blocks): 36 | 37 | raw_block = blocks.pop(0) 38 | m = self.RE.search(raw_block) 39 | terms = [l.strip() for l in raw_block[:m.start()].split('\n') if l.strip()] 40 | block = raw_block[m.end():] 41 | no_indent = self.NO_INDENT_RE.match(block) 42 | if no_indent: 43 | d, theRest = (block, None) 44 | else: 45 | d, theRest = self.detab(block) 46 | if d: 47 | d = '%s\n%s' % (m.group(2), d) 48 | else: 49 | d = m.group(2) 50 | sibling = self.lastChild(parent) 51 | if not terms and sibling is None: 52 | # This is not a definition item. Most likely a paragraph that 53 | # starts with a colon at the begining of a document or list. 54 | blocks.insert(0, raw_block) 55 | return False 56 | if not terms and sibling.tag == 'p': 57 | # The previous paragraph contains the terms 58 | state = 'looselist' 59 | terms = sibling.text.split('\n') 60 | parent.remove(sibling) 61 | # Aquire new sibling 62 | sibling = self.lastChild(parent) 63 | else: 64 | state = 'list' 65 | 66 | if sibling and sibling.tag == 'dl': 67 | # This is another item on an existing list 68 | dl = sibling 69 | if not terms and len(dl) and dl[-1].tag == 'dd' and len(dl[-1]): 70 | state = 'looselist' 71 | else: 72 | # This is a new list 73 | dl = etree.SubElement(parent, 'dl') 74 | # Add terms 75 | for term in terms: 76 | dt = etree.SubElement(dl, 'dt') 77 | dt.text = term 78 | # Add definition 79 | self.parser.state.set(state) 80 | dd = etree.SubElement(dl, 'dd') 81 | self.parser.parseBlocks(dd, [d]) 82 | self.parser.state.reset() 83 | 84 | if theRest: 85 | blocks.insert(0, theRest) 86 | 87 | class DefListIndentProcessor(ListIndentProcessor): 88 | """ Process indented children of definition list items. """ 89 | 90 | ITEM_TYPES = ['dd'] 91 | LIST_TYPES = ['dl'] 92 | 93 | def create_item(self, parent, block): 94 | """ Create a new dd and parse the block with it as the parent. """ 95 | dd = etree.SubElement(parent, 'dd') 96 | self.parser.parseBlocks(dd, [block]) 97 | 98 | 99 | 100 | class DefListExtension(Extension): 101 | """ Add definition lists to Markdown. """ 102 | 103 | def extendMarkdown(self, md, md_globals): 104 | """ Add an instance of DefListProcessor to BlockParser. """ 105 | md.parser.blockprocessors.add('defindent', 106 | DefListIndentProcessor(md.parser), 107 | '>indent') 108 | md.parser.blockprocessors.add('deflist', 109 | DefListProcessor(md.parser), 110 | '>ulist') 111 | 112 | 113 | def makeExtension(*args, **kwargs): 114 | return DefListExtension(*args, **kwargs) 115 | 116 | -------------------------------------------------------------------------------- /site-packages/markdown/extensions/extra.py: -------------------------------------------------------------------------------- 1 | """ 2 | Python-Markdown Extra Extension 3 | =============================== 4 | 5 | A compilation of various Python-Markdown extensions that imitates 6 | [PHP Markdown Extra](http://michelf.com/projects/php-markdown/extra/). 7 | 8 | Note that each of the individual extensions still need to be available 9 | on your PYTHONPATH. This extension simply wraps them all up as a 10 | convenience so that only one extension needs to be listed when 11 | initiating Markdown. See the documentation for each individual 12 | extension for specifics about that extension. 13 | 14 | There may be additional extensions that are distributed with 15 | Python-Markdown that are not included here in Extra. Those extensions 16 | are not part of PHP Markdown Extra, and therefore, not part of 17 | Python-Markdown Extra. If you really would like Extra to include 18 | additional extensions, we suggest creating your own clone of Extra 19 | under a differant name. You could also edit the `extensions` global 20 | variable defined below, but be aware that such changes may be lost 21 | when you upgrade to any future version of Python-Markdown. 22 | 23 | See <https://pythonhosted.org/Markdown/extensions/extra.html> 24 | for documentation. 25 | 26 | Copyright The Python Markdown Project 27 | 28 | License: [BSD](http://www.opensource.org/licenses/bsd-license.php) 29 | 30 | """ 31 | 32 | from __future__ import absolute_import 33 | from __future__ import unicode_literals 34 | from . import Extension 35 | from ..blockprocessors import BlockProcessor 36 | from .. import util 37 | import re 38 | 39 | extensions = [ 40 | 'markdown.extensions.smart_strong', 41 | 'markdown.extensions.fenced_code', 42 | 'markdown.extensions.footnotes', 43 | 'markdown.extensions.attr_list', 44 | 'markdown.extensions.def_list', 45 | 'markdown.extensions.tables', 46 | 'markdown.extensions.abbr' 47 | ] 48 | 49 | 50 | class ExtraExtension(Extension): 51 | """ Add various extensions to Markdown class.""" 52 | 53 | def __init__(self, *args, **kwargs): 54 | """ config is just a dumb holder which gets passed to actual ext later. """ 55 | self.config = kwargs.pop('configs', {}) 56 | self.config.update(kwargs) 57 | 58 | def extendMarkdown(self, md, md_globals): 59 | """ Register extension instances. """ 60 | md.registerExtensions(extensions, self.config) 61 | if not md.safeMode: 62 | # Turn on processing of markdown text within raw html 63 | md.preprocessors['html_block'].markdown_in_raw = True 64 | md.parser.blockprocessors.add('markdown_block', 65 | MarkdownInHtmlProcessor(md.parser), 66 | '_begin') 67 | md.parser.blockprocessors.tag_counter = -1 68 | md.parser.blockprocessors.contain_span_tags = re.compile( 69 | r'^(p|h[1-6]|li|dd|dt|td|th|legend|address)$', re.IGNORECASE) 70 | 71 | 72 | def makeExtension(*args, **kwargs): 73 | return ExtraExtension(*args, **kwargs) 74 | 75 | 76 | class MarkdownInHtmlProcessor(BlockProcessor): 77 | """Process Markdown Inside HTML Blocks.""" 78 | def test(self, parent, block): 79 | return block == util.TAG_PLACEHOLDER % \ 80 | str(self.parser.blockprocessors.tag_counter + 1) 81 | 82 | def _process_nests(self, element, block): 83 | """Process the element's child elements in self.run.""" 84 | # Build list of indexes of each nest within the parent element. 85 | nest_index = [] # a list of tuples: (left index, right index) 86 | i = self.parser.blockprocessors.tag_counter + 1 87 | while len(self._tag_data) > i and self._tag_data[i]['left_index']: 88 | left_child_index = self._tag_data[i]['left_index'] 89 | right_child_index = self._tag_data[i]['right_index'] 90 | nest_index.append((left_child_index - 1, right_child_index)) 91 | i += 1 92 | 93 | # Create each nest subelement. 94 | for i, (left_index, right_index) in enumerate(nest_index[:-1]): 95 | self.run(element, block[left_index:right_index], 96 | block[right_index:nest_index[i + 1][0]], True) 97 | self.run(element, block[nest_index[-1][0]:nest_index[-1][1]], # last 98 | block[nest_index[-1][1]:], True) # nest 99 | 100 | def run(self, parent, blocks, tail=None, nest=False): 101 | self._tag_data = self.parser.markdown.htmlStash.tag_data 102 | 103 | self.parser.blockprocessors.tag_counter += 1 104 | tag = self._tag_data[self.parser.blockprocessors.tag_counter] 105 | 106 | # Create Element 107 | markdown_value = tag['attrs'].pop('markdown') 108 | element = util.etree.SubElement(parent, tag['tag'], tag['attrs']) 109 | 110 | # Slice Off Block 111 | if nest: 112 | self.parser.parseBlocks(parent, tail) # Process Tail 113 | block = blocks[1:] 114 | else: # includes nests since a third level of nesting isn't supported 115 | block = blocks[tag['left_index'] + 1: tag['right_index']] 116 | del blocks[:tag['right_index']] 117 | 118 | # Process Text 119 | if (self.parser.blockprocessors.contain_span_tags.match( # Span Mode 120 | tag['tag']) and markdown_value != 'block') or \ 121 | markdown_value == 'span': 122 | element.text = '\n'.join(block) 123 | else: # Block Mode 124 | i = self.parser.blockprocessors.tag_counter + 1 125 | if len(self._tag_data) > i and self._tag_data[i]['left_index']: 126 | first_subelement_index = self._tag_data[i]['left_index'] - 1 127 | self.parser.parseBlocks( 128 | element, block[:first_subelement_index]) 129 | if not nest: 130 | block = self._process_nests(element, block) 131 | else: 132 | self.parser.parseBlocks(element, block) 133 | -------------------------------------------------------------------------------- /site-packages/markdown/extensions/fenced_code.py: -------------------------------------------------------------------------------- 1 | """ 2 | Fenced Code Extension for Python Markdown 3 | ========================================= 4 | 5 | This extension adds Fenced Code Blocks to Python-Markdown. 6 | 7 | See <https://pythonhosted.org/Markdown/extensions/fenced_code_blocks.html> 8 | for documentation. 9 | 10 | Original code Copyright 2007-2008 [Waylan Limberg](http://achinghead.com/). 11 | 12 | 13 | All changes Copyright 2008-2014 The Python Markdown Project 14 | 15 | License: [BSD](http://www.opensource.org/licenses/bsd-license.php) 16 | """ 17 | 18 | from __future__ import absolute_import 19 | from __future__ import unicode_literals 20 | from . import Extension 21 | from ..preprocessors import Preprocessor 22 | from .codehilite import CodeHilite, CodeHiliteExtension, parse_hl_lines 23 | import re 24 | 25 | 26 | class FencedCodeExtension(Extension): 27 | 28 | def extendMarkdown(self, md, md_globals): 29 | """ Add FencedBlockPreprocessor to the Markdown instance. """ 30 | md.registerExtension(self) 31 | 32 | md.preprocessors.add('fenced_code_block', 33 | FencedBlockPreprocessor(md), 34 | ">normalize_whitespace") 35 | 36 | 37 | class FencedBlockPreprocessor(Preprocessor): 38 | FENCED_BLOCK_RE = re.compile(r''' 39 | (?P<fence>^(?:~{3,}|`{3,}))[ ]* # Opening ``` or ~~~ 40 | (\{?\.?(?P<lang>[a-zA-Z0-9_+-]*))?[ ]* # Optional {, and lang 41 | # Optional highlight lines, single- or double-quote-delimited 42 | (hl_lines=(?P<quot>"|')(?P<hl_lines>.*?)(?P=quot))?[ ]* 43 | }?[ ]*\n # Optional closing } 44 | (?P<code>.*?)(?<=\n) 45 | (?P=fence)[ ]*$''', re.MULTILINE | re.DOTALL | re.VERBOSE) 46 | CODE_WRAP = '<pre><code%s>%s</code></pre>' 47 | LANG_TAG = ' class="%s"' 48 | 49 | def __init__(self, md): 50 | super(FencedBlockPreprocessor, self).__init__(md) 51 | 52 | self.checked_for_codehilite = False 53 | self.codehilite_conf = {} 54 | 55 | def run(self, lines): 56 | """ Match and store Fenced Code Blocks in the HtmlStash. """ 57 | 58 | # Check for code hilite extension 59 | if not self.checked_for_codehilite: 60 | for ext in self.markdown.registeredExtensions: 61 | if isinstance(ext, CodeHiliteExtension): 62 | self.codehilite_conf = ext.config 63 | break 64 | 65 | self.checked_for_codehilite = True 66 | 67 | text = "\n".join(lines) 68 | while 1: 69 | m = self.FENCED_BLOCK_RE.search(text) 70 | if m: 71 | lang = '' 72 | if m.group('lang'): 73 | lang = self.LANG_TAG % m.group('lang') 74 | 75 | # If config is not empty, then the codehighlite extension 76 | # is enabled, so we call it to highlight the code 77 | if self.codehilite_conf: 78 | highliter = CodeHilite(m.group('code'), 79 | linenums=self.codehilite_conf['linenums'][0], 80 | guess_lang=self.codehilite_conf['guess_lang'][0], 81 | css_class=self.codehilite_conf['css_class'][0], 82 | style=self.codehilite_conf['pygments_style'][0], 83 | lang=(m.group('lang') or None), 84 | noclasses=self.codehilite_conf['noclasses'][0], 85 | hl_lines=parse_hl_lines(m.group('hl_lines'))) 86 | 87 | code = highliter.hilite() 88 | else: 89 | code = self.CODE_WRAP % (lang, self._escape(m.group('code'))) 90 | 91 | placeholder = self.markdown.htmlStash.store(code, safe=True) 92 | text = '%s\n%s\n%s'% (text[:m.start()], placeholder, text[m.end():]) 93 | else: 94 | break 95 | return text.split("\n") 96 | 97 | def _escape(self, txt): 98 | """ basic html escaping """ 99 | txt = txt.replace('&', '&') 100 | txt = txt.replace('<', '<') 101 | txt = txt.replace('>', '>') 102 | txt = txt.replace('"', '"') 103 | return txt 104 | 105 | 106 | def makeExtension(*args, **kwargs): 107 | return FencedCodeExtension(*args, **kwargs) 108 | 109 | -------------------------------------------------------------------------------- /site-packages/markdown/extensions/headerid.py: -------------------------------------------------------------------------------- 1 | """ 2 | HeaderID Extension for Python-Markdown 3 | ====================================== 4 | 5 | Auto-generate id attributes for HTML headers. 6 | 7 | See <https://pythonhosted.org/Markdown/extensions/header_id.html> 8 | for documentation. 9 | 10 | Original code Copyright 2007-2011 [Waylan Limberg](http://achinghead.com/). 11 | 12 | All changes Copyright 2011-2014 The Python Markdown Project 13 | 14 | License: [BSD](http://www.opensource.org/licenses/bsd-license.php) 15 | 16 | """ 17 | 18 | from __future__ import absolute_import 19 | from __future__ import unicode_literals 20 | from . import Extension 21 | from ..treeprocessors import Treeprocessor 22 | from ..util import HTML_PLACEHOLDER_RE, parseBoolValue 23 | import re 24 | import logging 25 | import unicodedata 26 | 27 | logger = logging.getLogger('MARKDOWN') 28 | 29 | IDCOUNT_RE = re.compile(r'^(.*)_([0-9]+)$') 30 | 31 | 32 | def slugify(value, separator): 33 | """ Slugify a string, to make it URL friendly. """ 34 | value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore') 35 | value = re.sub('[^\w\s-]', '', value.decode('ascii')).strip().lower() 36 | return re.sub('[%s\s]+' % separator, separator, value) 37 | 38 | 39 | def unique(id, ids): 40 | """ Ensure id is unique in set of ids. Append '_1', '_2'... if not """ 41 | while id in ids or not id: 42 | m = IDCOUNT_RE.match(id) 43 | if m: 44 | id = '%s_%d'% (m.group(1), int(m.group(2))+1) 45 | else: 46 | id = '%s_%d'% (id, 1) 47 | ids.add(id) 48 | return id 49 | 50 | 51 | def itertext(elem): 52 | """ Loop through all children and return text only. 53 | 54 | Reimplements method of same name added to ElementTree in Python 2.7 55 | 56 | """ 57 | if elem.text: 58 | yield elem.text 59 | for e in elem: 60 | for s in itertext(e): 61 | yield s 62 | if e.tail: 63 | yield e.tail 64 | 65 | 66 | def stashedHTML2text(text, md): 67 | """ Extract raw HTML, reduce to plain text and swap with placeholder. """ 68 | def _html_sub(m): 69 | """ Substitute raw html with plain text. """ 70 | try: 71 | raw, safe = md.htmlStash.rawHtmlBlocks[int(m.group(1))] 72 | except (IndexError, TypeError): 73 | return m.group(0) 74 | if md.safeMode and not safe: 75 | return '' 76 | # Strip out tags and entities - leaveing text 77 | return re.sub(r'(<[^>]+>)|(&[\#a-zA-Z0-9]+;)', '', raw) 78 | 79 | return HTML_PLACEHOLDER_RE.sub(_html_sub, text) 80 | 81 | 82 | class HeaderIdTreeprocessor(Treeprocessor): 83 | """ Assign IDs to headers. """ 84 | 85 | IDs = set() 86 | 87 | def run(self, doc): 88 | start_level, force_id = self._get_meta() 89 | slugify = self.config['slugify'] 90 | sep = self.config['separator'] 91 | for elem in doc.getiterator(): 92 | if elem.tag in ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']: 93 | if force_id: 94 | if "id" in elem.attrib: 95 | id = elem.get('id') 96 | else: 97 | id = stashedHTML2text(''.join(itertext(elem)), self.md) 98 | id = slugify(id, sep) 99 | elem.set('id', unique(id, self.IDs)) 100 | if start_level: 101 | level = int(elem.tag[-1]) + start_level 102 | if level > 6: 103 | level = 6 104 | elem.tag = 'h%d' % level 105 | 106 | 107 | def _get_meta(self): 108 | """ Return meta data suported by this ext as a tuple """ 109 | level = int(self.config['level']) - 1 110 | force = parseBoolValue(self.config['forceid']) 111 | if hasattr(self.md, 'Meta'): 112 | if 'header_level' in self.md.Meta: 113 | level = int(self.md.Meta['header_level'][0]) - 1 114 | if 'header_forceid' in self.md.Meta: 115 | force = parseBoolValue(self.md.Meta['header_forceid'][0]) 116 | return level, force 117 | 118 | 119 | class HeaderIdExtension(Extension): 120 | def __init__(self, *args, **kwargs): 121 | # set defaults 122 | self.config = { 123 | 'level' : ['1', 'Base level for headers.'], 124 | 'forceid' : ['True', 'Force all headers to have an id.'], 125 | 'separator' : ['-', 'Word separator.'], 126 | 'slugify' : [slugify, 'Callable to generate anchors'], 127 | } 128 | 129 | super(HeaderIdExtension, self).__init__(*args, **kwargs) 130 | 131 | def extendMarkdown(self, md, md_globals): 132 | md.registerExtension(self) 133 | self.processor = HeaderIdTreeprocessor() 134 | self.processor.md = md 135 | self.processor.config = self.getConfigs() 136 | if 'attr_list' in md.treeprocessors.keys(): 137 | # insert after attr_list treeprocessor 138 | md.treeprocessors.add('headerid', self.processor, '>attr_list') 139 | else: 140 | # insert after 'prettify' treeprocessor. 141 | md.treeprocessors.add('headerid', self.processor, '>prettify') 142 | 143 | def reset(self): 144 | self.processor.IDs = set() 145 | 146 | 147 | def makeExtension(*args, **kwargs): 148 | return HeaderIdExtension(*args, **kwargs) 149 | 150 | -------------------------------------------------------------------------------- /site-packages/markdown/extensions/meta.py: -------------------------------------------------------------------------------- 1 | """ 2 | Meta Data Extension for Python-Markdown 3 | ======================================= 4 | 5 | This extension adds Meta Data handling to markdown. 6 | 7 | See <https://pythonhosted.org/Markdown/extensions/meta_data.html> 8 | for documentation. 9 | 10 | Original code Copyright 2007-2008 [Waylan Limberg](http://achinghead.com). 11 | 12 | All changes Copyright 2008-2014 The Python Markdown Project 13 | 14 | License: [BSD](http://www.opensource.org/licenses/bsd-license.php) 15 | 16 | """ 17 | 18 | from __future__ import absolute_import 19 | from __future__ import unicode_literals 20 | from . import Extension 21 | from ..preprocessors import Preprocessor 22 | import re 23 | 24 | # Global Vars 25 | META_RE = re.compile(r'^[ ]{0,3}(?P<key>[A-Za-z0-9_-]+):\s*(?P<value>.*)') 26 | META_MORE_RE = re.compile(r'^[ ]{4,}(?P<value>.*)') 27 | 28 | class MetaExtension (Extension): 29 | """ Meta-Data extension for Python-Markdown. """ 30 | 31 | def extendMarkdown(self, md, md_globals): 32 | """ Add MetaPreprocessor to Markdown instance. """ 33 | 34 | md.preprocessors.add("meta", MetaPreprocessor(md), "_begin") 35 | 36 | 37 | class MetaPreprocessor(Preprocessor): 38 | """ Get Meta-Data. """ 39 | 40 | def run(self, lines): 41 | """ Parse Meta-Data and store in Markdown.Meta. """ 42 | meta = {} 43 | key = None 44 | while lines: 45 | line = lines.pop(0) 46 | if line.strip() == '': 47 | break # blank line - done 48 | m1 = META_RE.match(line) 49 | if m1: 50 | key = m1.group('key').lower().strip() 51 | value = m1.group('value').strip() 52 | try: 53 | meta[key].append(value) 54 | except KeyError: 55 | meta[key] = [value] 56 | else: 57 | m2 = META_MORE_RE.match(line) 58 | if m2 and key: 59 | # Add another line to existing key 60 | meta[key].append(m2.group('value').strip()) 61 | else: 62 | lines.insert(0, line) 63 | break # no meta data - done 64 | self.markdown.Meta = meta 65 | return lines 66 | 67 | 68 | def makeExtension(*args, **kwargs): 69 | return MetaExtension(*args, **kwargs) 70 | 71 | -------------------------------------------------------------------------------- /site-packages/markdown/extensions/nl2br.py: -------------------------------------------------------------------------------- 1 | """ 2 | NL2BR Extension 3 | =============== 4 | 5 | A Python-Markdown extension to treat newlines as hard breaks; like 6 | GitHub-flavored Markdown does. 7 | 8 | See <https://pythonhosted.org/Markdown/extensions/nl2br.html> 9 | for documentation. 10 | 11 | Oringinal code Copyright 2011 [Brian Neal](http://deathofagremmie.com/) 12 | 13 | All changes Copyright 2011-2014 The Python Markdown Project 14 | 15 | License: [BSD](http://www.opensource.org/licenses/bsd-license.php) 16 | 17 | """ 18 | 19 | from __future__ import absolute_import 20 | from __future__ import unicode_literals 21 | from . import Extension 22 | from ..inlinepatterns import SubstituteTagPattern 23 | 24 | BR_RE = r'\n' 25 | 26 | class Nl2BrExtension(Extension): 27 | 28 | def extendMarkdown(self, md, md_globals): 29 | br_tag = SubstituteTagPattern(BR_RE, 'br') 30 | md.inlinePatterns.add('nl', br_tag, '_end') 31 | 32 | 33 | def makeExtension(*args, **kwargs): 34 | return Nl2BrExtension(*args, **kwargs) 35 | 36 | -------------------------------------------------------------------------------- /site-packages/markdown/extensions/sane_lists.py: -------------------------------------------------------------------------------- 1 | """ 2 | Sane List Extension for Python-Markdown 3 | ======================================= 4 | 5 | Modify the behavior of Lists in Python-Markdown to act in a sane manor. 6 | 7 | See <https://pythonhosted.org/Markdown/extensions/sane_lists.html> 8 | for documentation. 9 | 10 | Original code Copyright 2011 [Waylan Limberg](http://achinghead.com) 11 | 12 | All changes Copyright 2011-2014 The Python Markdown Project 13 | 14 | License: [BSD](http://www.opensource.org/licenses/bsd-license.php) 15 | 16 | """ 17 | 18 | from __future__ import absolute_import 19 | from __future__ import unicode_literals 20 | from . import Extension 21 | from ..blockprocessors import OListProcessor, UListProcessor 22 | import re 23 | 24 | 25 | class SaneOListProcessor(OListProcessor): 26 | 27 | CHILD_RE = re.compile(r'^[ ]{0,3}((\d+\.))[ ]+(.*)') 28 | SIBLING_TAGS = ['ol'] 29 | 30 | 31 | class SaneUListProcessor(UListProcessor): 32 | 33 | CHILD_RE = re.compile(r'^[ ]{0,3}(([*+-]))[ ]+(.*)') 34 | SIBLING_TAGS = ['ul'] 35 | 36 | 37 | class SaneListExtension(Extension): 38 | """ Add sane lists to Markdown. """ 39 | 40 | def extendMarkdown(self, md, md_globals): 41 | """ Override existing Processors. """ 42 | md.parser.blockprocessors['olist'] = SaneOListProcessor(md.parser) 43 | md.parser.blockprocessors['ulist'] = SaneUListProcessor(md.parser) 44 | 45 | 46 | def makeExtension(*args, **kwargs): 47 | return SaneListExtension(*args, **kwargs) 48 | 49 | -------------------------------------------------------------------------------- /site-packages/markdown/extensions/smart_strong.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Smart_Strong Extension for Python-Markdown 3 | ========================================== 4 | 5 | This extention adds smarter handling of double underscores within words. 6 | 7 | See <https://pythonhosted.org/Markdown/extensions/smart_strong.html> 8 | for documentation. 9 | 10 | Original code Copyright 2011 [Waylan Limberg](http://achinghead.com) 11 | 12 | All changes Copyright 2011-2014 The Python Markdown Project 13 | 14 | License: [BSD](http://www.opensource.org/licenses/bsd-license.php) 15 | 16 | ''' 17 | 18 | from __future__ import absolute_import 19 | from __future__ import unicode_literals 20 | from . import Extension 21 | from ..inlinepatterns import SimpleTagPattern 22 | 23 | SMART_STRONG_RE = r'(?<!\w)(_{2})(?!_)(.+?)(?<!_)\2(?!\w)' 24 | STRONG_RE = r'(\*{2})(.+?)\2' 25 | 26 | class SmartEmphasisExtension(Extension): 27 | """ Add smart_emphasis extension to Markdown class.""" 28 | 29 | def extendMarkdown(self, md, md_globals): 30 | """ Modify inline patterns. """ 31 | md.inlinePatterns['strong'] = SimpleTagPattern(STRONG_RE, 'strong') 32 | md.inlinePatterns.add('strong2', SimpleTagPattern(SMART_STRONG_RE, 'strong'), '>emphasis2') 33 | 34 | def makeExtension(*args, **kwargs): 35 | return SmartEmphasisExtension(*args, **kwargs) 36 | -------------------------------------------------------------------------------- /site-packages/markdown/extensions/tables.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tables Extension for Python-Markdown 3 | ==================================== 4 | 5 | Added parsing of tables to Python-Markdown. 6 | 7 | See <https://pythonhosted.org/Markdown/extensions/tables.html> 8 | for documentation. 9 | 10 | Original code Copyright 2009 [Waylan Limberg](http://achinghead.com) 11 | 12 | All changes Copyright 2008-2014 The Python Markdown Project 13 | 14 | License: [BSD](http://www.opensource.org/licenses/bsd-license.php) 15 | 16 | """ 17 | 18 | from __future__ import absolute_import 19 | from __future__ import unicode_literals 20 | from . import Extension 21 | from ..blockprocessors import BlockProcessor 22 | from ..util import etree 23 | 24 | class TableProcessor(BlockProcessor): 25 | """ Process Tables. """ 26 | 27 | def test(self, parent, block): 28 | rows = block.split('\n') 29 | return (len(rows) > 2 and '|' in rows[0] and 30 | '|' in rows[1] and '-' in rows[1] and 31 | rows[1].strip()[0] in ['|', ':', '-']) 32 | 33 | def run(self, parent, blocks): 34 | """ Parse a table block and build table. """ 35 | block = blocks.pop(0).split('\n') 36 | header = block[0].strip() 37 | seperator = block[1].strip() 38 | rows = block[2:] 39 | # Get format type (bordered by pipes or not) 40 | border = False 41 | if header.startswith('|'): 42 | border = True 43 | # Get alignment of columns 44 | align = [] 45 | for c in self._split_row(seperator, border): 46 | if c.startswith(':') and c.endswith(':'): 47 | align.append('center') 48 | elif c.startswith(':'): 49 | align.append('left') 50 | elif c.endswith(':'): 51 | align.append('right') 52 | else: 53 | align.append(None) 54 | # Build table 55 | table = etree.SubElement(parent, 'table') 56 | thead = etree.SubElement(table, 'thead') 57 | self._build_row(header, thead, align, border) 58 | tbody = etree.SubElement(table, 'tbody') 59 | for row in rows: 60 | self._build_row(row.strip(), tbody, align, border) 61 | 62 | def _build_row(self, row, parent, align, border): 63 | """ Given a row of text, build table cells. """ 64 | tr = etree.SubElement(parent, 'tr') 65 | tag = 'td' 66 | if parent.tag == 'thead': 67 | tag = 'th' 68 | cells = self._split_row(row, border) 69 | # We use align here rather than cells to ensure every row 70 | # contains the same number of columns. 71 | for i, a in enumerate(align): 72 | c = etree.SubElement(tr, tag) 73 | try: 74 | c.text = cells[i].strip() 75 | except IndexError: #pragma: no cover 76 | c.text = "" 77 | if a: 78 | c.set('align', a) 79 | 80 | def _split_row(self, row, border): 81 | """ split a row of text into list of cells. """ 82 | if border: 83 | if row.startswith('|'): 84 | row = row[1:] 85 | if row.endswith('|'): 86 | row = row[:-1] 87 | return row.split('|') 88 | 89 | 90 | class TableExtension(Extension): 91 | """ Add tables to Markdown. """ 92 | 93 | def extendMarkdown(self, md, md_globals): 94 | """ Add an instance of TableProcessor to BlockParser. """ 95 | md.parser.blockprocessors.add('table', 96 | TableProcessor(md.parser), 97 | '<hashheader') 98 | 99 | 100 | def makeExtension(*args, **kwargs): 101 | return TableExtension(*args, **kwargs) 102 | 103 | -------------------------------------------------------------------------------- /site-packages/markdown/extensions/wikilinks.py: -------------------------------------------------------------------------------- 1 | ''' 2 | WikiLinks Extension for Python-Markdown 3 | ====================================== 4 | 5 | Converts [[WikiLinks]] to relative links. 6 | 7 | See <https://pythonhosted.org/Markdown/extensions/wikilinks.html> 8 | for documentation. 9 | 10 | Original code Copyright [Waylan Limberg](http://achinghead.com/). 11 | 12 | All changes Copyright The Python Markdown Project 13 | 14 | License: [BSD](http://www.opensource.org/licenses/bsd-license.php) 15 | 16 | ''' 17 | 18 | from __future__ import absolute_import 19 | from __future__ import unicode_literals 20 | from . import Extension 21 | from ..inlinepatterns import Pattern 22 | from ..util import etree 23 | import re 24 | 25 | def build_url(label, base, end): 26 | """ Build a url from the label, a base, and an end. """ 27 | clean_label = re.sub(r'([ ]+_)|(_[ ]+)|([ ]+)', '_', label) 28 | return '%s%s%s'% (base, clean_label, end) 29 | 30 | 31 | class WikiLinkExtension(Extension): 32 | 33 | def __init__ (self, *args, **kwargs): 34 | self.config = { 35 | 'base_url' : ['/', 'String to append to beginning or URL.'], 36 | 'end_url' : ['/', 'String to append to end of URL.'], 37 | 'html_class' : ['wikilink', 'CSS hook. Leave blank for none.'], 38 | 'build_url' : [build_url, 'Callable formats URL from label.'], 39 | } 40 | 41 | super(WikiLinkExtension, self).__init__(*args, **kwargs) 42 | 43 | def extendMarkdown(self, md, md_globals): 44 | self.md = md 45 | 46 | # append to end of inline patterns 47 | WIKILINK_RE = r'\[\[([\w0-9_ -]+)\]\]' 48 | wikilinkPattern = WikiLinks(WIKILINK_RE, self.getConfigs()) 49 | wikilinkPattern.md = md 50 | md.inlinePatterns.add('wikilink', wikilinkPattern, "<not_strong") 51 | 52 | 53 | class WikiLinks(Pattern): 54 | def __init__(self, pattern, config): 55 | super(WikiLinks, self).__init__(pattern) 56 | self.config = config 57 | 58 | def handleMatch(self, m): 59 | if m.group(2).strip(): 60 | base_url, end_url, html_class = self._getMeta() 61 | label = m.group(2).strip() 62 | url = self.config['build_url'](label, base_url, end_url) 63 | a = etree.Element('a') 64 | a.text = label 65 | a.set('href', url) 66 | if html_class: 67 | a.set('class', html_class) 68 | else: 69 | a = '' 70 | return a 71 | 72 | def _getMeta(self): 73 | """ Return meta data or config data. """ 74 | base_url = self.config['base_url'] 75 | end_url = self.config['end_url'] 76 | html_class = self.config['html_class'] 77 | if hasattr(self.md, 'Meta'): 78 | if 'wiki_base_url' in self.md.Meta: 79 | base_url = self.md.Meta['wiki_base_url'][0] 80 | if 'wiki_end_url' in self.md.Meta: 81 | end_url = self.md.Meta['wiki_end_url'][0] 82 | if 'wiki_html_class' in self.md.Meta: 83 | html_class = self.md.Meta['wiki_html_class'][0] 84 | return base_url, end_url, html_class 85 | 86 | 87 | def makeExtension(*args, **kwargs) : 88 | return WikiLinkExtension(*args, **kwargs) 89 | -------------------------------------------------------------------------------- /site-packages/markdown/odict.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | from __future__ import absolute_import 3 | from . import util 4 | 5 | from copy import deepcopy 6 | 7 | class OrderedDict(dict): 8 | """ 9 | A dictionary that keeps its keys in the order in which they're inserted. 10 | 11 | Copied from Django's SortedDict with some modifications. 12 | 13 | """ 14 | def __new__(cls, *args, **kwargs): 15 | instance = super(OrderedDict, cls).__new__(cls, *args, **kwargs) 16 | instance.keyOrder = [] 17 | return instance 18 | 19 | def __init__(self, data=None): 20 | if data is None or isinstance(data, dict): 21 | data = data or [] 22 | super(OrderedDict, self).__init__(data) 23 | self.keyOrder = list(data) if data else [] 24 | else: 25 | super(OrderedDict, self).__init__() 26 | super_set = super(OrderedDict, self).__setitem__ 27 | for key, value in data: 28 | # Take the ordering from first key 29 | if key not in self: 30 | self.keyOrder.append(key) 31 | # But override with last value in data (dict() does this) 32 | super_set(key, value) 33 | 34 | def __deepcopy__(self, memo): 35 | return self.__class__([(key, deepcopy(value, memo)) 36 | for key, value in self.items()]) 37 | 38 | def __copy__(self): 39 | # The Python's default copy implementation will alter the state 40 | # of self. The reason for this seems complex but is likely related to 41 | # subclassing dict. 42 | return self.copy() 43 | 44 | def __setitem__(self, key, value): 45 | if key not in self: 46 | self.keyOrder.append(key) 47 | super(OrderedDict, self).__setitem__(key, value) 48 | 49 | def __delitem__(self, key): 50 | super(OrderedDict, self).__delitem__(key) 51 | self.keyOrder.remove(key) 52 | 53 | def __iter__(self): 54 | return iter(self.keyOrder) 55 | 56 | def __reversed__(self): 57 | return reversed(self.keyOrder) 58 | 59 | def pop(self, k, *args): 60 | result = super(OrderedDict, self).pop(k, *args) 61 | try: 62 | self.keyOrder.remove(k) 63 | except ValueError: 64 | # Key wasn't in the dictionary in the first place. No problem. 65 | pass 66 | return result 67 | 68 | def popitem(self): 69 | result = super(OrderedDict, self).popitem() 70 | self.keyOrder.remove(result[0]) 71 | return result 72 | 73 | def _iteritems(self): 74 | for key in self.keyOrder: 75 | yield key, self[key] 76 | 77 | def _iterkeys(self): 78 | for key in self.keyOrder: 79 | yield key 80 | 81 | def _itervalues(self): 82 | for key in self.keyOrder: 83 | yield self[key] 84 | 85 | if util.PY3: #pragma: no cover 86 | items = _iteritems 87 | keys = _iterkeys 88 | values = _itervalues 89 | else: #pragma: no cover 90 | iteritems = _iteritems 91 | iterkeys = _iterkeys 92 | itervalues = _itervalues 93 | 94 | def items(self): 95 | return [(k, self[k]) for k in self.keyOrder] 96 | 97 | def keys(self): 98 | return self.keyOrder[:] 99 | 100 | def values(self): 101 | return [self[k] for k in self.keyOrder] 102 | 103 | def update(self, dict_): 104 | for k in dict_: 105 | self[k] = dict_[k] 106 | 107 | def setdefault(self, key, default): 108 | if key not in self: 109 | self.keyOrder.append(key) 110 | return super(OrderedDict, self).setdefault(key, default) 111 | 112 | def value_for_index(self, index): 113 | """Returns the value of the item at the given zero-based index.""" 114 | return self[self.keyOrder[index]] 115 | 116 | def insert(self, index, key, value): 117 | """Inserts the key, value pair before the item with the given index.""" 118 | if key in self.keyOrder: 119 | n = self.keyOrder.index(key) 120 | del self.keyOrder[n] 121 | if n < index: 122 | index -= 1 123 | self.keyOrder.insert(index, key) 124 | super(OrderedDict, self).__setitem__(key, value) 125 | 126 | def copy(self): 127 | """Returns a copy of this object.""" 128 | # This way of initializing the copy means it works for subclasses, too. 129 | return self.__class__(self) 130 | 131 | def __repr__(self): 132 | """ 133 | Replaces the normal dict.__repr__ with a version that returns the keys 134 | in their Ordered order. 135 | """ 136 | return '{%s}' % ', '.join(['%r: %r' % (k, v) for k, v in self._iteritems()]) 137 | 138 | def clear(self): 139 | super(OrderedDict, self).clear() 140 | self.keyOrder = [] 141 | 142 | def index(self, key): 143 | """ Return the index of a given key. """ 144 | try: 145 | return self.keyOrder.index(key) 146 | except ValueError: 147 | raise ValueError("Element '%s' was not found in OrderedDict" % key) 148 | 149 | def index_for_location(self, location): 150 | """ Return index or None for a given location. """ 151 | if location == '_begin': 152 | i = 0 153 | elif location == '_end': 154 | i = None 155 | elif location.startswith('<') or location.startswith('>'): 156 | i = self.index(location[1:]) 157 | if location.startswith('>'): 158 | if i >= len(self): 159 | # last item 160 | i = None 161 | else: 162 | i += 1 163 | else: 164 | raise ValueError('Not a valid location: "%s". Location key ' 165 | 'must start with a ">" or "<".' % location) 166 | return i 167 | 168 | def add(self, key, value, location): 169 | """ Insert by key location. """ 170 | i = self.index_for_location(location) 171 | if i is not None: 172 | self.insert(i, key, value) 173 | else: 174 | self.__setitem__(key, value) 175 | 176 | def link(self, key, location): 177 | """ Change location of an existing item. """ 178 | n = self.keyOrder.index(key) 179 | del self.keyOrder[n] 180 | try: 181 | i = self.index_for_location(location) 182 | if i is not None: 183 | self.keyOrder.insert(i, key) 184 | else: 185 | self.keyOrder.append(key) 186 | except Exception as e: 187 | # restore to prevent data loss and reraise 188 | self.keyOrder.insert(n, key) 189 | raise e 190 | -------------------------------------------------------------------------------- /site-packages/markdown/postprocessors.py: -------------------------------------------------------------------------------- 1 | """ 2 | POST-PROCESSORS 3 | ============================================================================= 4 | 5 | Markdown also allows post-processors, which are similar to preprocessors in 6 | that they need to implement a "run" method. However, they are run after core 7 | processing. 8 | 9 | """ 10 | 11 | from __future__ import absolute_import 12 | from __future__ import unicode_literals 13 | from . import util 14 | from . import odict 15 | import re 16 | 17 | 18 | def build_postprocessors(md_instance, **kwargs): 19 | """ Build the default postprocessors for Markdown. """ 20 | postprocessors = odict.OrderedDict() 21 | postprocessors["raw_html"] = RawHtmlPostprocessor(md_instance) 22 | postprocessors["amp_substitute"] = AndSubstitutePostprocessor() 23 | postprocessors["unescape"] = UnescapePostprocessor() 24 | return postprocessors 25 | 26 | 27 | class Postprocessor(util.Processor): 28 | """ 29 | Postprocessors are run after the ElementTree it converted back into text. 30 | 31 | Each Postprocessor implements a "run" method that takes a pointer to a 32 | text string, modifies it as necessary and returns a text string. 33 | 34 | Postprocessors must extend markdown.Postprocessor. 35 | 36 | """ 37 | 38 | def run(self, text): 39 | """ 40 | Subclasses of Postprocessor should implement a `run` method, which 41 | takes the html document as a single text string and returns a 42 | (possibly modified) string. 43 | 44 | """ 45 | pass #pragma: no cover 46 | 47 | 48 | class RawHtmlPostprocessor(Postprocessor): 49 | """ Restore raw html to the document. """ 50 | 51 | def run(self, text): 52 | """ Iterate over html stash and restore "safe" html. """ 53 | for i in range(self.markdown.htmlStash.html_counter): 54 | html, safe = self.markdown.htmlStash.rawHtmlBlocks[i] 55 | if self.markdown.safeMode and not safe: 56 | if str(self.markdown.safeMode).lower() == 'escape': 57 | html = self.escape(html) 58 | elif str(self.markdown.safeMode).lower() == 'remove': 59 | html = '' 60 | else: 61 | html = self.markdown.html_replacement_text 62 | if self.isblocklevel(html) and (safe or not self.markdown.safeMode): 63 | text = text.replace("<p>%s</p>" % 64 | (self.markdown.htmlStash.get_placeholder(i)), 65 | html + "\n") 66 | text = text.replace(self.markdown.htmlStash.get_placeholder(i), 67 | html) 68 | return text 69 | 70 | def escape(self, html): 71 | """ Basic html escaping """ 72 | html = html.replace('&', '&') 73 | html = html.replace('<', '<') 74 | html = html.replace('>', '>') 75 | return html.replace('"', '"') 76 | 77 | def isblocklevel(self, html): 78 | m = re.match(r'^\<\/?([^ >]+)', html) 79 | if m: 80 | if m.group(1)[0] in ('!', '?', '@', '%'): 81 | # Comment, php etc... 82 | return True 83 | return util.isBlockLevel(m.group(1)) 84 | return False 85 | 86 | 87 | class AndSubstitutePostprocessor(Postprocessor): 88 | """ Restore valid entities """ 89 | 90 | def run(self, text): 91 | text = text.replace(util.AMP_SUBSTITUTE, "&") 92 | return text 93 | 94 | 95 | class UnescapePostprocessor(Postprocessor): 96 | """ Restore escaped chars """ 97 | 98 | RE = re.compile('%s(\d+)%s' % (util.STX, util.ETX)) 99 | 100 | def unescape(self, m): 101 | return util.int2str(int(m.group(1))) 102 | 103 | def run(self, text): 104 | return self.RE.sub(self.unescape, text) 105 | -------------------------------------------------------------------------------- /site-packages/markdown/util.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | import re 4 | import sys 5 | 6 | 7 | """ 8 | Python 3 Stuff 9 | ============================================================================= 10 | """ 11 | PY3 = sys.version_info[0] == 3 12 | 13 | if PY3: #pragma: no cover 14 | string_type = str 15 | text_type = str 16 | int2str = chr 17 | else: #pragma: no cover 18 | string_type = basestring 19 | text_type = unicode 20 | int2str = unichr 21 | 22 | 23 | """ 24 | Constants you might want to modify 25 | ----------------------------------------------------------------------------- 26 | """ 27 | 28 | BLOCK_LEVEL_ELEMENTS = re.compile("^(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul" 29 | "|script|noscript|form|fieldset|iframe|math" 30 | "|hr|hr/|style|li|dt|dd|thead|tbody" 31 | "|tr|th|td|section|footer|header|group|figure" 32 | "|figcaption|aside|article|canvas|output" 33 | "|progress|video|nav)$", re.IGNORECASE) 34 | # Placeholders 35 | STX = '\u0002' # Use STX ("Start of text") for start-of-placeholder 36 | ETX = '\u0003' # Use ETX ("End of text") for end-of-placeholder 37 | INLINE_PLACEHOLDER_PREFIX = STX+"klzzwxh:" 38 | INLINE_PLACEHOLDER = INLINE_PLACEHOLDER_PREFIX + "%s" + ETX 39 | INLINE_PLACEHOLDER_RE = re.compile(INLINE_PLACEHOLDER % r'([0-9]+)') 40 | AMP_SUBSTITUTE = STX+"amp"+ETX 41 | HTML_PLACEHOLDER = STX + "wzxhzdk:%s" + ETX 42 | HTML_PLACEHOLDER_RE = re.compile(HTML_PLACEHOLDER % r'([0-9]+)') 43 | TAG_PLACEHOLDER = STX + "hzzhzkh:%s" + ETX 44 | 45 | 46 | """ 47 | Constants you probably do not need to change 48 | ----------------------------------------------------------------------------- 49 | """ 50 | 51 | RTL_BIDI_RANGES = ( ('\u0590', '\u07FF'), 52 | # Hebrew (0590-05FF), Arabic (0600-06FF), 53 | # Syriac (0700-074F), Arabic supplement (0750-077F), 54 | # Thaana (0780-07BF), Nko (07C0-07FF). 55 | ('\u2D30', '\u2D7F'), # Tifinagh 56 | ) 57 | 58 | # Extensions should use "markdown.util.etree" instead of "etree" (or do `from 59 | # markdown.util import etree`). Do not import it by yourself. 60 | 61 | try: #pragma: no cover 62 | # Is the C implementation of ElementTree available? 63 | import xml.etree.cElementTree as etree 64 | from xml.etree.ElementTree import Comment 65 | # Serializers (including ours) test with non-c Comment 66 | etree.test_comment = Comment 67 | if etree.VERSION < "1.0.5": 68 | raise RuntimeError("cElementTree version 1.0.5 or higher is required.") 69 | except (ImportError, RuntimeError): #pragma: no cover 70 | # Use the Python implementation of ElementTree? 71 | import xml.etree.ElementTree as etree 72 | if etree.VERSION < "1.1": 73 | raise RuntimeError("ElementTree version 1.1 or higher is required") 74 | 75 | 76 | """ 77 | AUXILIARY GLOBAL FUNCTIONS 78 | ============================================================================= 79 | """ 80 | 81 | 82 | def isBlockLevel(tag): 83 | """Check if the tag is a block level HTML tag.""" 84 | if isinstance(tag, string_type): 85 | return BLOCK_LEVEL_ELEMENTS.match(tag) 86 | # Some ElementTree tags are not strings, so return False. 87 | return False 88 | 89 | def parseBoolValue(value, fail_on_errors=True, preserve_none=False): 90 | """Parses a string representing bool value. If parsing was successful, 91 | returns True or False. If preserve_none=True, returns True, False, 92 | or None. If parsing was not successful, raises ValueError, or, if 93 | fail_on_errors=False, returns None.""" 94 | if not isinstance(value, string_type): 95 | if preserve_none and value is None: 96 | return value 97 | return bool(value) 98 | elif preserve_none and value.lower() == 'none': 99 | return None 100 | elif value.lower() in ('true', 'yes', 'y', 'on', '1'): 101 | return True 102 | elif value.lower() in ('false', 'no', 'n', 'off', '0', 'none'): 103 | return False 104 | elif fail_on_errors: 105 | raise ValueError('Cannot parse bool value: %r' % value) 106 | 107 | """ 108 | MISC AUXILIARY CLASSES 109 | ============================================================================= 110 | """ 111 | 112 | class AtomicString(text_type): 113 | """A string which should not be further processed.""" 114 | pass 115 | 116 | 117 | class Processor(object): 118 | def __init__(self, markdown_instance=None): 119 | if markdown_instance: 120 | self.markdown = markdown_instance 121 | 122 | 123 | class HtmlStash(object): 124 | """ 125 | This class is used for stashing HTML objects that we extract 126 | in the beginning and replace with place-holders. 127 | """ 128 | 129 | def __init__(self): 130 | """ Create a HtmlStash. """ 131 | self.html_counter = 0 # for counting inline html segments 132 | self.rawHtmlBlocks = [] 133 | self.tag_counter = 0 134 | self.tag_data = [] # list of dictionaries in the order tags appear 135 | 136 | def store(self, html, safe=False): 137 | """ 138 | Saves an HTML segment for later reinsertion. Returns a 139 | placeholder string that needs to be inserted into the 140 | document. 141 | 142 | Keyword arguments: 143 | 144 | * html: an html segment 145 | * safe: label an html segment as safe for safemode 146 | 147 | Returns : a placeholder string 148 | 149 | """ 150 | self.rawHtmlBlocks.append((html, safe)) 151 | placeholder = self.get_placeholder(self.html_counter) 152 | self.html_counter += 1 153 | return placeholder 154 | 155 | def reset(self): 156 | self.html_counter = 0 157 | self.rawHtmlBlocks = [] 158 | 159 | def get_placeholder(self, key): 160 | return HTML_PLACEHOLDER % key 161 | 162 | def store_tag(self, tag, attrs, left_index, right_index): 163 | """Store tag data and return a placeholder.""" 164 | self.tag_data.append({'tag': tag, 'attrs': attrs, 165 | 'left_index': left_index, 166 | 'right_index': right_index}) 167 | placeholder = TAG_PLACEHOLDER % str(self.tag_counter) 168 | self.tag_counter += 1 # equal to the tag's index in self.tag_data 169 | return placeholder 170 | --------------------------------------------------------------------------------