In ZURB Foundation 6, is there a way to have columns flow around a hidden column? - zurb-foundation

Using ZURB Foundation 6, is there a way to have columns flow around a hidden column?
So for this code:
<ul class="row large-up-3">
<li class="column column-block large-4" style="display:none;">1</li>
<li class="column column-block large-4">2</li>
<li class="column column-block large-4">3</li>
<li class="column column-block large-4">4</li>
<li class="column column-block large-4">5</li>
<li class="column column-block large-4">6</li>
</ul>
It current displays like this:
2 3
4 5 6
But what I'm hoping to achieve is this:
2 3 4
5 6
Is this feasible?
I don't need to use "display: hidden" if there's another way to do this. That's just placeholder CSS code.
If not, is there a way to do this in Bootstrap or writing my own grid CSS? I can bypass Foundation for this particular content if needed.
Thank you for any help!

Figured it out. In Foundation 6, the following CSS code forces each row to start anew:
.large-up-3 > .column:nth-of-type(3n+1), .large-up-3 > .columns:nth-of-type(3n+1) {
clear: both;
}
Note: I'm using a 3-three column row, so your code will be different, depending on how many columns you have per row.
So if you change clear:both to clear:none, you can then hide columns using display:none, and the columns will automatically fill any gaps.
Why does ZURB do this?
Well, if you change this CSS code, you'll find that your columns don't line up vertically anymore, due to varying column heights.
So this CSS code forces everything to look nice.
If you remove the clear:both code and then run into a alignment problems, you might look into ZURB's "equalizer" code to set all your columns to an equal height.
https://get.foundation/sites/docs/equalizer.html
There are various ways to prettify things further if equal column heights end up looking wrong in your theme, such as using CSS overflow options, but that's getting outside the scope of this question.
I hope this helps someone!

Related

Coloring a table in apache superset

I want to color the background bars (or the entire cells) of the table as shown in the appended screenshot based on the "Group-By"/dimension value (red for "rot", yellow for "gelb" and green for "grün").
I was able to color the metric-part of other visualizations with label_colors, but I have not yet found a way to color the cells of the table based on a "dimension".
Is there a way to do this?
As of now:
EDIT: I wanted to color it the following way (edited with paint):
This is a tad hacky, but you can add a markdown component and add the following markup:
<style>
th {
color: red; /* or whatever color/hex code you want */
}
</style>
The markdown component will be blank after you add this--i.e. there will just be a blank markdown block-- so you may want to add some copy. Alternatively, if you already have a markdown block, you can add it there, and it won't appear as long as you remember the <style></style> tags.

BeautifulSoup: pulling a tag preceding another tag

I'm pulling lists on webpages and to give them context, I'm also pulling the text immediately preceding them. Pulling the tag preceding the <ul> or <ol> tag seems to be the best way. So let's say I have this list:
I'd want to pull the bullet and word "Millennials". I use a BeautifulSoup function:
#pull <ul> tags
def pull_ul(tag):
return tag.name == 'ul' and tag.li and not tag.attrs and not tag.li.attrs and not tag.a
ul_tags = webpage.find_all(pull_ul)
#find text immediately preceding any <ul> tag and append to <ul> tag
ul_with_context = [str(ul.previous_sibling) + str(ul) for ul in ul_tags]
When I print ul_with_context, I get the following:
['\n<ul>\n<li>With immigration adding more numbers to its group than any other, the Millennial population is projected to peak in 2036 at 81.1 million. Thereafter the oldest Millennial will be at least 56 years of age and mortality is projected to outweigh net immigration. By 2050 there will be a projected 79.2 million Millennials.</li>\n</ul>']
As you can see, "Millennials" wasn't pulled. The page I'm pulling from is http://www.pewresearch.org/fact-tank/2016/04/25/millennials-overtake-baby-boomers/
Here's the section of code for the bullet:
The <p> and <ul> tags are siblings. Any idea why it's not pulling the tag with the word "Millennials" in it?
Previous_sibling will return elements or strings preceding the tag. In your case, it returns the string '\n'.
Instead, you could use the findPrevious method to get the node preceding what you selected:
doc = """
<h2>test</h2>
<ul>
<li>1</li>
<li>2</li>
</ul>
"""
soup = BeautifulSoup(doc, 'html.parser')
tags = soup.find_all('ul')
print [ul.findPrevious() for ul in tags]
print tags
will output :
[<h2>test</h2>]
[<ul><li>1</li><li>2</li></ul>]

Sublime Text regex to re-order Facebook message export

I've exported my Facebook message history and found that messages are displayed as below. Some are in blocks, some blocks are out of order, some are together, all in reverse.
John Doe Sunday, 24 August 2014, 01:18
Hello!
Jane Doe Sunday, 24 August 2014, 01:17
Hi!
What I'm trying to do is to use a regex, [a-z]* and $1, etc., to search and replace in Sublime Text to re-layout the data such that the above becomes sortable in Excel (to get everything in correct order) as below (or any date-sortable manner):
2014.08.24 01:17 Jane Doe Hi
2014.08.24 01:18 John Doe Hello!
Is this possible? I've managed to select the name date and time, but cannot get the variable-length messages consistently and nor re-order/move the date/time or message to the example blow. Does this make sense, or am I wasting my time?
Would it be best in a tab/comma separated way, too?
You'd be much better off using your favorite language to parse the HTML in html/messages.htm. Open the file in Sublime, use a code formatter like HTML-CSS-JS Prettify (note: requires Node.js) to format it, then look at the structure. Basically, each conversation is in reverse order, oldest first, and within the conversation each message is sorted most recent first (yay consistency!). Here's an example:
<div class="thread">Fred Smith, Joe Blow
<div class="message">
<div class="message_header">
<span class="user">Fred Smith</span>
<span class="meta">Monday, June 13, 2011 at 3:42pm EDT</span>
</div>
</div>
<p>Not much Joe. How are you?</p>
<div class="message">
<div class="message_header">
<span class="user">Joe Blow</span>
<span class="meta">Monday, June 13, 2011 at 11:00am EDT</span>
</div>
</div>
<p>Hey there Fred, what's up?</p>
</div>

Xpath: How to get values without a element node

I want to extract the values 4, 3 and 0 but don't know how since they do not have an attribute name
<div class="ea_default_border" style="width:230px; margin-left:20px;">
<span class="ea_default_label">Catégorie :</span>
<a href='/index.php?option=com_'>Location</a><br/>
<span class="ea_default_label">Type :</span>
<a href='/index.php?option=com_'>Maison, Villa, Propriété</a><br/>
<strong>Pièces : </strong>4<br/>
<strong>Chambres : </strong>3<br/>
<strong>SDE/Salle de bains : </strong>0
</div>
I want the desired result to be
4
3
0
and
Pièces : 4
Chambres : 3
SDE/Salle de bains : 0
I have tried several guess that isn't giving the desired result. Thanks in advance for your answers
EDIT: I tried the following xpaths
//div[#class="ea_default_border"]/br/text() <== This gets me nothing as the numbers aren't in a tag.
//div[#class="ea_default_border"]/strong/text() <=== This gets me the titles only.
try
//*[#class='ea_default_border']/child::text()
for your second requirement, try this:
concat(//*[#class='ea_default_border']/strong/text(), //*[#class='ea_default_border']/strong/following-sibling::text()[1])

Way to force specific column down to next row in smaller sizes?

Say I have three columns:
Col 1 | Col 2 | Col 3
And I would like, when the screen size changes to "small", the columns to change to this:
Col 1 | Col 3
Col 2 (in it's own full-size row)
Basically, Col 3 would go onto it's own row. Now, I know I can do this with the "visiblity" classes Foundation provides, but then you'd have to duplicate the Col 2 content twice, as far as I understand it. I'd like to avoid this if possible.
Any ideas? Or am I crazy that Foundation doesn't easily allow for this? Or maybe I should just hack it together by making Col 2 positive: absolute or something and call it a day?
You're looking for something called Source Ordering. (It's towards the bottom of that docs page.)
Order your html so that the columns are defined in the order 1,3,2. Then, use the push/pull classes to swap the positions of columns 3 and 2 for when they are all in the same row.
<div class="small-6 medium-4 columns">
... Column 1 Content ...
</div>
<div class="small-6 medium-4 columns medium-push-4">
... Column 3 Content ...
</div>
<div class="small-12 medium-4 columns medium-pull-4">
... Column 2 Content ...
</div>