Ordered list support

This commit is contained in:
John McLear 2012-01-15 17:20:20 +00:00
parent c45932c6b8
commit f4dca37a93
14 changed files with 316 additions and 31 deletions

View file

@ -94,13 +94,23 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
if (cls.indexOf('list') >= 0)
{
var listType = /(?:^| )list:(\S+)/.exec(cls);
var start = /(?:^| )start:(\S+)/.exec(cls);
if (listType)
{
listType = listType[1];
start = start?'start="'+start[1]+'"':'';
if (listType)
{
preHtml = '<ul class="list-' + listType + '"><li>';
postHtml = '</li></ul>';
if(listType.indexOf("number") < 0)
{
preHtml = '<ul class="list-' + listType + '"><li>';
postHtml = '</li></ul>';
}
else
{
preHtml = '<ol '+start+' class="list-' + listType + '"><li>';
postHtml = '</li></ol>';
}
}
result.lineMarker += txt.length;
return; // don't append any text
@ -141,8 +151,7 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
plugins_.callHook("aceCreateDomLine", {
domline: domline,
cls: cls,
document: document
cls: cls
}).map(function(modifier)
{
cls = modifier.cls;
@ -158,7 +167,11 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
{
if (href)
{
extraOpenTags = extraOpenTags + '<a href="' + domline.escapeHTML(href) + '">';
if(!~href.indexOf("http")) // if the url doesn't include http or https etc prefix it.
{
href = "http://"+href;
}
extraOpenTags = extraOpenTags + '<a href="' + href.replace(/\"/g, '&quot;') + '">';
extraCloseTags = '</a>' + extraCloseTags;
}
if (simpleTags)