Skip to content
This repository was archived by the owner on Jan 3, 2018. It is now read-only.

Update CSS to also work with lessons#751

Merged
rgaiacs merged 3 commits intoswcarpentry:masterfrom
jpallen:master
Jan 28, 2015
Merged

Update CSS to also work with lessons#751
rgaiacs merged 3 commits intoswcarpentry:masterfrom
jpallen:master

Conversation

@jpallen
Copy link
Copy Markdown
Contributor

@jpallen jpallen commented Jan 23, 2015

With the addition of a few HTML classes at the top level, the lessons template
should now work with this CSS, so long as it includes swc.css,
swc-workshop-and-lesson.css and lesson.css. The important thing is that there
aren't any conflicts between classes in site and lessons anymore, so how the
CSS files are grouped and delivered is easy to change. Perhaps everything
should be shrunk into just swc.css for use everywhere?

This has a small effect on site: h1.title in site is used to add an underline,
but only actually used in the badges pages. The CSS seems broken on these pages
anyway, so I've removed this class in the CSS since it conflicts with h1.title
in lessons.

Another point to note is that I've changed the global selectors for
h1:first-child and h2:first-child to only affect .objective, .callout and
.challenge blocks, since the global selector used for lessons conflicted with
site. However, the selector now only picks up h2:first-child, not h1 since this
seemed to be all that was used for headers in these blocks. It's easy to also
include h1 if needed though.

Finally, there is a .keypoints selector in the current lesson CSS, but I see no
mention of that in the blockquote2div.py filter in the lesson template. There
is a .prereq class however in blockquote2div.py which currently has no CSS.
Perhaps .keypoints -> .prereq? Or at least we can remove .keypoints?

I've only checked this thoroughly with shell-novice so far, so there may be
issues with the other lessons that I haven't audited.

With the addition of a few HTML classes at the top level, the lessons template
should now work with this CSS, so long as it includes swc.css,
swc-workshop-and-lesson.css and lesson.css. The important thing is that there
aren't any conflicts between classes in site and lessons anymore, so how the
CSS files are grouped and delivered is easy to change. Perhaps everything
should be shrunk into just swc.css for use everywhere?

This has a small effect on site: h1.title in site is used to add an underline,
but only actually used in the badges pages. The CSS seems broken on these pages
anyway, so I've removed this class in the CSS since it conflicts with h1.title
in lessons.

Another point to note is that I've changed the global selectors for
h1:first-child and h2:first-child to only affect .objective, .callout and
.challenge blocks, since the global selector used for lessons conflicted with
site. However, the selector now only picks up h2:first-child, not h1 since this
seemed to be all that was used for headers in these blocks.  It's easy to also
include h1 if needed though.

Finally, there is a .keypoints selector in the current lesson CSS, but I see no
mention of that in the blockquote2div.py filter in the lesson template. There
is a .prereq class however in blockquote2div.py which currently has no CSS.
Perhaps .keypoints -> .prereq? Or at least we can remove .keypoints?

I've only checked this thoroughly with shell-novice so far, so there may be
issues with the other lessons that I haven't audited.
@jpallen
Copy link
Copy Markdown
Contributor Author

jpallen commented Jan 23, 2015

The corresponding changes needed in the lesson template are at swcarpentry/DEPRECATED-lesson-template#140

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CSS for print was design targeting only the lessons. It need to be improved in another pull request.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like most of the elements affected are only in lessons anyway. The exceptions are h1,h2,h3,h4,h5,h6,p,ul,ol,li,pre,code, which may also affect other things globally in site and workshop.

Presumably the print styles for these elements in lesson and workshop should be the same anyway? Is their a maintained print style for site? It seems less important than the print style for lessons and workshops.

Do you want me to remove or fix this in some way before merging the PR?

to have the same look of others pages.
@rgaiacs
Copy link
Copy Markdown
Contributor

rgaiacs commented Jan 24, 2015

This has a small effect on site: h1.title in site is used to add an underline,
but only actually used in the badges pages. The CSS seems broken on these pages
anyway, so I've removed this class in the CSS since it conflicts with h1.title
in lessons.

@jpallen Thanks for the awesome work. Could you merge jpallen#1?

Another point to note is that I've changed the global selectors for
h1:first-child and h2:first-child to only affect .objective, .callout and
.challenge blocks, since the global selector used for lessons conflicted with
site.

Thanks.

However, the selector now only picks up h2:first-child, not h1 since this
seemed to be all that was used for headers in these blocks. It's easy to also
include h1 if needed though.

Our template says to only use h2 so this will be OK for now.

Finally, there is a .keypoints selector in the current lesson CSS, but I see no
mention of that in the blockquote2div.py filter in the lesson template.

.keypoints was used on https://github.com/swcarpentry/bc. We must preserve it since we will keep the v5.2 on our site, see http://software-carpentry.org/lessons.html.

There is a .prereq class however in blockquote2div.py which currently has no CSS.
Perhaps .keypoints -> .prereq?

.keypoints is more or less a duplicate of .objectives. Since we are going to try keep small lessons we will not need it anymore.

Or at least we can remove .keypoints?

We should preserve .keypoints at least for now. See previous comment.

@jpallen
Copy link
Copy Markdown
Contributor Author

jpallen commented Jan 24, 2015

Could you merge jpallen#1?

Done

.keypoints was used on https://github.com/swcarpentry/bc. We must preserve it since we will keep the v5.2 on our site, see http://software-carpentry.org/lessons.html.

It looks like the linked lessons are namespaced under /v5 on the site, and link to CSS that is also namespaced under /v5. Does this CSS come from the 'bc' repo as well? In which case these changes shouldn't affect it anyway?

@gvwilson
Copy link
Copy Markdown
Contributor

I apologize for the complexity - it's grown over a couple of years, and
not in any sensible way. Looking at the web site, it looks like the
material in /v5 (which comes from the 'bc' repository) is referencing
/v5/css/*.css, but the stuff in the main directory (which comes from
'site') is referencing ./css (which also comes from 'site').

@gvwilson
Copy link
Copy Markdown
Contributor

@r-gaia-cs have you checked this?

@rgaiacs
Copy link
Copy Markdown
Contributor

rgaiacs commented Jan 28, 2015

@jpallen Sorry for the delay. I was trying to find something equivalent to Jinja's powerful template inheritance for Jekyll to avoid the duplicate code at _layouts but I didn't find.

Merging now.

rgaiacs pushed a commit that referenced this pull request Jan 28, 2015
Update CSS to also work with lessons
@rgaiacs rgaiacs merged commit 5cffdc2 into swcarpentry:master Jan 28, 2015
@jpallen
Copy link
Copy Markdown
Contributor Author

jpallen commented Jan 28, 2015

@r-gaia-cs No problem, I'm struggling to keep track of all of these CSS PRs, and I wrote some of them! Hopefully things will be easier once it's all consolidated :) Thanks for merging! I guess this now needs to make it into swcarpentry/styles as well?

@rgaiacs
Copy link
Copy Markdown
Contributor

rgaiacs commented Jan 28, 2015

I guess this now needs to make it into swcarpentry/styles as well?

I will try to address it.

@gvwilson
Copy link
Copy Markdown
Contributor

May I suggest:

  1. We create a styles-test repo.
  2. We put a bunch of HTML files in there that are copied from various
    other repos.
  3. People test all their CSS changes there.
  4. When things are done, they manually copy over to the 'styles' repo
    and submit there.

So there's only one canonical set of CSS (in 'styles', or in PRs against
'styles'), and we can view changes simultaneously across
lesson-template, workshop-template, and site by proxy.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants