Embedihtmlconverter

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
<style type="text/css">
@import url(http://scp-jp.wdfiles.com/local--files/japanese-syntax/scp-WikidotCss.css);
 
textarea{
width:90%;
display:block;
margin:auto;
border:ridge #b01 2px;
padding;3px;
height:200px;
}
 
iframe{
width:90%;
display:block;
margin:auto;
border:ridge #b01 2px;
padding;3px;
height:200px;
}
</style>
    <title>Wikidot⇒htmlへの変換</title>
<script type="text/javascript" src="http://ja.scp-wiki.net/scpmetatitlesearch/code/1"></script>
<script type="text/javascript">
function WikidotConvert(){
var seedSentence = ExtendConverter(WikidotSyntax.value);
htmlSyntax.value = trasrateWikidotToHtml(seedSentence);
var viewer = window.htmlSyntaxShow.contentDocument || window.htmlSyntaxShow.contentWindow.document;
viewer.body.innerHTML = htmlSyntax.value;
}
 
function ExtendConverter(original){
    original = original.split("<").join("&lt;");
    original = original.split(">").join("&gt;");
    var originalRow = original.split("\n");
    var start = -1;
    var nullRowCount = 0;
    for(var i = 0;i < originalRow.length;i++){
        if(originalRow[i].match(/^&gt; /g)){
            if(start < 0){
                start = i;
            }
            originalRow[i] = originalRow[i].substring(4,originalRow[i].length);
        }else{
            if(start >= 0){
                originalRow[start] = "<blockquote>\n" + originalRow[start];
                originalRow[i-1] += "\n</blockquote>";
                start = -1;
            }
        }
    }
    if(start >= 0){
        originalRow[start] = "<blockquote>\n" + originalRow[start];
        originalRow[i-1] += "\n</blockquote>";    
    }
    original = originalRow.join("<br />\n");
    original = original.replace(/(\[\[span_\]\]<br \/>|\[\[span_\]\].*<br \/>)/,function(){ return "";});
 
    original = original.split("<br />\n\n</blockquote><br />").join("\n</blockquote>");
    original = original.split("\n</blockquote><br />").join("\n</blockquote>");
    original = original.split("<br />\n[[&gt;]]<br />\n").join('\n<div style="text-align: right;">\n');
    original = original.split("[[&gt;]]<br />\n").join('<div style="text-align:right;">\n');
    original = original.split("<br />\n[[/&gt;]]<br />\n").join('\n</div>\n');
    original = original.split("<br />\n[[/&gt;]]").join('\n</div>');
    original = original.split("<br />\n[[=]]<br />\n").join('\n<div style="text-align: center;">\n');
    original = original.split("[[=]]<br />\n").join('<div style="text-align: center;">\n');
    original = original.split("<br />\n[[/=]]<br />\n").join('\n</div>\n');
    original = original.split("<br />\n[[/=]]").join('\n</div>');
    original = original.replace(/\[\[div.*\]<br \/>\n/,function(match){
                var result = match.split("<br />").join("");
                return result;
            }
        );
    original = original.split("<br />\n[[/div]]<br />\n").join('\n[[/div]]\n');
    return original;
}
function changeViewType(){
    var showType = 0;
    for(var i = 0;i < document.display_result.showtype.length;i++){
        if(document.display_result.showtype[i].checked){
        showType = i;
        }
    }
    switch(showType){
        case 0:
        //html
        htmlSyntax.style.display = "block";
        htmlSyntaxShow.style.display = "none";
        break;
        case 1:
        htmlSyntax.style.display = "none";
        htmlSyntaxShow.style.display = "block";        
        break;
    }
 
}
</script>
</head>
<body>
<b>Wikidot構文入力欄</b>
<textarea id="WikidotSyntax"></textarea>
<div style="text-align:center;">
<button onclick="WikidotConvert();">↓htmlに変換</button>
<textarea id="htmlSyntax"></textarea>
<iframe src="http://shitake-crude-production.wikidot.com/extension:embedihtmlconverter/code/2" id="htmlSyntaxShow" style="display:none;"></iframe>
<form name="display_result" style="block">
<input type="radio" name="showtype" onclick="changeViewType();" checked>構文
 <input type="radio" onclick="changeViewType();" name="showtype">表示
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
<style type="text/css">
@import url(http://scp-jp.wdfiles.com/local--files/japanese-syntax/scp-WikidotCss.css);
</style>
    <title>Wikidot構文表示例</title>
</head>
<body>
</body>
</html>
特に指定がない限り、このサイトのコンテンツには次のライセンスが適用されます: Creative Commons Attribution-ShareAlike 3.0 License