• Publicity: Public Only All

messages-format-procs.tcl

message formatting procs

Location:
packages/forums/tcl/messages-format-procs.tcl

Procedures in this file

Detailed information

forum::format::emoticons (public)

 forum::format::emoticons -content content

Convert smileys (emoticons) in supplied content into emoji HTML entities.

Switches:
-content
(required)
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_web_forums_message_and_reply web_forums_message_and_reply (test forums) forum::format::emoticons forum::format::emoticons test_web_forums_message_and_reply->forum::format::emoticons packages/forums/lib/message/row.tcl packages/forums/ lib/message/row.tcl packages/forums/lib/message/row.tcl->forum::format::emoticons packages/forums/lib/message/row2.tcl packages/forums/ lib/message/row2.tcl packages/forums/lib/message/row2.tcl->forum::format::emoticons packages/forums/www/load-message-content.tcl packages/forums/ www/load-message-content.tcl packages/forums/www/load-message-content.tcl->forum::format::emoticons

Testcases:
web_forums_message_and_reply

forum::format::reply_subject (public)

 forum::format::reply_subject parent_subject

Generates a subject string for a reply to an existing message. The prefix is always added using the system-wide locale to avoid the uncontrollable growth of the subject in a multi-language environment.

Parameters:
parent_subject

Partial Call Graph (max 5 caller/called nodes):
%3 forum::message::initial_message forum::message::initial_message (public, deprecated) forum::format::reply_subject forum::format::reply_subject forum::message::initial_message->forum::format::reply_subject packages/forums/lib/message/post.tcl packages/forums/ lib/message/post.tcl packages/forums/lib/message/post.tcl->forum::format::reply_subject lang::message::lookup lang::message::lookup (public) forum::format::reply_subject->lang::message::lookup lang::system::site_wide_locale lang::system::site_wide_locale (public) forum::format::reply_subject->lang::system::site_wide_locale

Testcases:
No testcase defined.
[ hide source ] | [ make this the default ]

Content File Source

ad_library {
    message formatting procs
}

namespace eval forum::format {

    ad_proc -public reply_subject { parent_subject } {

        Generates a subject string for a reply to an existing message.

        The prefix is always added using the system-wide locale to avoid
        the uncontrollable growth of the subject in a multi-language
        environment.

    } {

        set prefix [lang::message::lookup [lang::system::site_wide_locale] forums.Re]
        set prefix "[string trim $prefix] "

        # trim multiple leading prefixes:
        regsub "^($prefix)+" $parent_subject {} parent_subject

        set subject [concat $prefix $parent_subject]

        return $subject

    }

    d_proc emoticons {
        {-content:required}
    } {
        Convert smileys (emoticons) in supplied content into emoji
        HTML entities.

        @see https://unicode.org/emoji/charts/full-emoji-list.html
    } {
        set emoticons_map [list]

        # if you change this list, consider changing
        # www/doc/emoticons.adp as well
        set emoticons_map {
            ":-)" "😊"
            ";-)" "😉"
            ":-D" "😃"
            "8-)" "😎"
            ":-(" "😟"
            ";-(" "😢"
            ":-O" "😱"
            ":-/" "🤔"
        }
        return [string map $emoticons_map $content]
    }

}

# Local variables:
#    mode: tcl
#    tcl-indent-level: 4
#    indent-tabs-mode: nil
# End: