Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a role for a two column layout #326

Closed
obilodeau opened this issue Feb 5, 2020 · 4 comments · Fixed by #332
Closed

Create a role for a two column layout #326

obilodeau opened this issue Feb 5, 2020 · 4 comments · Fixed by #332

Comments

@obilodeau
Copy link
Member

One of the common patterns in a presentation is to split things in two and have bullets on one side and {code, image, graph} on the other side.

I would like to provide CSS tied to a role to achieve that easily.

See what others have done:

Asciidoctor PDF.js

CSS source

.two-col > .slide-content {
  display: flex;
  flex-direction: row;
}

.two-col > .slide-content > *:first-child {
  margin-right: 10px;
  flex: 50%;
}
.two-col > .slide-content > *:last-child {
  margin-left: 10px;
  flex: 50%;
}

A user presentation

Markup (source):

=== Local Variable Type Inference [jep]#https://openjdk.java.net/jeps/286[JEP 286]#

[.col2]
--
* New reserved Java type `var`
* _„real type“_ inferred by compiler *on first initialization*
* can denote classes (`Integer`) & primitives (`int`)
* *only*  available for _local variables_
--

[.source.col2,java]
----
var primitiveVal = 5;   // int
var doubleVal    = 5d;  // double

final var sl = new ArrayList<String>();

var letters = "";
for (var s : sl) {
    letters += s.toLowerCase();
}

// var: enable annotation w/ type infer
(var x, @NotNull var y) -> x + y;
----

CSS (source):

.col2 {
  width:48% !important;
  margin: 0 1% !important;
  float:left;
}
/* Aufzählung nicht zentrieren im 2col layout.*/
.reveal .col2 ol, .reveal .col2  dl, .reveal .col2  ul {
    display:table;
}
@obilodeau obilodeau added this to the 3.2.0 milestone Feb 5, 2020
@ggrossetie
Copy link
Member

Follow-up: #301 (comment)

I had the feeling that it was achievable without doing so.
Isn't it working for the other example I provided in the issue?

Sorry I misspoke, it's definitely possible to create a two columns layout without wrapping the content in a <div>.

I'm using a similar technique to create the following slide:

slide

[.half.left.green]
== !

[.is-half.left.has-dark-background]
--
Some authors

[circle]
- Edgar Allen Poe
- Sheri S. Tepper
- Bill Bryson
--

[.is-half.right]
--
A normal paragraph.
Line breaks are not preserved.
// line comments, which are lines that start with //, are skipped

A blank line separates paragraphs.
--

However, the first example relies on a wrapping <div class="slide-content">:

.two-col > .slide-content {
  display: flex;
  flex-direction: row;
}

.two-col > .slide-content > *:first-child {
  margin-right: 10px;
  flex: 50%;
}
.two-col > .slide-content > *:last-child {
  margin-left: 10px;
  flex: 50%;
}

So it's somehow related as it would allow to use a grid or a flex display on the wrapping <div> to do more advanced layout.
And it would also be possible to easily center the content vertically:

align-content

In the above screenshot, it's still doable without a wrapping <div> because we only have one block but If we have a paragraph and a code block then it gets complicated 😱

@ggrossetie
Copy link
Member

@obilodeau Are you working on it? I don't want to tread on your toes 😉

@obilodeau
Copy link
Member Author

Nope, not working on it. Just trying out the various options.

I'll file comments with screenshots if I do anything worth mentioning.

My plan for tonight (not during $dayjob): fix #331, merge #327 and release 4.0.0.

@ggrossetie
Copy link
Member

Ok I will give it a try then 👨‍💻

ggrossetie added a commit to ggrossetie/asciidoctor-reveal.js that referenced this issue Feb 10, 2020
ggrossetie added a commit to ggrossetie/asciidoctor-reveal.js that referenced this issue Feb 14, 2020
ggrossetie added a commit to ggrossetie/asciidoctor-reveal.js that referenced this issue Feb 14, 2020
ggrossetie added a commit to ggrossetie/asciidoctor-reveal.js that referenced this issue Feb 14, 2020
ggrossetie added a commit to ggrossetie/asciidoctor-reveal.js that referenced this issue Feb 14, 2020
obilodeau added a commit that referenced this issue Feb 15, 2020
@obilodeau obilodeau modified the milestones: 4.1.0, 4.0.0 Feb 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants