[IMP] document_page: changed to use the html field
bzr revid: nicolas.vanhoren@openerp.com-20120920084253-v2wyiimgk4ez1jum
This commit is contained in:
commit
da8ab5d399
|
@ -44,10 +44,6 @@ Web pages
|
|||
'auto_install': False,
|
||||
'certificate': '0086363630317',
|
||||
'images': [],
|
||||
'js': [
|
||||
'static/src/lib/wiky/wiky.js',
|
||||
'static/src/js/document_page.js'
|
||||
],
|
||||
'css' : ['static/src/css/document_page.css'],
|
||||
}
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -23,24 +23,28 @@ Additional ressources
|
|||
<field name="name">OpenERP 6.1. Functional Demo</field>
|
||||
<field name="parent_id" ref="demo_category1"/>
|
||||
<field name="content">
|
||||
|
||||
The news is out, OpenERP's latest version 6.1. is here. It's more
|
||||
user-friendly, even more business oriented and efficient to manage your company
|
||||
|
||||
How to discover the latest version 6.1.?
|
||||
|
||||
Demo : [http://demo.openerp.com]
|
||||
Online: [http://openerp.com/online]
|
||||
Download: [http://openerp.com/downloads]
|
||||
|
||||
We have also put together a functional demo that presents 6.1. Watch this video
|
||||
to learn directly from us what OpenERP 6.1. can do for you. Share it in your
|
||||
company, with your clients and implement it now for your business.
|
||||
|
||||
==Watch on Youtube!==
|
||||
|
||||
[[Video:http://www.youtube.com/embed/7jES2jxKMso ]]
|
||||
|
||||
<![CDATA[
|
||||
<br>
|
||||
<br>
|
||||
The news is out, OpenERP's latest version 6.1. is here. It's more<br>
|
||||
user-friendly, even more business oriented and efficient to manage your company<br>
|
||||
<br>
|
||||
How to discover the latest version 6.1.?<br>
|
||||
<br>
|
||||
Demo : <a target="http://demo.openerp.com" href="http://demo.openerp.com" style="background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFZJREFUeF59z4EJADEIQ1F36k7u5E7ZKXeUQPACJ3wK7UNokVxVk9kHnQH7bY9hbDyDhNXgjpRLqFlo4M2GgfyJHhjq8V4agfrgPQX3JtJQGbofmCHgA/nAKks+JAjFAAAAAElFTkSuQmCC") no-repeat scroll right center transparent;padding-right: 13px;"></a><br>
|
||||
Online: <a target="http://openerp.com/online" href="http://openerp.com/online" style="background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFZJREFUeF59z4EJADEIQ1F36k7u5E7ZKXeUQPACJ3wK7UNokVxVk9kHnQH7bY9hbDyDhNXgjpRLqFlo4M2GgfyJHhjq8V4agfrgPQX3JtJQGbofmCHgA/nAKks+JAjFAAAAAElFTkSuQmCC") no-repeat scroll right center transparent;padding-right: 13px;"></a><br>
|
||||
Download: <a target="http://openerp.com/downloads" href="http://openerp.com/downloads" style="background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFZJREFUeF59z4EJADEIQ1F36k7u5E7ZKXeUQPACJ3wK7UNokVxVk9kHnQH7bY9hbDyDhNXgjpRLqFlo4M2GgfyJHhjq8V4agfrgPQX3JtJQGbofmCHgA/nAKks+JAjFAAAAAElFTkSuQmCC") no-repeat scroll right center transparent;padding-right: 13px;"></a><br>
|
||||
<br>
|
||||
We have also put together a functional demo that presents 6.1. Watch this video<br>
|
||||
to learn directly from us what OpenERP 6.1. can do for you. Share it in your<br>
|
||||
company, with your clients and implement it now for your business.<br>
|
||||
<br>
|
||||
<h3>Watch on Youtube!</h3><br>
|
||||
<br>
|
||||
<iframe width="480" height="390" src="http://www.youtube.com/embed/7jES2jxKMso " frameborder="0" allowfullscreen=""></iframe><br>
|
||||
<br>
|
||||
<br>
|
||||
]]>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
@ -48,36 +52,40 @@ company, with your clients and implement it now for your business.
|
|||
<field name="name">Personalise Dashboards</field>
|
||||
<field name="parent_id" ref="demo_category1"/>
|
||||
<field name="content">
|
||||
You like OpenERP, but feel like you want to personalise it more? Now, OpenERP
|
||||
goes a step further and lets you customize your dashboard. Thanks to a new
|
||||
feature that allows you to customize your dashboard by adding new boards of any
|
||||
search view.
|
||||
|
||||
==How is it done?==
|
||||
|
||||
Step 1: access one search view
|
||||
|
||||
Step 2: apply the filter you want to see at each connection to the application
|
||||
(eg. on sales, manufacturing, etc)
|
||||
|
||||
Step 3: add it into the dashboard in the same space where you can save the filter
|
||||
|
||||
Step 4: choose the application you want it visible on and the name of the array
|
||||
|
||||
Look at this simple example below from Purchase, where I want to put on the
|
||||
application's dashboard "Purchases to Approve". After I access the search view
|
||||
and apply the filter for "Purchases to Approve", I can add it immediately to my
|
||||
Purchase dashboard.
|
||||
|
||||
[[File:http://www.openerp.com/sites/default/files/fileattach/dashboard2_1(1).png ]]
|
||||
|
||||
In less than a minute, the search view is visible on the dashboard
|
||||
|
||||
[[File:http://www.openerp.com/sites/default/files/fileattach/dashboard2_2.png ]]
|
||||
|
||||
Of course, you are free to delete what you don't need or like, but just in case
|
||||
you change your mind there is a reset button to return to the default view.
|
||||
|
||||
<![CDATA[
|
||||
<br>
|
||||
You like OpenERP, but feel like you want to personalise it more? Now, OpenERP<br>
|
||||
goes a step further and lets you customize your dashboard. Thanks to a new<br>
|
||||
feature that allows you to customize your dashboard by adding new boards of any<br>
|
||||
search view.<br>
|
||||
<br>
|
||||
<h3>How is it done?</h3><br>
|
||||
<br>
|
||||
Step 1: access one search view <br>
|
||||
<br>
|
||||
Step 2: apply the filter you want to see at each connection to the application<br>
|
||||
(eg. on sales, manufacturing, etc)<br>
|
||||
<br>
|
||||
Step 3: add it into the dashboard in the same space where you can save the filter<br>
|
||||
<br>
|
||||
Step 4: choose the application you want it visible on and the name of the array<br>
|
||||
<br>
|
||||
Look at this simple example below from Purchase, where I want to put on the<br>
|
||||
application's dashboard "Purchases to Approve". After I access the search view<br>
|
||||
and apply the filter for "Purchases to Approve", I can add it immediately to my<br>
|
||||
Purchase dashboard.<br>
|
||||
<br>
|
||||
<img src="http://www.openerp.com/sites/default/files/fileattach/dashboard2_1(1).png" alt=""><br>
|
||||
<br>
|
||||
In less than a minute, the search view is visible on the dashboard<br>
|
||||
<br>
|
||||
<img src="http://www.openerp.com/sites/default/files/fileattach/dashboard2_2.png" alt=""><br>
|
||||
<br>
|
||||
Of course, you are free to delete what you don't need or like, but just in case<br>
|
||||
you change your mind there is a reset button to return to the default view.<br>
|
||||
<br>
|
||||
<br>
|
||||
]]>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
@ -85,36 +93,36 @@ you change your mind there is a reset button to return to the default view.
|
|||
<field name="name">Touchscreen Point of Sale</field>
|
||||
<field name="parent_id" ref="demo_category1"/>
|
||||
<field name="content">
|
||||
The brand new OpenERP touchscreen point of sale available with 6.1 allows you
|
||||
to manage your shop sales very easily. It's fully web based so that you don't
|
||||
have to install or deploy any software and all the sales shops can be easily
|
||||
consolidated. It works in connected and disconnected modes so that you can
|
||||
continue to sell if you lose your internet connection.
|
||||
|
||||
[[File:http://www.openerp.com/sites/default/files/fileattach/POS(2).png ]]
|
||||
|
||||
==Here's a summary of its main features and benefits:==
|
||||
|
||||
100% WEB based
|
||||
|
||||
* available for any touchscreen device (ipod, ipad, any tablet)mobile (with portable devices)
|
||||
* no installation required
|
||||
* no synchronization needed, completely integrated
|
||||
* continue working even when your connection is down if you close your browser, data won't be lost
|
||||
* fully web based with a clean interface smart interface
|
||||
|
||||
You have different options to select your products. You can do it through the
|
||||
barcode reader, just browse through the categories you have put in place (ie.
|
||||
drinks, snacks, meals, etc.), or text search in case neither of the other
|
||||
options work for you. If you need to use the POS for your restaurant, for
|
||||
example, your employees can record at the same time multiple tickets without
|
||||
having to wait to do one transaction at a time. Along, to facilitate payment,
|
||||
the application allows multiple payment methods.
|
||||
|
||||
The POS application is so simple and accessible to use that your shop or
|
||||
restaurant will never need any other tool to manage orders. Due to its smart
|
||||
and user-friendly interface you don't need any training to learn how to use it.
|
||||
Think of it as an out-of-the-box solution to boost your business' productivity.
|
||||
<![CDATA[
|
||||
<br>
|
||||
The brand new OpenERP touchscreen point of sale available with 6.1 allows you<br>
|
||||
to manage your shop sales very easily. It's fully web based so that you don't<br>
|
||||
have to install or deploy any software and all the sales shops can be easily<br>
|
||||
consolidated. It works in connected and disconnected modes so that you can<br>
|
||||
continue to sell if you lose your internet connection.<br>
|
||||
<br>
|
||||
<img src="http://www.openerp.com/sites/default/files/fileattach/POS(2).png" alt=""><br>
|
||||
<br>
|
||||
<h3>Here's a summary of its main features and benefits:</h3><br>
|
||||
<br>
|
||||
100% WEB based<br>
|
||||
<br>
|
||||
<ul><li>available for any touchscreen device (ipod, ipad, any tablet)mobile (with portable devices)</li><li>no installation required</li><li>no synchronization needed, completely integrated</li><li>continue working even when your connection is down if you close your browser, data won't be lost</li><li>fully web based with a clean interface smart interface</li></ul><br>
|
||||
<br>
|
||||
You have different options to select your products. You can do it through the<br>
|
||||
barcode reader, just browse through the categories you have put in place (ie.<br>
|
||||
drinks, snacks, meals, etc.), or text search in case neither of the other<br>
|
||||
options work for you. If you need to use the POS for your restaurant, for<br>
|
||||
example, your employees can record at the same time multiple tickets without<br>
|
||||
having to wait to do one transaction at a time. Along, to facilitate payment,<br>
|
||||
the application allows multiple payment methods.<br>
|
||||
<br>
|
||||
The POS application is so simple and accessible to use that your shop or<br>
|
||||
restaurant will never need any other tool to manage orders. Due to its smart<br>
|
||||
and user-friendly interface you don't need any training to learn how to use it.<br>
|
||||
Think of it as an out-of-the-box solution to boost your business' productivity.<br>
|
||||
<br>
|
||||
]]>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
</div>
|
||||
<field name="content" placeholder="e.g. Once upon a time..." class="oe_edit_only"/>
|
||||
<div class="oe_document_page">
|
||||
<field name="display_content" widget="text_wiki" class="oe_view_only"/>
|
||||
<field name="display_content" widget="html" class="oe_view_only" options='{"safe": true}'/>
|
||||
</div>
|
||||
</form>
|
||||
</field>
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
openerp.document_page = function (openerp) {
|
||||
openerp.web.form.widgets.add('text_wiki', 'openerp.web.form.FieldTextWiki');
|
||||
|
||||
openerp.web.form.FieldTextWiki = openerp.web.form.FieldText.extend({
|
||||
render_value: function() {
|
||||
var show_value = openerp.web.format_value(this.get('value'), this, '');
|
||||
if (!this.get("effective_readonly")) {
|
||||
this.$textarea.val(show_value);
|
||||
if (show_value && this.view.options.resize_textareas) {
|
||||
this.do_resize(this.view.options.resize_textareas);
|
||||
}
|
||||
} else {
|
||||
var wiki_value = wiky.process(show_value || '');
|
||||
this.$el.html(wiki_value);
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
|
@ -1,41 +0,0 @@
|
|||
Wiky.js - a javascript library to convert Wiki Markup language to HTML.
|
||||
=======================
|
||||
|
||||
(It is buggy, please use with care)
|
||||
|
||||
Wiky.js is a javascript library that converts Wiki Markup language to HTML.
|
||||
|
||||
|
||||
How to use it
|
||||
-------------------
|
||||
Include wiki.js into your HTML file. Wiky.js has only one function, which is wiky.process(wikitext).
|
||||
|
||||
Please see index.html for an example.
|
||||
|
||||
*wiky.js does not depend on jQuery, which is included for testing purpose.
|
||||
|
||||
|
||||
|
||||
Supported Syntax
|
||||
-------------------
|
||||
* == Heading ==
|
||||
* === Subheading ===
|
||||
* [http://www.url.com Name of URLs]
|
||||
* [[File:http://www.url.com/image.png Alternative Text]]
|
||||
* -------------------- (Horizontal line)
|
||||
* : (Indentation)
|
||||
* # Ordered bullet point
|
||||
* * Unordered bullet point
|
||||
|
||||
|
||||
|
||||
License
|
||||
------------------
|
||||
Creative Commons 3.0
|
||||
|
||||
|
||||
|
||||
Contributors
|
||||
-------------------
|
||||
Tanin Na Nakorn
|
||||
Tanun Niyomjit (Designer)
|
|
@ -1,56 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
|
||||
<script type="text/javascript" src="wiky.js"></script>
|
||||
<title>Untitled Document</title>
|
||||
<link href="wiky.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<textarea id="textarea" onchange="$('#preview').html(wiky.process($(this).val()));" cols="60" rows="20">=== Heading ===
|
||||
Some content
|
||||
I would like to add another line
|
||||
|
||||
== Subheading ==
|
||||
Some more content
|
||||
Some more lines1
|
||||
:A line with indent
|
||||
:: A 2-indented line
|
||||
:: more
|
||||
:back to 1-indented line
|
||||
|
||||
This is Taeyeon.
|
||||
[[File:http://www.oknation.net/blog/home/blog_data/12/2012/images/ty4.jpg Taeyeon]]
|
||||
Taeyeon is so cute.
|
||||
|
||||
This is a link:[http://www.google.com Google].
|
||||
This is a bold link:'''[http://www.google.com Google]'''.
|
||||
This is a bold-italic link:'''''[http://www.google.com Google]'''''.
|
||||
This is '''bold''', '''''bold-italic''''', and ''italic''
|
||||
|
||||
[[Video:http://www.youtube.com/embed/ovVfLancwys]]
|
||||
# First
|
||||
# secon
|
||||
## Second-First
|
||||
*** First Point
|
||||
*** Second Point
|
||||
#### z
|
||||
#### y
|
||||
#### x
|
||||
*** Third Point
|
||||
## Second-Second [ftp://www.facebook.com FacebookFTP]
|
||||
## Second-Third [http://www.google.com Google Here]
|
||||
# third
|
||||
|
||||
</textarea>
|
||||
<br/>
|
||||
<span style="display:block;width:600px;border:1px solid #999999;">
|
||||
<span style="display:block;margin:10px 10px 10px 10px;" class="wiky_preview_area" id="preview">
|
||||
</span>
|
||||
</span>
|
||||
</body>
|
||||
</html>
|
||||
<script language="javascript">
|
||||
$('#preview').html(wiky.process($('#textarea').val()));
|
||||
</script>
|
|
@ -1,35 +0,0 @@
|
|||
=== Heading ===
|
||||
Some content
|
||||
I would like to add another line
|
||||
|
||||
== Subheading ==
|
||||
Some more content
|
||||
Some more lines1
|
||||
:A line with indent
|
||||
:: A 2-indented line
|
||||
:: more
|
||||
:back to 1-indented line
|
||||
|
||||
This is Taeyeon.
|
||||
[[File:http://www.oknation.net/blog/home/blog_data/12/2012/images/ty4.jpg Taeyeon]]
|
||||
Taeyeon is so cute.
|
||||
|
||||
This is a link:[http://www.google.com Google].
|
||||
This is a bold link:'''[http://www.google.com Google]'''.
|
||||
This is a bold-italic link:'''''[http://www.google.com Google]'''''.
|
||||
This is '''bold''', '''''bold-italic''''', and ''italic''
|
||||
|
||||
|
||||
# First
|
||||
# second
|
||||
## Second-First
|
||||
*** First Point
|
||||
*** Second Point
|
||||
#### z
|
||||
#### y
|
||||
#### x
|
||||
*** Third Point
|
||||
## Second-Second [ftp://www.facebook.com FacebookFTP]
|
||||
## Second-Third [http://www.google.com Google Here]
|
||||
# third
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
@charset "UTF-8";
|
||||
.wiky_preview_area {
|
||||
font-family: "Helvetica Neue", Arial, Helvetica, 'Liberation Sans', FreeSans, sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 1.5em;
|
||||
color: #666;
|
||||
font-weight:350;
|
||||
width:600px;
|
||||
display:block;
|
||||
}
|
||||
.wiky_preview_area h2{
|
||||
font-size:24px;
|
||||
color:#333;
|
||||
font-weight:400;
|
||||
|
||||
text-shadow:0 1px 0 rgba(000, 000, 000, .4);
|
||||
}
|
||||
.wiky_preview_area h3{
|
||||
font-size:18px;
|
||||
color:#555;
|
||||
font-weight:400;
|
||||
|
||||
text-shadow:0 1px 0 rgba(000, 000, 000, .4);
|
||||
}
|
||||
.wiky_preview_area img{
|
||||
background-repeat: repeat;
|
||||
width: 400px;
|
||||
-webkit-border-radius: 10px;
|
||||
-moz-border-radius: 10px;
|
||||
border-radius: 10px;
|
||||
-webkit-box-shadow:0 1px 3px rgba(0, 0, 0, .8);
|
||||
-moz-box-shadow:0 1px 3px rgba(0, 0, 0, .8);
|
||||
box-shadow:0 1px 3px rgba(0, 0, 0, .8);
|
||||
}
|
||||
.wiky_preview_area a{
|
||||
padding:5px;
|
||||
font-weight:400;
|
||||
|
||||
background: #999; /* for non-css3 browsers */
|
||||
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#cccccc', endColorstr='#000000'); /* for IE */
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#ccc), to(#000)); /* for webkit browsers */
|
||||
background: -moz-linear-gradient(top, #ccc, #000); /* for firefox 3.6+ */
|
||||
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
|
||||
-webkit-box-shadow:none;
|
||||
-moz-box-shadow:none;
|
||||
box-shadow:none;
|
||||
|
||||
text-shadow:0 1px 0 rgba(255, 255, 255, 1);
|
||||
}
|
||||
|
||||
.wiky_preview_area a:hover{
|
||||
color:#333;
|
||||
padding:5px;
|
||||
font-weight:400;
|
||||
text-decoration:none;
|
||||
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
|
||||
-webkit-box-shadow:0 1px 3px rgba(0, 0, 0, .3);
|
||||
-moz-box-shadow:0 1px 3px rgba(0, 0, 0, .3);
|
||||
box-shadow:0 1px 3px rgba(0, 0, 0, .3);
|
||||
|
||||
text-shadow:0 1px 0 rgba(255, 255, 255, 1);
|
||||
}
|
||||
|
||||
|
||||
.wiky_preview_area > ol,
|
||||
.wiky_preview_area > ul,
|
||||
.wiky_preview_area > ul > li,
|
||||
.wiky_preview_area > ol > li {
|
||||
list-style: disc inside none;
|
||||
}
|
|
@ -1,303 +0,0 @@
|
|||
/**
|
||||
* Wiky.js - Javascript library to converts Wiki MarkUp language to HTML.
|
||||
* You can do whatever with it. Please give me some credits (Apache License)
|
||||
* - Tanin Na Nakorn
|
||||
*/
|
||||
|
||||
var wiky = {};
|
||||
|
||||
|
||||
wiky.process = function(wikitext) {
|
||||
var lines = wikitext.split(/\r?\n/);
|
||||
var start;
|
||||
var html = "";
|
||||
|
||||
for (var i=0;i<lines.length;i++)
|
||||
{
|
||||
var line = lines[i];
|
||||
if (line.match(/^===/)!=null && line.match(/===$/)!=null)
|
||||
{
|
||||
html += "<h2>"+line.substring(3,line.length-3)+"</h2>";
|
||||
}
|
||||
else if (line.match(/^==/)!=null && line.match(/==$/)!=null)
|
||||
{
|
||||
html += "<h3>"+line.substring(2,line.length-2)+"</h3>";
|
||||
}
|
||||
else if (line.match(/^:+/)!=null)
|
||||
{
|
||||
// find start line and ending line
|
||||
start = i;
|
||||
while (i < lines.length && lines[i].match(/^:+/)!=null) i++;
|
||||
i--;
|
||||
|
||||
html += wiky.process_indent(lines,start,i);
|
||||
}
|
||||
else if (line.match(/^----+(\s*)$/)!=null)
|
||||
{
|
||||
html += "<hr/>";
|
||||
}
|
||||
else if (line.match(/^(\*+) /)!=null)
|
||||
{
|
||||
// find start line and ending line
|
||||
start = i;
|
||||
while (i < lines.length && lines[i].match(/^(\*+|##+):? /)!=null) i++;
|
||||
i--;
|
||||
|
||||
html += wiky.process_bullet_point(lines,start,i);
|
||||
}
|
||||
else if (line.match(/^(#+) /)!=null)
|
||||
{
|
||||
// find start line and ending line
|
||||
start = i;
|
||||
while (i < lines.length && lines[i].match(/^(#+|\*\*+):? /)!=null) i++;
|
||||
i--;
|
||||
|
||||
html += wiky.process_bullet_point(lines,start,i);
|
||||
}
|
||||
else
|
||||
{
|
||||
html += wiky.process_normal(line);
|
||||
}
|
||||
|
||||
html += "<br/>\n";
|
||||
}
|
||||
|
||||
return html;
|
||||
};
|
||||
|
||||
wiky.process_indent = function(lines,start,end) {
|
||||
var html = "<dl>";
|
||||
|
||||
for(var i=start;i<=end;i++) {
|
||||
|
||||
html += "<dd>";
|
||||
|
||||
var this_count = lines[i].match(/^(:+)/)[1].length;
|
||||
|
||||
html += wiky.process_normal(lines[i].substring(this_count));
|
||||
|
||||
var nested_end = i;
|
||||
for (var j=i+1;j<=end;j++) {
|
||||
var nested_count = lines[j].match(/^(:+)/)[1].length;
|
||||
if (nested_count <= this_count) break;
|
||||
else nested_end = j;
|
||||
}
|
||||
|
||||
if (nested_end > i) {
|
||||
html += wiky.process_indent(lines,i+1,nested_end);
|
||||
i = nested_end;
|
||||
}
|
||||
|
||||
html += "</dd>";
|
||||
}
|
||||
|
||||
html += "</dl>";
|
||||
return html;
|
||||
};
|
||||
|
||||
wiky.process_bullet_point = function(lines,start,end) {
|
||||
var html = (lines[start].charAt(0)=='*')?"<ul>":"<ol>";
|
||||
|
||||
for(var i=start;i<=end;i++) {
|
||||
|
||||
html += "<li>";
|
||||
|
||||
var this_count = lines[i].match(/^(\*+|#+) /)[1].length;
|
||||
|
||||
html += wiky.process_normal(lines[i].substring(this_count+1));
|
||||
|
||||
// continue previous with #:
|
||||
{
|
||||
var nested_end = i;
|
||||
for (var j = i + 1; j <= end; j++) {
|
||||
var nested_count = lines[j].match(/^(\*+|#+):? /)[1].length;
|
||||
|
||||
if (nested_count < this_count)
|
||||
break;
|
||||
else {
|
||||
if (lines[j].charAt(nested_count) == ':') {
|
||||
html += "<br/>" + wiky.process_normal(lines[j].substring(nested_count + 2));
|
||||
nested_end = j;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
i = nested_end;
|
||||
}
|
||||
|
||||
// nested bullet point
|
||||
{
|
||||
var nested_end = i;
|
||||
for (var j = i + 1; j <= end; j++) {
|
||||
var nested_count = lines[j].match(/^(\*+|#+):? /)[1].length;
|
||||
if (nested_count <= this_count)
|
||||
break;
|
||||
else
|
||||
nested_end = j;
|
||||
}
|
||||
|
||||
if (nested_end > i) {
|
||||
html += wiky.process_bullet_point(lines, i + 1, nested_end);
|
||||
i = nested_end;
|
||||
}
|
||||
}
|
||||
|
||||
// continue previous with #:
|
||||
{
|
||||
var nested_end = i;
|
||||
for (var j = i + 1; j <= end; j++) {
|
||||
var nested_count = lines[j].match(/^(\*+|#+):? /)[1].length;
|
||||
|
||||
if (nested_count < this_count)
|
||||
break;
|
||||
else {
|
||||
if (lines[j].charAt(nested_count) == ':') {
|
||||
html += wiky.process_normal(lines[j].substring(nested_count + 2));
|
||||
nested_end = j;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
i = nested_end;
|
||||
}
|
||||
|
||||
html += "</li>";
|
||||
}
|
||||
|
||||
html += (lines[start].charAt(0)=='*')?"</ul>":"</ol>";
|
||||
return html;
|
||||
};
|
||||
|
||||
wiky.process_url = function(txt) {
|
||||
|
||||
var index = txt.indexOf(" ");
|
||||
|
||||
if (index == -1)
|
||||
{
|
||||
return "<a target='"+txt+"' href='"+txt+"' style='background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFZJREFUeF59z4EJADEIQ1F36k7u5E7ZKXeUQPACJ3wK7UNokVxVk9kHnQH7bY9hbDyDhNXgjpRLqFlo4M2GgfyJHhjq8V4agfrgPQX3JtJQGbofmCHgA/nAKks+JAjFAAAAAElFTkSuQmCC\") no-repeat scroll right center transparent;padding-right: 13px;'></a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
var url = txt.substring(0,index);
|
||||
var label = txt.substring(index+1);
|
||||
return "<a target='"+url+"' href='"+url+"' style='background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFZJREFUeF59z4EJADEIQ1F36k7u5E7ZKXeUQPACJ3wK7UNokVxVk9kHnQH7bY9hbDyDhNXgjpRLqFlo4M2GgfyJHhjq8V4agfrgPQX3JtJQGbofmCHgA/nAKks+JAjFAAAAAElFTkSuQmCC\") no-repeat scroll right center transparent;padding-right: 13px;'>"+label+"</a>";
|
||||
}
|
||||
};
|
||||
|
||||
wiky.process_image = function(txt) {
|
||||
var index = txt.indexOf(" ");
|
||||
var url = txt;
|
||||
var label = "";
|
||||
|
||||
if (index > -1)
|
||||
{
|
||||
url = txt.substring(0,index);
|
||||
label = txt.substring(index+1);
|
||||
}
|
||||
|
||||
|
||||
return "<img src='"+url+"' alt=\""+label+"\" />";
|
||||
};
|
||||
|
||||
wiky.process_video = function(url) {
|
||||
|
||||
if (url.match(/^(https?:\/\/)?(www.)?youtube.com\//) == null)
|
||||
{
|
||||
return "<b>"+url+" is an invalid YouTube URL</b>";
|
||||
}
|
||||
var result;
|
||||
if ((result = url.match(/^(https?:\/\/)?(www.)?youtube.com\/watch\?(.*)v=([^&]+)/)) != null)
|
||||
{
|
||||
url = "http://www.youtube.com/embed/"+result[4];
|
||||
}
|
||||
|
||||
|
||||
return '<iframe width="480" height="390" src="'+url+'" frameborder="0" allowfullscreen></iframe>';
|
||||
};
|
||||
|
||||
wiky.process_normal = function(wikitext) {
|
||||
|
||||
// Image
|
||||
{
|
||||
var index = wikitext.indexOf("[[File:");
|
||||
var end_index = wikitext.indexOf("]]", index + 7);
|
||||
while (index > -1 && end_index > -1) {
|
||||
|
||||
wikitext = wikitext.substring(0,index)
|
||||
+ wiky.process_image(wikitext.substring(index+7,end_index))
|
||||
+ wikitext.substring(end_index+2);
|
||||
|
||||
index = wikitext.indexOf("[[File:");
|
||||
end_index = wikitext.indexOf("]]", index + 7);
|
||||
}
|
||||
}
|
||||
|
||||
// Video
|
||||
{
|
||||
var index = wikitext.indexOf("[[Video:");
|
||||
var end_index = wikitext.indexOf("]]", index + 8);
|
||||
while (index > -1 && end_index > -1) {
|
||||
|
||||
wikitext = wikitext.substring(0,index)
|
||||
+ wiky.process_video(wikitext.substring(index+8,end_index))
|
||||
+ wikitext.substring(end_index+2);
|
||||
|
||||
index = wikitext.indexOf("[[Video:");
|
||||
end_index = wikitext.indexOf("]]", index + 8);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// URL
|
||||
var protocols = ["http","ftp","news"];
|
||||
|
||||
for (var i=0;i<protocols.length;i++)
|
||||
{
|
||||
var index = wikitext.indexOf("["+protocols[i]+"://");
|
||||
var end_index = wikitext.indexOf("]", index + 1);
|
||||
while (index > -1 && end_index > -1) {
|
||||
|
||||
wikitext = wikitext.substring(0,index)
|
||||
+ wiky.process_url(wikitext.substring(index+1,end_index))
|
||||
+ wikitext.substring(end_index+1);
|
||||
|
||||
index = wikitext.indexOf("["+protocols[i]+"://",end_index+1);
|
||||
end_index = wikitext.indexOf("]", index + 1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
var count_b = 0;
|
||||
var index = wikitext.indexOf("'''");
|
||||
while(index > -1) {
|
||||
|
||||
if ((count_b%2)==0) wikitext = wikitext.replace(/'''/,"<b>");
|
||||
else wikitext = wikitext.replace(/'''/,"</b>");
|
||||
|
||||
count_b++;
|
||||
|
||||
index = wikitext.indexOf("'''",index);
|
||||
}
|
||||
|
||||
var count_i = 0;
|
||||
var index = wikitext.indexOf("''");
|
||||
while(index > -1) {
|
||||
|
||||
if ((count_i%2)==0) wikitext = wikitext.replace(/''/,"<i>");
|
||||
else wikitext = wikitext.replace(/''/,"</i>");
|
||||
|
||||
count_i++;
|
||||
|
||||
index = wikitext.indexOf("''",index);
|
||||
}
|
||||
|
||||
wikitext = wikitext.replace(/<\/b><\/i>/g,"</i></b>");
|
||||
|
||||
return wikitext;
|
||||
};
|
Loading…
Reference in New Issue