build html for messages
545520
function buildMessageHTML(messageText, messageSenderId, messageDateSent, attachmentFileId, messageId) {
    var messageAttach;

    if (attachmentFileId) {
        messageAttach = '<img src="' + QB.content.privateUrl(attachmentFileId) + '" alt="attachment" class="attachments img-responsive" />';
    }

    var delivered = '<img class="icon-small" src="images/delivered.jpg" alt="" id="delivered_' + messageId + '">';
    var read = '<img class="icon-small" src="images/read.jpg" alt="" id="read_' + messageId + '">';

    var messageTextHtml = messageText;
    if (messageAttach) {
        messageTextHtml = messageAttach;
    }

    var messageHtml =
        '<div class="list-group-item" id="' + messageId + '">' +
        '<time datetime="' + messageDateSent + '" class="pull-right">' +
        jQuery.timeago(messageDateSent) +
        '</time>' +

        '<h4 class="list-group-item-heading">' + messageSenderId + '</h4>' +
        '<p class="list-group-item-text">' +
        messageTextHtml +
        '</p>' +
        delivered + read +
        '</div>';
    return messageHtml;
}
1040925
def inbox(request, template_name='django_messages/inbox.html'):
    
    message_list = Message.objects.inbox_for(request.user)
    return render(request, template_name, {
        'message_list': message_list,
    })
488602
def message(msg, indent=False, mtype='standard', caption=False):
    """"""
    if caption:
        msg = '\n' + msg + '\n' + '-'*len(msg) + '\n'
    if mtype == 'warning':
        msg = colorlog('Warning:  ' + msg, 'yellow')
    if mtype == 'error':
        msg = colorlog('Error:  ' + msg, 'red')
    if mtype == 'debug':
        msg = colorlog('Debug:  ' + msg, 'pink')
    if mtype == 'info':
        msg = colorlog('Info:  ' + msg, 'green')
    if indent:
        msg = '  ' + msg
    sys.stderr.write(msg)
1158580
function buildHTML(segments) {
		var html = '';
		for (var i=0; i<segments.length; i++) {
			html += buildHTMLForSegment(segments[i]);
		}
		return html;
	}
788322
def get_message_plain_text(msg: Message):
    
    if msg.body:
        return msg.body

    if BeautifulSoup is None or not msg.html:
        return msg.html

    plain_text = '\n'.join(line.strip() for line in
                           BeautifulSoup(msg.html, 'lxml').text.splitlines())
    return re.sub(r'\n\n+', '\n\n', plain_text).strip()
487024
def build_table(self, msg):
        """"""
        rows = msg.split('\n')
        if rows:
            header_row, *body_rows = rows
            self.create_md_row(header_row, True)
            for row in body_rows:
                self.create_md_row(row)
513454
public static function renderMessages() : string {
		$result = '';
		// we need to see if we have postponed messages and render them first
		$postponed = Session::get(['numbers', 'messages']);
		if (!empty($postponed)) {
			Session::set(['numbers', 'messages'], []);
			foreach ($postponed as $k => $v) {
				$result.= \HTML::message(['options' => $v, 'type' => $k]);
			}
		}
		// regular messages
		$messages = Application::get(array('messages'));
		if (!empty($messages)) {
			foreach ($messages as $k => $v) {
				$result.= \HTML::message(['options' => $v, 'type' => $k]);
			}
		}
		return $result;
	}
1211494
def construct_message(self, email=None):
        
        # add subject, from and to
        self.multipart['Subject'] = self.subject
        self.multipart['From'] = self.config['EMAIL']
        self.multipart['Date'] = formatdate(localtime=True)
        if email is None and self.send_as_one:
            self.multipart['To'] = ", ".join(self.addresses)
        elif email is not None and self.send_as_one is False:
            self.multipart['To'] = email
        # add ccs
        if self.ccs is not None and self.ccs:
            self.multipart['Cc'] = ", ".join(self.ccs)
        # add html and text body
        html = MIMEText(self.html, 'html')
        alt_text = MIMEText(self.text, 'plain')
        self.multipart.attach(html)
        self.multipart.attach(alt_text)
        for file in self.files:
            self.multipart.attach(file)
292840
public String render(Collection<Message5WH> messages){
		StrBuilder ret = new StrBuilder(50);
		for(Message5WH msg : messages){
			ret.appendln(this.render(msg));
		}
		return ret.toString();
	}
428174
def make_messages(context: Context, javascript=False, fuzzy=False):
    
    kwargs = {
        'all': True,
        'keep_pot': True,
        'no_wrap': True,
    }
    if fuzzy:
        kwargs['allow_fuzzy'] = True
    if javascript:
        kwargs.update(domain='djangojs', ignore_patterns=['*.bundle.js'])
    with in_dir(context.app.django_app_name):
        return context.management_command('makemessages', **kwargs)
218992
def render_message(type = :info, msg = nil, &blk)
      icon_class = message_icon_class(type)
      if block_given?
        content_tag :div, render_icon(icon_class) + capture(&blk), class: "#{type} message"
      else
        content_tag :div, render_icon(icon_class) + msg, class: "#{type} message"
      end
    end
