allow styles

This commit is contained in:
Matthew Scragg 2013-10-10 12:50:19 -05:00
parent 19cca8f0d6
commit 9fed2175de
2 changed files with 5 additions and 5 deletions

View file

@ -644,10 +644,10 @@ ace.edit("editor")}function initUi(){fetchTheme(profile.theme,function(){$theme.
$wordcount.html(!profile.wordcount?'<i class="icon-remove"></i>&nbsp;Disabled Word Count':'<i class="icon-ok"></i>&nbsp;Enabled Word Count');setCurrentFilenameField();$(".dropdown-toggle").dropdown()}function clearSelection(){editor.getSession().setValue("");previewMd()}function saveFile(isManual){if(!keyCheck&&profile.currentMd!=editor.getSession().getValue()){previewMd();console.log(keyCheck)}keyCheck=false;updateUserProfile({currentMd:editor.getSession().getValue()});if(isManual){updateUserProfile({currentMd:""});
var data={name:$pagename.val(),message:$("#page-message").val(),content:editor.getSession().getValue()};$.post(window.location,data,function(){location.href="/"+data["name"]})}}function autoSave(){if(profile.autosave.enabled)autoInterval=setInterval(function(){saveFile()},profile.autosave.interval);else clearInterval(autoInterval)}$("#save-native").on("click",function(){saveFile(true)});function resetProfile(){localStorage.clear();profile.autosave.enabled=false;delete localStorage.profile;window.location.reload()}
function changeTheme(e){var $target=$(e.target);if($target.attr("data-value")===profile.theme)return;else{$theme.find("li > a.selected").removeClass("selected");$target.addClass("selected");var newTheme=$target.attr("data-value");$(e.target).blur();fetchTheme(newTheme,function(){})}}function fetchTheme(th,cb){var name=th.split("/").pop();asyncLoad("/static/js/ace/theme-"+name+".js",function(){editor.setTheme(th);cb&&cb();updateBg(name);updateUserProfile({theme:th})})}function updateBg(name){}function previewMd(){var unmd=
editor.getSession().getValue(),md=MDR.convert(unmd,true);$preview.html("").html(md);refreshWordCount()}function refreshWordCount(selectionCount){var msg="Words: ";if(selectionCount!==undefined)msg+=selectionCount+" of ";if(profile.wordcount)$wordcounter.text(msg+countWords(getTextInElement($preview[0])))}function updateFilename(str){var f;if(typeof str==="string")f=str;else f=getCurrentFilenameFromField();updateUserProfile({current_filename:f})}function showHtml(){var unmd=editor.getSession().getValue();
function _doneHandler(jqXHR,data,response){var resp=JSON.parse(response.responseText);$("#myModalBody").text(resp.data);$("#myModal").modal()}function _failHandler(){alert("Roh-roh. Something went wrong. :(")}var config={type:"POST",data:"unmd="+encodeURIComponent(unmd),dataType:"json",url:"/factory/fetch_html_direct",error:_failHandler,success:_doneHandler};$.ajax(config)}function sadPanda(){alert("Sad Panda - No localStorage for you!")}function toggleAutoSave(){$autosave.html(profile.autosave.enabled?
'<i class="icon-remove"></i>&nbsp;Disable Autosave':'<i class="icon-ok"></i>&nbsp;Enable Autosave');updateUserProfile({autosave:{enabled:!profile.autosave.enabled}});autoSave()}function bindPreview(){$("#editor").bind("keyup",function(){keyCheck=true;previewMd()})}function bindNav(){$theme.find("li > a").bind("click",function(e){changeTheme(e);return false});$("#clear").on("click",function(){clearSelection();return false});$("#autosave").on("click",function(){toggleAutoSave();return false});$("#reset").on("click",
function(){resetProfile();return false});$("#cheat").on("click",function(){window.open("https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet","_blank");return false})}function bindKeyboard(){key("command+s, ctrl+s",function(e){saveFile(true);e.preventDefault()});var saveCommand={name:"save",bindKey:{mac:"Command-S",win:"Ctrl-S"},exec:function(){saveFile(true)}};editor.commands.addCommand(saveCommand)}init()});
editor.getSession().getValue(),md=MDR.convert(unmd,true);$preview.html("").html(md)}function updateFilename(str){var f;if(typeof str==="string")f=str;else f=getCurrentFilenameFromField();updateUserProfile({current_filename:f})}function showHtml(){var unmd=editor.getSession().getValue();function _doneHandler(jqXHR,data,response){var resp=JSON.parse(response.responseText);$("#myModalBody").text(resp.data);$("#myModal").modal()}function _failHandler(){alert("Roh-roh. Something went wrong. :(")}var config=
{type:"POST",data:"unmd="+encodeURIComponent(unmd),dataType:"json",url:"/factory/fetch_html_direct",error:_failHandler,success:_doneHandler};$.ajax(config)}function sadPanda(){alert("Sad Panda - No localStorage for you!")}function toggleAutoSave(){$autosave.html(profile.autosave.enabled?'<i class="icon-remove"></i>&nbsp;Disable Autosave':'<i class="icon-ok"></i>&nbsp;Enable Autosave');updateUserProfile({autosave:{enabled:!profile.autosave.enabled}});autoSave()}function bindPreview(){$("#editor").bind("keyup",
function(){keyCheck=true;previewMd()})}function bindNav(){$theme.find("li > a").bind("click",function(e){changeTheme(e);return false});$("#clear").on("click",function(){clearSelection();return false});$("#autosave").on("click",function(){toggleAutoSave();return false});$("#reset").on("click",function(){resetProfile();return false});$("#cheat").on("click",function(){window.open("https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet","_blank");return false})}function bindKeyboard(){key("command+s, ctrl+s",
function(e){saveFile(true);e.preventDefault()});var saveCommand={name:"save",bindKey:{mac:"Command-S",win:"Ctrl-S"},exec:function(){saveFile(true)}};editor.commands.addCommand(saveCommand)}init()});
function getScrollHeight($prevFrame){if($prevFrame[0].scrollHeight!==undefined)return $prevFrame[0].scrollHeight;else if($prevFrame.find("html")[0].scrollHeight!==undefined&&$prevFrame.find("html")[0].scrollHeight!==0)return $prevFrame.find("html")[0].scrollHeight;else return $prevFrame.find("body")[0].scrollHeight}
function syncPreview(){var $ed=window.ace.edit("editor");var $prev=$("#preview");var editorScrollRange=$ed.getSession().getLength();var previewScrollRange=getScrollHeight($prev);var scrollFactor=$ed.getFirstVisibleRow()/editorScrollRange;$prev.scrollTop(scrollFactor*previewScrollRange)}
window.onload=function(){var $loading=$("#loading");if($.support.transition)$loading.bind($.support.transitionEnd,function(){$("#main").removeClass("bye");$loading.remove()}).addClass("fade_slow");else{$("#main").removeClass("bye");$loading.remove()}window.ace.edit("editor").session.on("changeScrollTop",syncPreview);window.ace.edit("editor").session.selection.on("changeCursor",syncPreview)};

View file

@ -76,7 +76,7 @@ class Wiki():
tree = lxml.html.fromstring(content)
cleaner = clean.Cleaner(remove_unknown_tags=False)
cleaner = clean.Cleaner(remove_unknown_tags=False, style=False, safe_attrs_only=False)
tree = cleaner.clean_html(tree)
content = lxml.html.tostring(tree, encoding='utf-8', method='html')