このページは2007年 11月 11日, 09:01に更新されました by SteveB

Syntax

From $1

This library contains functions for highlighting syntax of popular programming languages.  関連リンク: Extension Overview, DekiScript Overview, Extension Demos.

Assembly: mindtouch.deki.services
SID: http://services.mindtouch.com/deki/d...2007/06/syntax

This extension is based on the work done by Alex Gorbatchev on the syntaxhighlighter project

Functions:

  1. syntax.cpp
  2. syntax.csharp
  3. syntax.css
  4. syntax.delphi
  5. syntax.html
  6. syntax.java
  7. syntax.javascript
  8. syntax.php
  9. syntax.python
  10. syntax.ruby
  11. syntax.sql
  12. syntax.vb
  13. syntax.xml

syntax.cpp(code : str, collapse : bool, firstline : num) : xml

Highlight C/C++ syntax.

Parameters:

Name Type Description
code
str
Source code to highlight.
collapse
bool
Optional.  Collapse code view (default: false)
firstline
num
Optional.  First line number (default: 1)

Samples:


Output

To embed highlighted C/C++:

#include <iostream.h>
main()
{
    cout << "Hello World!" << endl;
    return 0;
}

./SyntaxCpp.JPG


syntax.csharp(code : str, collapse : bool, firstline : num) : xml

Highlight C# syntax.

Parameters:

Name Type Description
code
str
Source code to highlight.
collapse
bool
Optional.  Collapse code view (default: false)
firstline
num
Optional.  First line number (default: 1)

Samples:


Output

To embed highlighted C#:

using System;
class HelloWorld
{
    public static int Main(String[] args)
    {
        Console.WriteLine("Hello, World!");
        return 0;
    }
}

./SyntaxCsharp.JPG


syntax.css(code : str, collapse : bool, firstline : num) : xml

Highlight CSS syntax.

Parameters:

Name Type Description
code
str
Source code to highlight.
collapse
bool
Optional.  Collapse code view (default: false)
firstline
num
Optional.  First line number (default: 1)

Samples:


Output

To embed highlighted CSS:

body:before {
    content: "Hello World!";
}

./SyntaxCss.JPG


syntax.delphi(code : str, collapse : bool, firstline : num) : xml

Highlight Delphi syntax.

Parameters:

Name Type Description
code
str
Source code to highlight.
collapse
bool
Optional.  Collapse code view (default: false)
firstline
num
Optional.  First line number (default: 1)

Samples:


Output

To embed highlighted Delphi:

Program Hello_World;
{$APPTYPE CONSOLE}
Begin
  WriteLn('Hello World!');
End.

./SyntaxDelphi.JPG


syntax.html(code : str, collapse : bool, firstline : num) : xml

Highlight HTML syntax.

Parameters:

Name Type Description
code
str
Source code to highlight.
collapse
bool
Optional.  Collapse code view (default: false)
firstline
num
Optional.  First line number (default: 1)

Samples:


Output

To embed highlighted HTML:

<HTML>
<HEAD>
<TITLE>Hello World!</TITLE>
</HEAD>
<BODY>
Hello World!
</BODY>
</HTML>

./SyntaxHtml.JPG


syntax.java(code : str, collapse : bool, firstline : num) : xml

Highlight Java syntax.

Parameters:

Name Type Description
code
str
Source code to highlight.
collapse
bool
Optional.  Collapse code view (default: false)
firstline
num
Optional.  First line number (default: 1)

Samples:


Outpu

To embed highlighted Java:

class HelloWorld {
  static public void main( String args[] ) {
    System.out.println( "Hello World!" );
  }
}

./SyntaxJava.JPG


syntax.javascript(code : str, collapse : bool, firstline : num) : xml

Highlight JavaScript syntax.

Parameters:

Name Type Description
code
str
Source code to highlight.
collapse
bool
Optional.  Collapse code view (default: false)
firstline
num
Optional.  First line number (default: 1)

Samples:


Outpu

To embed highlighted JavaScript:

function Hello () {
  alert("Hello World!");
}

./SyntaxJavaScript.JPG


syntax.php(code : str, collapse : bool, firstline : num) : xml

Highlight PHP syntax.

