Перейти к основному содержанию
Тема: BBCode в SMF (Прочитано 15288 раз) предыдущая тема - следующая тема

BBCode в SMF

http://club.shelek.ru/viewart.php?id=274

Некоторые сведения о BBcode в SMF.

Все теги набираются в нижнем регистре.
Все теги классифицированы по типам.

Специфичная информация.
Типы (из комментария в Source/Subs.php):

    (missing): [tag]parsed content[/tag]
    unparsed_equals: [tag=xyz]parsed content[/tag]
    parsed_equals: [tag=parsed data]parsed content[/tag]
    unparsed_content: [tag]unparsed content[/tag]
    closed: [tag]...[tag /]
    unparsed_commas: [tag=1,2,3]parsed content[/tag]
    unparsed_commas_content: [tag=1,2,3]unparsed content[/tag]
    unparsed_equals_content: [tag=...]unparsed content[/tag]


То же, но по-русски:

    (missing). Простой тег. Текст между тегами может содержать другие теги. Может содержать именованные параметры.
    Пример:
    unparsed_equals. Необрабатываемый параметр. Текст между тегами может содержать другие теги.
    Пример: text
    parsed_equals. Обрабатываемый параметр. Текст между тегами может содержать другие теги.
    Пример:
Цитата: source
text

    unparsed_content. Текст между тегами может содержать любой текст - он не обрабатывается.
    Пример: mailbox@example.com
    closed. Одиночный тег без параметров. Пример:

    unparsed_commas. Параметр-список. Текст между тегами может содержать другие теги.
    Пример: [shadow=black,bottom]text[/shadow]
    unparsed_commas_content. Параметр-список. Текст между тегами может содержать любой текст - он не обрабатывается.
    Пример: [flash=200,100]http://flash url[/flash]
    unparsed_equals_content. Параметр сложного формата. Текст между тегами может содержать любой текст - он не обрабатывается.
    Пример:
Код: (main.cpp,1,10-12) [Выделить]
code



Необрабатываемый текст может содержать конструкции, похожие на BB-code, но не обрабатываемые движком.
Также теги могут иметь дополнительные именованные параметры.

Re: BBCode в SMF

Ответ #1
      /* The following bbc are formatted as an array, with keys as follows:

         tag: the tag's name - should be lowercase!

         type: one of...
            - (missing): [tag]parsed content[/tag]
            - unparsed_equals: [tag=xyz]parsed content[/tag]
            - parsed_equals: [tag=parsed data]parsed content[/tag]
            - unparsed_content: [tag]unparsed content[/tag]
            - closed: [tag], [tag/], [tag /]
            - unparsed_commas: [tag=1,2,3]parsed content[/tag]
            - unparsed_commas_content: [tag=1,2,3]unparsed content[/tag]
            - unparsed_equals_content: [tag=...]unparsed content[/tag]

         parameters: an optional array of parameters, for the form
           [tag abc=123]content[/tag].  The array is an associative array
           where the keys are the parameter names, and the values are an
           array which may contain the following:
            - match: a regular expression to validate and match the value.
            - quoted: true if the value should be quoted.
            - validate: callback to evaluate on the data, which is $data.
            - value: a string in which to replace $1 with the data.
              either it or validate may be used, not both.
            - optional: true if the parameter is optional.

         test: a regular expression to test immediately after the tag's
           '=', ' ' or ']'.  Typically, should have a \] at the end.
           Optional.

         content: only available for unparsed_content, closed,
           unparsed_commas_content, and unparsed_equals_content.
           $1 is replaced with the content of the tag.  Parameters
           are replaced in the form {param}.  For unparsed_commas_content,
           $2, $3, ..., $n are replaced.

         before: only when content is not used, to go before any
           content.  For unparsed_equals, $1 is replaced with the value.
           For unparsed_commas, $1, $2, ..., $n are replaced.

         after: similar to before in every way, except that it is used
           when the tag is closed.

         disabled_content: used in place of content when the tag is
           disabled.  For closed, default is '', otherwise it is '$1' if
           block_level is false, '<div>$1</div>' elsewise.

         disabled_before: used in place of before when disabled.  Defaults
           to '<div>' if block_level, '' if not.

         disabled_after: used in place of after when disabled.  Defaults
           to '</div>' if block_level, '' if not.

         block_level: set to true the tag is a "block level" tag, similar
           to HTML.  Block level tags cannot be nested inside tags that are
           not block level, and will not be implicitly closed as easily.
           One break following a block level tag may also be removed.

         trim: if set, and 'inside' whitespace after the begin tag will be
           removed.  If set to 'outside', whitespace after the end tag will
           meet the same fate.

         validate: except when type is missing or 'closed', a callback to
           validate the data as $data.  Depending on the tag's type, $data
           may be a string or an array of strings (corresponding to the
           replacement.)

         quoted: when type is 'unparsed_equals' or 'parsed_equals' only,
           may be not set, 'optional', or 'required' corresponding to if
           the content may be quoted.  This allows the parser to read
           [tag="abc]def[esdf]"] properly.

         require_parents: an array of tag names, or not set.  If set, the
           enclosing tag *must* be one of the listed tags, or parsing won't
           occur.

         require_children: similar to require_parents, if set children
           won't be parsed if they are not in the list.

         disallow_children: similar to, but very different from,
           require_children, if it is set the listed tags will not be
           parsed inside the tag.

         parsed_tags_allowed: an array restricting what BBC can be in the
           parsed_equals parameter, if desired.