Skip to content

Instantly share code, notes, and snippets.

View philschatz's full-sized avatar

Philip Schatz philschatz

View GitHub Profile
@philschatz
philschatz / gist:7644288
Last active December 29, 2015 08:38
Ideas for Parameterizing Content slots
// Take a look at the generated CSS (they are equivalent)
// Uncomment the .preface and .appendix lines to see why the @part is necessary.
#part {
// The Part>content-counter prefixes any labels you want to number depending on
// which part of the book they occur in.
// For example: "Table 4.3" in a chapter and "Table A3" in an appendix
.content-counter(preface; @before; @after) { content: @before @after; }
.content-counter(chapter; @before; @after) { content: @before counter(chapter) '.' @after; }
.content-counter(appendix; @before; @after) { content: @before counter(appendix, upper-alpha) @after; }

Stylesheet Refactoring

Goals

The main goals of re-factoring the book stylesheets are as follows:

  • Separate style rules from selectors. This will allow an easy transition to different DOM structures (Eg, Moving from Docbook to XHTML).
  • To be able to style books by supplying alternate “slots” -- style rules for specific logical pieces of a book (An exercise, a section in a chapter, a solution in an exercise, a figure in a feature, etc.)

Design

@philschatz
philschatz / gist:7963308
Last active December 31, 2015 08:49
CALS table.xsl
table[data-phil-1] {
border: 1px solid !important;
border-collapse: collapse;
}
th[data-phil-2] {
border: 1px solid !important;
}
td[data-phil-3] {
@philschatz
philschatz / gist:7982740
Last active December 31, 2015 11:58
HTML and CSS

Reasons for HTML & CSS+

Background

It would be easy if:

  • a piece of content is in exactly 1 book (overriding titles, collection context matters)
  • links would point to places within the current doc
  • could layout each page individually (PDF page breaks)
@philschatz
philschatz / gist:8149250
Last active January 1, 2016 13:09
2013-12 TODO list
@philschatz
philschatz / do-coverage.sh
Created January 3, 2014 23:17
Coverage and Diff script for textbooks
#!/bin/bash
# To run this file you will need:
#
# - python
# - phantomjs
# - xsltproc
# - genhtml (or `brew install lcov`): Optional
# Example books:
@philschatz
philschatz / gist:8541209
Last active January 4, 2016 00:19
sockets vs polling
USER =
email:
firstname:
fullname:
id:
othername:
suffix:
surname:
title:
website:

Exploratory "bits" to test over the weekend

(in no particular order)

Module Page:

  • Change hostname and reload the Backbone.Model
  • Replace Metadata Language with dropdown
  • Add "draft" color
  • Fix editor toolbar
<?xml version="1.0" ?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:c="http://cnx.rice.edu/cnxml"
xmlns="http://cnx.rice.edu/cnxml"
version="1.0">
<!-- Identity tranform -->
<xsl:template match="@*|node()">