How to put colon in a Jekyll/Kramdown post title? - jekyll

The title of my Jekyll/Kramdown post contains a colon
---
layout: post
title: abc : def
---
and the page fails to generate. According to this answer, I should replace the colon by :, so I did that. In the preview on Github it showed correctly as a colon, but in the actual post it just showed :. What might be the fix here?

Found the solution. I just wrote
title: "abc : def"

Related

Jinja2 trim CR when rendering

I was trying to figure out why Jinja2 is triming my \r out of my model. I've got something like this :
Something useful\r\n
And again\r\n
Which then is rendered like this :
Something useful\n
And again\n
And this seems to be known as this link shows : https://github.com/ansible/ansible/issues/22676
As drewdogg is demonstrating here :
>>> t = Template("{{ 'lorem\r\nipsum' }}")
>>> t.render()
u'lorem\nipsum'
Why is this happening? Can I do something to preserve my \r that are necessary for me? The only solutions I came accross was to explicitly write :
{{ '\r\n' }}
Or worse replace, either in Jinja2 or Python3...
Has anybody came over this problem and found a solution?
Thanks a lot :)

How should i add this syntax to my html antlr4 grammar?

First of all this is an example of what I'm supposed to do
<p cp-for="x in t;i=index"> {{x}}, {{i}} </p>
I need to parse the mustache syntax separately from HTML text
(Which means the comma must not be parsed as html text).
And this is part of the grammar i wrote:
OPEN_MUSTACHE: '{{' -> pushMode (MUSTACHE_SYNTAX)
mode MUSTACHE_SYNTAX;
//there are other tokens describing the syntax but i didn't write it
CLOSE_MUSTACHE: '}}' -> popMode
So if i want to add another mustache tag like in the example, how can i tell the lexer to look ahead and not pop immediately after it sees MUSTACHE_CLOSE?
P.S
this is my first time asking a question on this website;
I apologize if my question is not clear
Edit: i now understand that i got the grammar syntax wrong,
The comma in {{ x }} , {{ i }} is actually plain html text
So if i want to add another mustache tag like in the example, how can i tell the lexer to look ahead and not pop immediately after it sees MUSTACHE_CLOSE?
For the input {{#check}}, {{/check}}, the lexer should create the following tokens:
{{: open token
#: open tag token
check: name/id token
}}: close token
,: plain HTML token
: plain HTML token
{{: open token
/: close tag token
check: name/id token
}}: close token
So you can just pop back to the default mode when you encounter }} inside your MUSTACHE_SYNTAX mode.
And then in your parser, you do something like this:
parser grammar MustacheParser;
options {
tokenVocab=MustacheLexer;
}
template
: template_contents EOF
;
template_contents
: template_part*
;
template_part
: html
| mustache
;
html
: HTML+
;
mustache
: section
| ...
;
section
: '{{' '#' NAME '}}' template_contents '{{' '/' NAME '}}'
;
(Of course the literal tokens, like '{{', '#' etc., are not allowed inside a parser grammar, it's just pseudo code. Replace them with the tokens from your lexer grammar.)

How to POST via REST a correct markup to a confluence page?

How to post topic in correct wiki syntax when body has "\r\n" which means "carriage return" and "newline"?
When I use data=json.dumps(%topic_body%) it makes all my text with literally "\r\n" in it!
Of course text formatted like this - cannot be used as wiki formatted on confluence!
This is an example of usual markup:
h1. Some Description
[Some link|Link...] is ...
h2. Some
h2. Some Versions
* 9
* 10
* 11
h1. Some Software
||Table 1 ||Block 1||Some||Some 2||
This is how it reproduces via json:
{"storage": {"value": "b'h1. Some Description\\r\\n[Some link|Link...] is ...\\r\\n\\r\\nh2. Some\\r\\n\\r\\nh2. Some Versions\\r\\n* 9\\r\\n* 10\\r\\n* 11\\r\\n\\r\\nh1. Some Software \\r\\n\\r\\n||Table 1 ||Block 1||Some||Some 2||'", "representation": "wiki"}}}
This is important, and I can't send body in markdown because my confluence did not understand this way of macros:
<ac:structured-macro ac:name="attachments">
</ac:structured-macro>
So I need to send my topic body that way, which can include new line method (https://confluence.atlassian.com/doc/confluence-wiki-markup-251003035.html)
Also I can't use documented:
Explicitly, by entering two consecutive backslashes: \\
Because in this condition wiki markup make all text the same forematted, just like:
h1. Some Description \\ \\ [Some link|Link...] is ...
This whole string will be "h1." size. All all other text from this string will be formatted as h1, ignoring any other tags.
Fixed!
You can ignore the case, when visual(in browser) wiki markdown does not work for you. It will work via REST anyway!

Automatically add some kind of text to text?

So basically this:
Is there a program or something where you can input text and then it automatically adds html tags at the beginning and end of the inputted text, for example:
I type the text: "Life finds a way"
Then the program makes it like this:
<p align="center">"Life finds a way"</p>
Matthew
Have a look at Markdown language.
It's exactly what's used when you post something on StackOverflow. Everything you write is converted to html behind the scenes (that's also why you can't print a tag without using code notation in a post).
So simple text is converted to a <p> tag, unless you break two lines with an empty line.
To create an header, just use :
Header
------
which renders like this:
Header
Or like this :
# Header
## Header
### Header
which renders :
Header
Header
Header
Creating lists is also very handy :
* first item
* second item
which renders :
first item
second item
or if you like numbered lists :
1. first item
2. second item
first item
second item
Bold is as simple as : **Bold**
Italic is : *Italic*
Finally, links are simple:
The wikipedia article is linked like this :
[The wikipedia article](http://en.wikipedia.org/wiki/Markdown)

Emmet - Wrap with Abbreviation - Token that represents the wrapped text i.e. {original text}

I'm attempting to convert a list of URLs into HTML links as lazily as possible:
www.annaandsally.com.au
www.babylush.com.au
www.babysgotstyle.com.au
... etc
Using wrap in abbreviation, I'd like to do something like: a[href="http://${1}/"]*
The expanded abbreviation would result in:
www.annaandsally.com.au
www.babylush.com.au
www.babysgotstyle.com.au
... etc
The missing piece of the puzzle is an abbreviation token that represents the text being wrapped.
Any idea if this can be done?
If they are already on their own lines (which in the question, they look like they are), a simple Find and Replace with RegEx turned on will work. The Params are as follows:
Find What:
(.+)
Replace With:
$1
Before
After
Sergey from Emmet was kind enough to point me in the right direction. The $# token contains the original content:
a[href="http://$#/"]*>{$#}
By specifying $# as the href attribute, the original content is no longer 'wrapped' and must be be reinserted via {$#}.
http://docs.emmet.io/actions/wrap-with-abbreviation/#controlling-output-position