Formatting Slack notification from Travis - travis-ci

Is it possible to format a Slack notification template in Travis, in order to use bold, italic and links?

Have you tried using slack emphasis (basically it is like markdown) text?
Try surrounding words in ** like *so* for bold.
*bold* will show as bold
_itaic_ will show as italic
~strikethrough~ will show as strikethrough
>will indent a line
>>> will indent multiple paragraphs
Source:
https://get.slack.help/hc/en-us/articles/202288908-Format-your-messages
As for links refer to: https://api.slack.com/docs/message-formatting

Related

Pandoc markdown bold and color

I am using pandoc and write my text in markdown. To create my own style I use a custom latex template.
I want to style all bold words with a color. So when I type **a word** this word should not only be bold, but also e.g. blue.
Using the following in my latex template file
\newcommand\boldblue[1]{\textcolor{blue}{\textbf{#1}}}
\renewcommand{\textbf}{\boldblue}
gives me an error when converting to pdf using
pandoc myfile -f markdown -t latex --template==mytemplate -o myfile.pdf
which says
TeX capacity exceeded, sorry (grouping levels = 255)
However: when I only set the newcommand
\newcommand\boldblue[1]{\textcolor{blue}{\textbf{#1}}}
I can write $\boldblue{some text}$ within my markdown file and it works.
Question: how do I set a new command for **<word>**?
Thanks!
After some more research I found the following solution using \let which works:
\let\oldtextbf\textbf
\renewcommand\textbf[1]{{\color{blue}\oldtextbf{#1}}}
Using this code in a template file converts markdown's **<some text>** to bold and blue in latex / pdf.

Bullet list inside lstlisting

I am very new to Latex. I use lstlisting package to create grey boxes with code/text.
I'm able to set bold, italic or underline, but I'm not able to add a bullet list inside my box.
I tried the following code, escape char is %
\begin{lstlisting}
%\begin{itemize}%
%\item% Test // tried also with: %\item Test%
%\end{itemize}%
\end{lstlisting}
Settings for the listing are:
\definecolor{mygray}{rgb}{0.9,0.9,0.9}
\lstset{
basicstyle=\small,
backgroundcolor=\color{mygray},
breakatwhitespace=true,
breaklines=true,
escapechar=\%,
framexleftmargin=1em,
framexleftmargin=1em,
framextopmargin=1em,
framexbottommargin=1em,
frame=tb, framerule=0pt
}
How can I make this work? I guess it has something to do with right escaping, but can't find out how.

In Pandoc, how do I add a newline between authors through the YAML metablock without modifying the template?

I am trying to add a a couple of authors to a report I am writing. Preferably, the second author would appear on a new line after the first. I know I can modify the template to add a new field or the multiple author example given in the Pandoc readme. However, I wonder if there is any character I can use to insert a new line between authors directly in the metablock. So far I have tried \newline, \\, | with newline and space, <br>, <div></div>, and making the author list a string with newline or double spaces between author names, but nothing has worked. My desired output is pdf.
The problem isn't in the YAML metadata formatting (for which there are numerous ways to have multiline strings), but that the LaTeX \author command strips the newlines. But for PDF output (with LaTeX) you can do:
---
title: mytitle
author: '\protect\parbox{\textwidth}{\protect\centering Author: 1\\ Author: 2\\ Author 3}'
---
body text
You can go with a simple list to achieve this.
---
title: 'Any title comes here'
author:
- Author One
- Author Two
---
Another way is to rely on the title block that has a slightly different syntax.
% Any title comes here
% author(s) (separated by semicolons)
% date
Find additional variants in the metadata-block section of the pandoc manual.

Parse a Word Document By Font?

I'm currently trying to write a script which would run through a word document and output to a text file all the lines that are written in a certain font.
So if I had the document:
"This is the first line of the document.
This is the second line of the document.
This is the third line of the document."
And say normal lines are Times New Roman, bold is Arial, and italics is Sans Serif.
Then, ideally, I could parse the document for all lines in Arial and the text file output would have the line:
This is the second line of the document.
Any idea on how to do this from a script? I was thinking about first converting the doc into xml, but I do not think this is possible within a script.
You'll want to use the FIND object, and the FONT property of the FIND object.
So, something like this:
Public Sub FindTest()
Dim r As Range
Set r = ActiveDocument.Content
With r.Find
.ClearFormatting
.Style = "SomeStyleName"
Do While .Execute(Forward:=True, Format:=True) = True
'---- we found a range
Dim duperange As Range
Set duperange = r.Duplicate
Debug.Print r.Text
Loop
End With
End Sub
Note that where I've specified Style, you could specify font formatting via the FIND.FONT object, or various other formatting options. Just browse around the FIND object to see what's available.

How to create a white-on-black style for LaTeX listings

I've been looking at Philip Bunge's post on how to create a "Tango" style with LaTeX listings, and trying to adapt this to make the default text style white and the background black (this is for slides, not an article!). This is what I added:
\definecolor{Black}{gray}{0.0}
\definecolor{White}{gray}{0.9}
...
\lstset{
basicstyle=\color{White},
backgroundcolor=\color{Black},
...
}
This assumes that basicstyle sets the default style of all text. The listings documentation says this:
basicstyle is selected at the beginning of each listing. You could use \footnotesize,
\small, \itshape, \ttfamily, or something like that. The last token of must not read any following characters.
The output of this still shows "default" text as black. It is possible to set more style directives that cover most tokens in a given programming language, but even doing this some tokens (such as brackets and other punctuation) will be missed. What did I do wrong?
The following code worked for me, but I converted the .dvi file to a .pdf in order to have the text appear as white, so it might have been your viewer? I'm using xdvi and xpdf.
\documentclass[a4paper, 11pt]{article}
\usepackage{listings}
\usepackage{color}
\definecolor{theWhite}{gray}{0.9}
\definecolor{theBlack}{gray}{0.0}
\lstset { basicstyle=\color{theWhite}, backgroundcolor=\color{theBlack} }
\begin{document}
\begin{lstlisting}
((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
\end{lstlisting}
\end{document}
I hope that helps!

Resources