Removing whitespaces in HAML - haml

Is there a way to achieve this in HAML?
<h1>Lorem ip<span class="red">sum</span><span class="subtitle">dolor</span></h1>
I used this online tool conversor (http://html2haml.heroku.com/)
%h1
Lorem ip
%span.red sum
%span.subtitle dolor
and render this in HTML:
<h1>
Lorem ip
<span class='red'>sum</span>
<span class='subtitle'>dolor</span>
</h1>
I'm trying to remove the whitespace between ip and sum but I can't achieve it.

With this:
%h1<
Lorem ip
%span.red> sum
%span.subtitle dolor
Output looks like this:
<h1>Lorem ip<span class="red">sum</span><span class="subtitle">dolor</span></h1>
HAML Whitespace Removal

Related

How to Detect Question Mark Invalid Character in SQL

I am working in a database that accepts imported files. When the client enters a registered trademark, copyright, or another invalid symbol, the database imports the symbol as an invalid character in the form of a question mark, like the following:
lorem ipsum dolor sit amet, consectetur � lorem ipsum dolor sit amet, consectetur
When printing this character, it appears as such:
lorem ipsum dolor sit amet, consectetur ? lorem ipsum dolor sit amet, consectetur
Is there a way to detect that symbol, as using a like statement doesn't detect the symbol.
The desired result is to be able to send a warning in a stored procedure that asks the user to check the inserted data to ensure validity.
Note: It is not enough to insert the string into a temp table and then check the temp table for question marks, as a question mark in the string is not uncommon and would create for more false positives than helpful alerts.
Thank you
That special character is NCHAR(65533) but evades normal pattern matching using LIKE, CHARINDEX, PATINDEX, etc. I did find one way to detect it using TRANSLATE, by swapping the Unicode replacement character for a different Unicode character that can't possibly be in the data already. I picked an 8-pointed star (✵, NCHAR(10037)) but there are so many to choose from...
CREATE TABLE dbo.whatever(things nvarchar(32));
INSERT dbo.whatever(things) VALUES
(N'this row is just fine.'),
(N'well, here there is a � rhombus.'),
(N'this row is just fine too.');
SELECT things
FROM dbo.whatever
WHERE TRANSLATE(things, nchar(65533), N'✵') LIKE N'%✵%';
Output:
well, here there is a � rhombus.
Also note the difference between print 'hi � there'; and print N'hi � there'; - don't be lazy, if your string is (or could contain) Unicode, always use the N'prefix'.
As Martin suggests, though, SQL Server can store whatever character is leading to the � - it is most likely because you are treating the file as ASCII, inserting them into a varchar column, or it is getting lost somewhere else along the way.

Sql to select and extract 10 characters before and 10 characters after a substring in Oracle Clob

Let's consider the text example below:
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever
since the 1500s, when an unknown printer took a galley of type and
scrambled it to make a type specimen book. It has survived not only
five centuries, but also the leap into electronic typesetting,
remaining essentially unchanged. It was popularised in the 1960s with
the release of Letraset sheets containing Lorem Ipsum passages, and
more recently with desktop publishing software like Aldus PageMaker
including versions of Lorem Ipsum.
How do I extract 10 characters before and 10 characters after the substring, let's say 'Lorem Ipsum' from the above paragraph in Oracle? The datatype is clob. I have been trying with Oracle functions such as SUBSTR, but no luck so far. Thanks for everyone's help.
You can use regexp_replace with back references:
select
regexp_replace(col, '.*?(.{0,10}Lorem Ipsum.{0,10}).*?','\1')
from t;
Here . matches any character and ? is for lazy matching. For the given input, it produces:
Lorem Ipsum is simplyindustry. Lorem Ipsum has been ontaining Lorem Ipsum passages,rsions of Lorem Ipsum.

ANTLR tokens ambiguity

I would like to parse string like "Lorem ipsum AND dolor AND sit amet consectetur"
I need two tokens
word "AND"
any other word
Using antlr2, if I define tokens like
AND_WORD: "AND" ;
ANY_OTHER_WORD: ('0'..'9'|'a'..'z'|'A'..'Z'|'_')+ ;
I'm getting "warning:lexical nondeterminism between rules"
How can I solve it? Should I somehow exclude AND_WORD from ANY_OTHER_WORD definition?

How to use "lorem" inside paragraph tag

I am just learning zen-coding and am trying to do this:
Entering 'lorem' and hitting tab will produce 50 word lorem text.
However, if I start with <p></p> and then type lorem + tab inside the tag, it does not produce the lorem text.
Is there a better way to do this?
Use this:
p>lorem
and then tab
Since people are still reading this I will add, if you want to print off many lorems inside of p tags you can do this:
(p>lorem)*7
Replace 7 with how many lines you want!
use this:
<p>
lorem*(how many line you want)

Newline character in Cucumber-JVM parameters

Is there any way of passing parameters containing newline characters into Cucumber-JVM scenarios?
As a workaround I'm putting "\n" strings into the parameter and replacing them with a newline at the beginning of the scenario method but it feels as if there might be a nicer way.
You can use Doc Strings using triple-quote. Example stolen from official wiki http://cukes.info/step-definitions.html
Given a blog post named "Random" with Markdown body
"""
Some Title, Eh?
==============
Here is the first paragraph of my blog post. Lorem ipsum dolor sit amet,
consectetur adipiscing elit.
"""