Parameters:

Name Type Description
code
str
Source code to highlight.
collapse
bool
Optional.  Collapse code view (default: false)
firstline
num
Optional.  First line number (default: 1)

Samples:


Outpu

To embed highlighted PHP:

<?php
  // Hello World in PHP
  echo 'Hello World!';
?>

./SyntaxPhp.JPG


syntax.python(code : str, collapse : bool, firstline : num) : xml

Highlight Python syntax.

Parameters:

Name Type Description
code
str
Source code to highlight.
collapse
bool
Optional.  Collapse code view (default: false)
firstline
num
Optional.  First line number (default: 1)

Samples:


Outpu

To embed highlighted Python:

print "Hello World!"

./SyntaxPython.JPG


syntax.ruby(code : str, collapse : bool, firstline : num) : xml

Highlight Ruby syntax.

Parameters:

Name Type Description
code
str
Source code to highlight.
collapse
bool
Optional.  Collapse code view (default: false)
firstline
num
Optional.  First line number (default: 1)

Samples:


Outpu

To embed highlighted Ruby:

puts "Hello World!"

./SyntaxRuby.JPG


syntax.sql(code : str, collapse : bool, firstline : num) : xml

Highlight SQL syntax.

Parameters:

Name Type Description
code
str
Source code to highlight.
collapse
bool
Optional.  Collapse code view (default: false)
firstline
num
Optional.  First line number (default: 1)

Samples:


Outpu

To embed highlighted SQL:

SELECT 'Hello World!';

./SyntaxSql.JPG


syntax.vb(code : str, collapse : bool, firstline : num) : xml

Highlight Visual Basic syntax.

Parameters:

Name Type Description
code
str
Source code to highlight.
collapse
bool
Optional.  Collapse code view (default: false)
firstline
num
Optional.  First line number (default: 1)

Samples:


Outpu

To embed highlighted Visual Basic:

Private Sub Form_Load()
Print "Hello World!"
End Sub

./SyntaxVb.JPG


syntax.xml(code : str, collapse : bool, firstline : num) : xml

Highlight XML syntax.

Parameters:

Name Type Description
code
str
Source code to highlight.
collapse
bool
Optional.  Collapse code view (default: false)
firstline
num
Optional.  First line number (default: 1)

Samples:


Outpu

To embed highlighted XML:

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="HelloWorld.xsl" ?>
<text><string>Hello World!</string></text>

./SyntaxXml.JPG
ファイルサイズ日付添付したユーザ 
 SyntaxCpp.JPG
説明なし
8.42 kB2007年 10月 19日, 22:54BrigetteKアクション
 SyntaxCsharp.JPG
説明なし
12.69 kB2007年 10月 19日, 22:54BrigetteKアクション
 SyntaxCss.JPG
説明なし
5.62 kB2007年 10月 19日, 22:54BrigetteKアクション
 SyntaxDelphi.JPG
説明なし
8.48 kB2007年 10月 19日, 22:57BrigetteKアクション
 SyntaxHtml.JPG
説明なし
10.42 kB2007年 10月 19日, 22:57BrigetteKアクション
 SyntaxJava.JPG
説明なし
9.9 kB2007年 10月 19日, 22:57BrigetteKアクション
 SyntaxJavaScript.JPG
説明なし
5.73 kB2007年 10月 19日, 23:10BrigetteKアクション
SyntaxPhp.JPG
説明なし
7.28 kB2007年 10月 19日, 23:25BrigetteKアクション
SyntaxPython.JPG
説明なし
4.67 kB2007年 10月 19日, 23:29BrigetteKアクション
SyntaxRuby.JPG
説明なし
4.6 kB2007年 10月 19日, 23:29BrigetteKアクション
 SyntaxSql.JPG
説明なし
4.53 kB2007年 10月 19日, 23:13BrigetteKアクション
 SyntaxVb.JPG
説明なし
6.7 kB2007年 10月 19日, 23:10BrigetteKアクション
 SyntaxXml.JPG
説明なし
11.48 kB2007年 10月 19日, 23:10BrigetteKアクション
コメント(0)
あなたはコメントを投稿するには ログイン しなければなりません。