651556
protected function buildMessageWithAttachments()
    {
        $message = array();

        if (!empty($this->plainMessage) || !empty($this->htmlMessage)) {
            array_push($message, "--{$this->boundaryMixed}");
        }

        if (!empty($this->plainMessage) && !empty($this->htmlMessage)) {
            array_push($message, "Content-Type: multipart/alternative; boundary={$this->boundaryAlternative}");
            array_push($message, '');
            array_push($message, "--{$this->boundaryAlternative}");
            $message = array_merge($message, $this->buildPlainMessageHeader());
            array_push($message, $this->plainMessage);
            array_push($message, "--{$this->boundaryAlternative}");
            $message = array_merge($message, $this->buildHtmlMessageHeader());
            array_push($message, $this->htmlMessage);
            array_push($message, "--{$this->boundaryAlternative}--");
            array_push($message, '');
        } elseif (!empty($this->plainMessage)) {
            $message = array_merge($message, $this->buildPlainMessageHeader());
            array_push($message, $this->plainMessage);
        } elseif (!empty($this->htmlMessage)) {
            $message = array_merge($message, $this->buildHtmlMessageHeader());
            array_push($message, $this->htmlMessage);
        }
        foreach ($this->attachments as $attachment) {
            array_push($message, "--{$this->boundaryMixed}");
            array_push($message, "Content-Type: {$attachment['type']}; name=\"{$attachment['title']}\"");
            array_push($message, 'Content-Transfer-Encoding: base64');
            array_push($message, 'Content-Disposition: attachment');
            array_push($message, '');
            array_push($message, $this->buildAttachmentContent($attachment['path']));
        }
        array_push($message, "--{$this->boundaryMixed}--");

        return implode(self::LINE_BREAK, $message);
    }
867220
function (message) {
  var newMessage = "";
  if (requestNamespace) {
    if (requestNamespace.get('reqId')) {
      newMessage += "[" + requestNamespace.get('reqId') + "]";
    }
    if (requestNamespace.get('workerId')) {
      newMessage += "[Worker - " + requestNamespace.get('workerId') + "]";
    }
    const hrTime = process.hrtime();
    newMessage += "[" + timeInMilli(hrTime) + "]";
  }
  newMessage += message;
  return newMessage;
}
570895
def _htmlify_text(self, s):
    """"""
    colored = self._handle_ansi_color_codes(html.escape(s))
    return linkify(self._buildroot, colored, self._linkify_memo).replace('\n', '</br>')
887441
def _build_message(self, to, text, subject=None, mtype=None, unsubscribe_url=None):
        """"""
        # TODO Maybe file attachments handling through `files` message_model context var.

        if subject is None:
            subject = u'%s' % _('No Subject')

        if mtype == 'html':
            msg = self.mime_multipart()
            text_part = self.mime_multipart('alternative')
            text_part.attach(self.mime_text(strip_tags(text), _charset='utf-8'))
            text_part.attach(self.mime_text(text, 'html', _charset='utf-8'))
            msg.attach(text_part)

        else:
            msg = self.mime_text(text, _charset='utf-8')

        msg['From'] = self.from_email
        msg['To'] = to
        msg['Subject'] = subject

        if unsubscribe_url:
            msg['List-Unsubscribe'] = '<%s>' % unsubscribe_url

        return msg
1184068
protected function displayMessages()
    {
        if (!$this->display_messages || !$this->hasMessage()) {
            return;
        }

        $messages = $this->getMessages();

        $message_ul = new SwatHtmlTag('ul');
        $message_ul->class = 'swat-form-field-messages';
        $message_li = new SwatHtmlTag('li');

        $message_ul->open();

        foreach ($messages as $message) {
            $message_li->class = $message->getCSSClassString();
            $message_li->setContent(
                $message->primary_content,
                $message->content_type
            );

            if ($message->secondary_content !== null) {
                $secondary_span = new SwatHtmlTag('span');
                $secondary_span->setContent(
                    $message->secondary_content,
                    $message->content_type
                );

                $message_li->open();
                $message_li->displayContent();
                echo ' ';
                $secondary_span->display();
                $message_li->close();
            } else {
                $message_li->display();
            }
        }

        $message_ul->close();
    }
957255
protected function buildData($message)
    {
        $data = [];

        if ($message->getHeaders()) {
            $headers = $message->getHeaders()->getAll();

            foreach( $headers as $header) {
                if( $header instanceof Swift_Mime_Headers_UnstructuredHeader ) {
                    $data['headers'][$header->getFieldName()] = $header->getValue();
                }
            }
        }

        if ($message->getTo()) {
            $data['to'] = $message->getTo();
        }

        if ($message->getSubject()) {
            $data['subject'] = $message->getSubject();
        }

        if ($message->getFrom()) {
            $from = $message->getFrom();
            reset($from);
            $key = key($from);
            $data['from'] = [$key, $from[$key]];
        }

        // set content
        if ($message->getContentType() == 'text/plain') {
            $data['text'] = $message->getBody();
        } else {
            $data['html'] = $message->getBody();
        }

        $children = $message->getChildren();
        foreach ($children as $child) {
            if ($child instanceof Swift_MimePart && $child->getContentType() == 'text/plain') {
                $data['text'] = $child->getBody();
            }
        }

        if (! isset($data['text'])) {
            $data['text'] = strip_tags($message->getBody());
        }
        // end set content

        if ($message->getCc()) {
            $data['cc'] = $message->getCc();
        }

        if ($message->getBcc()) {
            $data['bcc'] = $message->getBcc();
        }

        if ($message->getReplyTo()) {
            $replyTo = $message->getReplyTo();
            reset($replyTo);
            $key = key($replyTo);
            $data['replyto'] = [$key, $replyTo[$key]];
        }

        // attachment
        $attachment = [];
        foreach ($children as $child) {
            if ($child instanceof Swift_Attachment) {
                $filename = $child->getFilename();
                $content = chunk_split(base64_encode($child->getBody()));
                $attachment[$filename] = $content;
            }
        }

        if (count($attachment)) {
            $data['attachment'] = $attachment;
        }

        return $data;
    }