asciidoc remove indent after full stop ":" - asciidoc

asciidoc
= Test
palim::
Blablablub
palim:
* Bla
* Blub
palimpalim::
Blablablub
pdf output.
How can I remove the indentation for palimpalim?

There is a typo in your markup, the second palim definition only has one colon instead of two, so Asciidoctor is interpreting the palimpalim term as part of the definition for the initial palim term.

Related

Emphasize multiple parts within a single string [duplicate]

How can I make a part of a word bold in reStructuredText?
Here is an example of what I need: ".rst stands for restructured text."
I was surprised that you could not simply write
.rst stands for **r**e**s**tructured **t**ext.
but the reStructuredText specification indeed states that inline markup must be followed by white-space or one of - . , : ; ! ? \ / ' " ) ] } or >, so the above string of reStructuredText is not valid. However, only a minor change is required to get valid character markup with backslash escapes. Changing the above to
.rst stands for **r**\ e\ **s**\ tructured **t**\ ext.
works fine. To see this in action try the online reST to HTML converter.

Apostrophe at end (or beginning) of word

How can I get an apostrophe at the beginning or the end of the word? This would be necessary for old-style
'Tis
instead of
It's
Or the apostrophe at the end of a word in plural, like
arguments'
Of course I could also just type
arguments’
but this defeats the purpose of using markdown.
Edit: It does not seem to me that there is a defined inline quotation style with single quote at beginning and end, like
'some sort of quotation'
so it shouldn't be too much of a stretch?
I think the best you can do is to go ahead and specify the single-right-quote symbol as you have done, but you don't have to use the numeric notation (’). AsciiDoc has a predefined symbol for that ({rsquo}), so it's not quite so ugly.
.Examples of Single-Apostrophe Notation
[width="50%",cols="",options="header"]
|===
|Use this |To get this
|\'italics' |'italics'
|\'\'single-quoted'' (two single apostrophes each) |''single-quoted''
|it's |it's (automatically formatted)
|its' |its' (ugly)
|'tis |'tis (ugly)
|its'\{empty\} |its'{empty} (still ugly)
|\{empty\}'tis |{empty}'tis (still ugly)
|its\{rsquo\} **{nbsp} <- This is what you want** |its{rsquo}
|\{rsquo\}tis **{nbsp} <- And this** |{rsquo}tis
|===

Ruby regex for stripping BBCode

I'm trying to remove BBCode from a given string (just using gsub with some regex).
Here's an example string:
The [b]quick[/b] brown [url=http://example.com]fox[/url] jumps over the lazy dog [img=http://example.com/lazy_dog.png]
And what I need that to output is:
The quick brown fox jumps over the lazy dog
So what's a way to do that? I've found various examples of doing this, but none have worked for my use case.
One that I've tried: /\[(\w+)[^w]*?](.*?)\[\/\1]/
But that wouldn't catch the ending [img] tag.
The purpose of this post is to show the disparity in how the BBCode is interpreted, which one should take into consideration when stripping the BBCode tags while preserving the content
This will only remove BB code tags as defined by this page.
It may remove more than what is considered valid BB code tag, though. For example, [b ]Bold[/b] is not bolded by this BBCode tester, so by right, those tags should be left alone. But [\b] will be removed by the regex below. It will also remove clearly non-BBCode such as [\b=something]
Another example is [url=http://example.com/ ][/url] (note the space). This might be OK or not OK depending on the BBCode parser. The regex below ignores the opening tag, but removes the closing tag.
/\[\/?(?:b|u|i|s|size|color|center|quote|url|img|ul|ol|list|li|\*|code|table|tr|th|td|youtube|gvideo)(?:=[^\]\s]+)?\]/
The [code] tag is also not treated correctly by the regex as seen in this demo. The replacement should leave [code] in between code tag alone.
This BBCode tester allows [b][b][b]Text[/b][/b][/b] to be parsed into Text bolded, but the other one interpret it as [b][b]Text[/b][/b] with the part [b][b]Text bolded and the rest not bolded. If you allow nested tags, then regex is not a good choice.

How can I write two separate blockquotes in sequence using markdown?

I need to place two blockquotes in sequence, however markdown combines them into a single blockquote. The only way I can get them to separate is placing some junk text between them. As this textfield allows me to use Markdown I can demonstrate:
> First Quote
> Second Quote
Results in:
First Quote
Second Quote
While using junk text:
> First Quote
.
> Second Quote
Results in:
First Quote
.
Second Quote
I cannot use HTML tags or HTML entities. Only Markdown.
You can separate blockquotes without html elements by using comment markup <!-- --> with an extra whiteline between the blocks:
> Imagination is more important than knowledge.
<!-- -->
> Never think of the future. It comes soon enough.
<!-- -->
> Anyone who has never made a mistake has never tried anything new.
Of course you can use any HTML elements you like as well (as noted by #pepoloan):
> Imagination is more important than knowledge.
<div></div>
> Never think of the future. It comes soon enough.
<div></div>
> Anyone who has never made a mistake has never tried anything new.
An empty header, #, followed by a space also works.
> Hello World
#
> Goodbye world
Unfortunately it isn't much better than <!-- --> But I kind of like it more, and use it.
>If I try a non breaking space
>it line breaks; don't ask me how
Result:
If I try a non breaking space
it line breaks; don't ask me how
Try this:
Use a U+200B character in-between the quotes, which is defined as a zero-length space to break up the quotes.
> Quote
​
> Quote
It looks like this:
> Quote
​
> Quote
You could use pandoc, which parses your original input as two consecutive blockquotes.
From experimenting, I found these to work also. Note they are not legal HTML or Markdown, but they seem do to the job:
<!
<$
</
<a
One way to do so is by just adding </> after first blockquote followed by a newline. And by this way nothing gets printed as well.
First quote
Second Quote
You have something like your first block quote, then 2 enters and on the second enter give a # symbol for Heading but leave the heading blank and then you next quote in next line.
This is one quote
This is another quote

Find all occurrences of text in different casing

We have an acronym which has specific casing. Business now wants us to find all occurrences where the casing is wrong and fix it.
Example of correct casing: HtMl
The search operation would then need to return all occurrences of HTML, html, Html, HtML etc. So I could then examine each case manually to see if it's really our acronym.
I was thinking Regular Expressions but I'm unsure how to write one that would exclude the correct case. Something like: \b((H|h)(T|t)(M|m)(L|l))&(~HTML)\b. Only & as AND doesn't exist (or does it?).
Solved using bash script:
echo "Hello, I'm not HtmL, HTML or html, but not HtMl." | grep -o "[H|h][T|t][M|m][L|l]" | grep -v "HtMl"
The "exception" is in the "grep -v" part.
You could convert the text to lowercase, then find occurrences of the word (lowercased, too) in the lowercased text. Now, whereever you found it in the lowercased version, replace it in the original text.
But now that I think this over, using regular expression is much simpler. Not much to add here, but if you have many such replacements to do, here's a little Python script that should generate (and apply) those regular expressions for you.
import re
def replaceAllVariants(acronym, text):
regex = "".join("[%s%s]" % (c.lower(), c.upper()) for c in acronym)
return re.sub(regex, acronym, text)
# usage
text = replaceAllVariants("HTML", "Bla bla html HTML HtMl hTMl foo bar.")

Resources