CodeIgniter 문서 작성

CodeIgniter는 다양한 형식의 문서를 생성하기 위해, 포맷팅을 핸들하기 위해 reStructuredText 를 사용하는 Sphinx를 사용합니다. 만약 Markdown 이나 Textile 에 친숙하다면, reStructuredText 를 빠르게 파악할 것입니다. 초점은 가독성과 사용자 편의에 있습니다. 그들은 매우 기술적인 내용일 수 있지만, 우리는 항상 인간을 위해 씁니다!

내용의 로컬 테이블은 항상 다음을 포함하여야 합니다. 그것은 다음을 삽입하여 자동으로 생성됩니다:

.. contents::
        :local:

.. raw:: html

<div class="custom-index container"></div>

The <div> that is inserted as raw HTML is a hook for the documentation’s JavaScript to dynamically add links to any function and method definitions contained in the current page.

필요한 도구 Tools Required

렌더링된 HTML, ePub, PDF, 등을 보기 위해서는, Sphinx 를 위한 PHP domain extension 과 함께 Sphinx 를 설치해야 합니다. 기본 요구 사항은 파이썬을 설치하는 것입니다. 마지막으로, Pygments의 CI Lexer를 설치합니다, 그래서 코드 블록이 제대로 하이라이트 될 수있습니다.

easy_install "sphinx==1.2.3"
easy_install sphinxcontrib-phpdomain

그런 다음 CI Lexer 를 설치하기 위해 문서 저장소 내부 cilexer 폴더에 있는 README 파일의 지시를 따릅니다.

페이지 및 섹션 제목과 부제 Page and Section Headings and Subheadings

Heading 은 페이지 내에서 순서 및 섹션을 제공할 뿐만 아니라 자동 페이지와 같은 문서 내용의 테이블을 모두 구축하는 데 사용됩니다. Heading 은 텍스트의 일부로 밑줄로 특정 문자를 사용하여 형성됩니다. 페이지 제목이나 섹션 제목과 같은 주요 Heading 또한 overline을 사용합니다. 다른 heading 들은 단지 underline 을 사용합니다, 다음 계층 구조와 함께:

# with overline for page titles
* with overline for major sections
= for subsections
- for subsubsections
^ for subsubsubsections
" for subsubsubsubsections (!)

TextMate ELDocs Bundle 은 다음 탭 트리거를 생성하는 것을 도울 수 있습니다:

title->

        ##########
        Page Title
        ##########

sec->

        *************
        Major Section
        *************

sub->

        Subsection
        ==========

sss->

        SubSubSection
        -------------

ssss->

        SubSubSubSection
        ^^^^^^^^^^^^^^^^

sssss->

        SubSubSubSubSection (!)
        """""""""""""""""""""""

함수 문서 Method Documentation

써드 파티 개발자를 위한 함수를 문서화할 때, Sphinx 는 지시문을 단순하게 지원하고 유지합니다. 예를 들면 다음 ReST 를 보세요:

.. php:class:: Some_class

        .. php:method:: some_method ( $foo [, $bar [, $bat]])

                이 함수는 어떤 작업을 수행합니다. ``$bar`` 배열은 어떤 것을 담고 있어야 합니다. 
				그리고 ``$bat`` 은 옵션입니다.

                :param int $foo: the foo id to do something in
                :param mixed $bar: A data array that must contain a something and something else
                :param bool $bat: whether or not to do something
                :returns: FALSE on failure, TRUE if successful
                :rtype: bool

                ::

                        $this->load->library('some_class');

                        $bar = array(
                                'something'             => 'Here is this parameter!',
                                'something_else'        => 42
                        );

                        $bat = $this->some_class->should_do_something();

                        if ($this->some_class->some_method(4, $bar, $bat) === FALSE)
                        {
                                show_error('An Error Occurred Doing Some Method');
                        }

                .. note:: some_method() 를 사용할 때 주의해야 하는 것이 있습니다.
                                진짜로.

                 :meth:`Some_class::should_do_something` 를 참조하세요


        .. php:method:: should_do_something()

                :returns: Whether or not something should be done
                :rtype: bool

위는 아래를 생성합니다:

class Some_class
some_method($foo[, $bar[, $bat]])

이 함수는 어떤 작업을 수행합니다. $bar 배열은 어떤 것을 담고 있어야 합니다. 그리고 $bat 은 옵션입니다.

인수:
  • $foo (int) – the foo id to do something in
  • $bar (mixed) – A data array that must contain a something and something else
  • $bat (bool) – whether or not to do something
반환값:

FALSE on failure, TRUE if successful

반환형:

bool

$this->load->library('some_class');

$bar = array(
        'something'             => 'Here is this parameter!',
        'something_else'        => 42
);

$bat = $this->some_class->should_do_something();

if ($this->some_class->some_method(4, $bar, $bat) === FALSE)
{
        show_error('An Error Occurred Doing Some Method');
}

Note

some_method() 를 사용할 때 주의해야 하는 것이 있습니다. 진짜로.

Some_class::should_do_something() 를 참조하세요

should_do_something()
반환값:Whether or not something should be done
반환형:bool