Loading...
 

Code 플러그인

위키 플러그인 은 페이지 상에서 (위키 문법을 포함한) 그 어떠한 소스코드를 실행하지 않고 표시하기 위하여 사용됩니다. 코드는 고정폭 폰트로 회색 상자 안에 표시됩니다. 상자에 제목이 추가될 수 있으며 코드는 하이라이트 표시되고 줄 번호가 추가될 수 있습니다.

GeSHi (Generic Syntax Highlighter) 라고 불리는 써드파티 프로그램이 관리자에 의하여 티키 사이트에 설치된 경우, 하이라이트 기능은 매우 향상 됩니다. GeSHi 없이는, php 문법만이 하이라이트되고 이마저 줄번호매기기가 꺼져있을 때만 가능합니다. GeSHi (안정화 버전)로는, over 110 개가 넘는 언어가 하이라이트될 수 있으며 줄 번호와 함께 사용될 수 있습니다. 또한 GeSHi (안정화 버전)로는, 코드 내부의 주요 용어들이 해당 언어의 웹사이트에서 용어를 설명하는 문서 페이지로 링크될 것입니다.

이 플러그인은 문법을 이스케이프 할 것입니다, 이는 티키로 하여금 의도하지 않은 구문분석을 하는 것을 방지하게 될 것이지만, 귀하께서 사전에 유의하셔야할 몇몇 난해한 영역이 존해합니다. XML 혹은 SGML 문법은 문서에 HTML 플래그를 활성화하였다면 오작동을 야기할 수도 있을 것입니다. 또한 이는 부등호 표시에 대하여 매우 유의하여야 한다는 점을 의미합니다.

\n"; } {CODE}


아직 파악하지 못하셨다면, code 플러그인의 사용법의 예제는 실제로 code 플러그인을 사용하고 있습니다 - 근사하죠? code 태그들을 재귀적으로 사용할 수 있으며, 종료하는 것을 제외한 모든 것을 렌더할 것입니다. 주의: 이는 짝이 맞지 않을 경우, 문제를 야기할 수 있습니다.

1.1. 사용법

위키 페이지 내부에서 코드를 표시하려면 다음 문법을 사용하십시오:

Copy to clipboard
{CODE(colors=php ln="1")} getHomeMenu(); if($menu->link != "") { print "\t
\n"; $menu->printMenu(); print "\t

1.2. 매개변수

매개변수 허용값 효과 적용
ln GeSHi 없으면: 0 혹은 1 1로 설정되면 줄 번호를 추가. 경고: 'colors (색상) 매개변수가 동시에 설정된 경우 작동하지 않음.
GeSHi가 있으면: 임의의 숫자 주어진 숫자로 시작하여 줄 번호를 추가. 'colors (색상) 매개변수가 설정되어도 작동함
colors GeSHi가 없다면: php 혹은 highlights php (전용)에 대하여 코드 문법 색상 하이라이트를 추가. 하이라이트가 작동하려면 표시된 코드의 도입부에 php 태그가 반드시 포함되어야만 함. colorsln 매개변수는 동시에 작동하지 않음.
GeSHi가 있다면: GeSHI 가 지원하는 임의의 언어명 (즉 php, javascript, css, html). GeSHi에 대한 추가 정보는 아래를 살펴보십시오. 코드 문법에 색상 하이라이트를 추가하고 주요 용어들은 언어의 웹사이트 상의 문서 페이지로 연결됩니다. 하이라이트 기능이 작동시키려할 때 도입부분의 별도의 태그는 필요 없습니다. 줄 번호매기기와 함께 사용될 수 있습니다.
caption 0 혹은 1 이는 코드 상자에 대한 자막을 제공할 수 있게 합니다
wrap 0 혹은 1 이는 필요한 경우 코드에서 자동 줄바꿈을 활성화 합니다.
rtl 0 혹은 1 이는 우에서 좌 방향 텍스트 표기를 활성화 합니다

\n"; } {CODE}


다음과 같이 표기됩니다:
Image

 주의
GeSHi가 설치되지 않았고 티키6 혹은 이전 버전을 사용할 때 php에 대한 색상 하이라이트가 작동하려면 도입부에 php 태그를 포함하는 것이 중요합니다.

1.3. GeSHi 없이 Codemirror 로 하는 예제 (티키 8+)

아래의 코드는:

Copy to clipboard
{CODE(colors=php)} getHomeMenu(); if($menu->link != "") { print "\t
\n"; $menu->printMenu(); print "\t

1.3.1. 코드미러 (Codemirror) - 지원하는 언어

clike
clojure
coffeescript
css
diff
groovy
haskell
htmlmixed
javascript
jinja2
lua
markdown
ntriples
pascal
perl
php
plsql
python
r
rst
ruby
rust
scheme
smalltalk
sparql
stex
tiddlywiki
tiki
velocity
xml
xmlpure
yaml



1.4. GeSHi - Generic Syntax Highlighter (Tiki6 LTS)

1.4.1. Geshi - 지원 언어

티키 2.0이후로., if the GeSHi 패키지 가 서버에 부가적으로 설치된 경우, 많은 마크업이 적절하게 인식이되고 하이라이트 될 것입니다:

 주의
GeSHi의 안정화 버전을 설치하고 최신 개발 버전을 설치하지 말도록 유의하십시오, 그렇지 않으면 몇 개 안되는 언어만 제공되며 기능성에 문제가 있을 수 있습니다.


2010년 8월 GeSHi의 1_0_X의 최신 안정화 배포판인 Geshi 1.0.8.9에서 지원하는 언어의 목록, (Geshi 에 의하여사용되는 각각의 언어코드의 정확한 문법과 함께):

  • 4cs
  • 6502acme
  • 6502kickass
  • 6502tasm
  • 68000devpac
  • abap
  • actionscript3
  • actionscript
  • ada
  • algol68
  • apache
  • applescript
  • apt_sources
  • asm
  • asp
  • autoconf
  • autohotkey
  • autoit
  • avisynth
  • awk
  • bash
  • basic4gl
  • bf
  • bibtex
  • blitzbasic
  • bnf
  • boo
  • caddcl
  • cadlisp
  • cfdg
  • cfm
  • chaiscript
  • cil
  • clojure
  • c_mac
  • cmake
  • cobol
  • c
  • cpp
  • cpp-qt
  • csharp
  • css
  • cuesheet
  • dcs
  • delphi
  • diff
  • div
  • dos
  • dot
  • d
  • ecmascript
  • eiffel
  • email
  • e
  • erlang
  • f1
  • fo
  • fortran
  • freebasic
  • fsharp
  • gambas
  • gdb
  • genero
  • genie
  • gettext
  • glsl
  • gml
  • gnuplot
  • go
  • groovy
  • gwbasic
  • haskell
  • hicest
  • hq9plus
  • html4strict
  • icon
  • idl
  • ini
  • inno
  • intercal
  • io
  • java5
  • java
  • javascript
  • j
  • jquery
  • kixtart
  • klonec
  • klonecpp
  • latex
  • lb
  • lisp
  • locobasic
  • logtalk
  • lolcode
  • lotusformulas
  • lotusscript
  • lscript
  • lsl2
  • lua
  • m68k
  • magiksf
  • make
  • mapbasic
  • matlab
  • mirc
  • mmix
  • modula2
  • modula3
  • mpasm
  • mxml
  • mysql
  • newlisp
  • nsis
  • oberon2
  • objc
  • objeck
  • ocaml-brief
  • ocaml
  • oobas
  • oracle11
  • oracle8
  • oxygene
  • oz
  • pascal
  • pcre
  • perl6
  • perl
  • per
  • pf
  • php-brief
  • php
  • pic16
  • pike
  • pixelbender
  • plsql
  • postgresql
  • povray
  • powerbuilder
  • powershell
  • progress
  • prolog
  • properties
  • providex
  • purebasic
  • python
  • qbasic
  • q
  • rails
  • rebol
  • reg
  • robots
  • rpmspec
  • rsplus
  • ruby
  • sas
  • scala
  • scheme
  • scilab
  • sdlbasic
  • smalltalk
  • smarty
  • sql
  • systemverilog
  • tcl
  • teraterm
  • text
  • thinbasic
  • tsql
  • typoscript
  • unicon
  • vala
  • vbnet
  • vb
  • verilog
  • vhdl
  • vim
  • visualfoxpro
  • visualprolog
  • whitespace
  • whois
  • winbatch
  • xbasic
  • xml
  • xorg_conf
  • xpp
  • z80
  • zxbasic


To be certain which languages your installation of GeSHi covers, check the language files in directory where GeSHi was installed.

1.4.2. Installing GeSHi

Since GeSHi has been licensed under GPL - which is incompatible with Tiki's LGPL licence - the administrator will need to manually download a copy of GeSHI, from their sourceforge page or through subversion.

It is strongly recommended to install the latest stable version of GeSHi (not the latest development version) because the stable version handles many more languages and has more functionality.

To download Geshi, see: http://qbnz.com/highlighter/geshi-doc.html#getting-geshi

Once you have you copy of Geshi, you should place it in your own tiki's lib/geshi/ directory, so that once placed there the folder structure is something like:

Copy to clipboard
./lib/geshi/contrib/ ./lib/geshi/docs/ ./lib/geshi/geshi/ ./lib/geshi/geshi.php


You could alternatively install the stable version of GeSHI with the Debian/Ubuntu package "php-geshi" (check if the version of the package is fresh enough for your needs, compared to the latest stable from their website or subversion repository).

1.4.3. Examples with GeSHi


This code:

Copy to clipboard
{CODE(ln=1 colors=html4strict)} Hi!

This is the content of the page.

A   ...    Z
– {CODE}


Would produce:

Screenshot of the output
Screenshot of the output


Which should be the same to the real-time output in doc.tw.o once the geshi package is properly installed:

Copy to clipboard
Hi!

This is the content of the page.

A   ...    Z

 Note
To highlight HTML, the colors parameter needs to be set to "html4strict" when using the stable version of GeSHi. The exact spelling required for a language is determined by the name of the language file in the GeSHi directory.

1.5. Related pages

alias

Plugin Code, ko

List Slides