Michael Wimsatt's GitHub blog
For seven or eight years now, I’ve been involved in one or two fantasy football leagues. For me, the most interesting facet of the game has been the wealth of data available and novel ways to apply it.
So, as I decided to embrace my inner quant, one of the first things I thought I could turn my eye to is one of my fantasy football leagues. This is probably due, in no small part, to my performance this year in one of my leagues. Whereas I usually find myself at the bottom of the pile, I somehow managed to finish the “regular season” this year ranked #1 in the league, and a guaranteed playoff berth. Most years at this time, I’ve pretty much checked out. Not this time.
I’ll talk a little about the tools I used, the process I followed and the results - along with the many weaknesses in this admittedly simplistic approach.
Rather than go the standard analytical route, I performed my first simulation - in this case, a simple Monte Carlo simulation based on historical scores from the league. This allowed me to project some (admittedly suspect and impossible to test) probabilities of different outcomes. I tested the assumptions driving this simulation, showed that they’re not completely valid, then totally plowed ahead anyway.
My code, such as it is, is here.
I originally started down the path of trying to use Yahoo!’s standard web service by forming URLs and parsing the response as I’ve done before with other APIs. However, I had a great deal of difficulty with this, eventually giving up when authentication broke every time I had to use a semicolon in a query, which is absolutely essential. A little searching suggests that this is a common issue, but I can’t say I exhaustively sought solutions.
After that, I turned to the YQL library from the nice folks over at Project Fondue, and all was revealed! Once I hacked by way through YQL syntax and figured out how it applied to the Fantasy Sports API, I was quickly up and running - downloading our league’s scores and stats and playing with the numbers in iPython.
My initial plan was to do some basic data analysis on the scores and put together some hypotheses from that (time series analysis, forecasting, etc.). But, then it occurred to me that projecting playoff results with a simple Monte Carlo simulation might be more fun (and achievable) in a reasonable amount of time.
Starting with an initial ranking (top four teams go to the two-round playoffs), I set up matchups for the semifinals, then simulated games based on the historical scoring statistics for each team. Of course, this is incredibly simplistic, but I’m just getting started here!
Then I wrote a Python script to play them over and over, advancing the winning and losing teams to their respective finals positions, and determining the teams’ final ranks. Over 100,000 simulated playoffs, I was able to converge on a probability of each of four contenders to win it all - or achieve any particular final ranking.
Here are the teams’ final rankings probabilities:
| Final Rank | Ain't no NCAA | Sproles Royce | C-Men | Usual Suspects |
| 1st | 30% | 30% | 20% | 20% |
| 2nd | 27% | 27% | 23% | 23% |
| 3rd | 23% | 23% | 27% | 26% |
| 4th | 20% | 20% | 30% | 31% |
Of course, I wanted to understand whether my assumption that season-long scoring patterns were indicative of teams’ fitness today. Teams change over time as players are injured, or turn out to be better or worse than expected. Also, coaches’ weekly decisions to add or drop players, or play one player over another, can really impact performance.
Implicit in this model is the assumption that scoring is (more or less) normally distributed, and the distribution doesn’t change over time. One way to get a sense for that is to take a look at the distributions of scoring.
As you can see, not every scoring history is a clean normal distribution. The most obvious is that of the Usual Suspects. This appears to be essentially a bimodal distribution where (more often) the team hovers around unremarkable sub-150 point scores, but has a significant number of games in the more impressive high 100’s.
My own team, Ain’t no NCAA, shows a tendency to frequently underperform relative to the more prominent solid performance centered around 160 or so points. Sproles Royce and C-Men are more normally distributed and centered at just over 150 points per game.
To get a better feel for how things are looking now (versus a full-season look), I performed the same analysis on just the last seven weeks of the regular season. Warning: Now we’re talking about a very small data set, but the graphs are pretty anyway…
As you can see, this new look doesn’t bode well for me or my good friends the Usual Suspects paints a slightly different picture.
Ain’t no NCAA: My boys have seemed to either really bring it or stink it up over the last seven weeks, with peaks near 140 and 180. This makes for a very unpredictable outcome for me. I could probably model around this bimodal distribution but, hey, it’s just a game!
Sproles Royce: A more symmetrical distribution I can’t hope to see. These guys can expect a consistent playoffs performance if the last seven weeks are indicative, with some slight tendency for outlying good and bad performances.
C-Men: These guys have recently been consistently centered around a slightly sub-par level, but with significant departures to the extreme upside. In normal mode, they can expect to lose at least one, but they have enough upside to bring it home.
Usual Suspects: Their recent performances seem to be slightly weighted toward the negative, but they also have some long-tail high-scoring potential.
I re-ran the simulation and, as expected, the projected results don’t look great for Ain’t no NCAA or the Usual Suspects.
| Final Rank | Ain't no NCAA | Sproles Royce | C-Men | Usual Suspects |
| 1st | 26% | 30% | 27% | 17% |
| 2nd | 30% | 22% | 21% | 27% |
| 3rd | 20% | 20% | 29% | 22% |
| 4th | 24% | 20% | 23% | 34% |
Somewhat ironically, the recent C-Men victory that pushed them from 4th to 3rd place has damaged their prospects if recent performance is an indicator of playoffs performance. The two recently strongest teams are in positions 2 and 3, lessening each of their prospects to advance to the finals. Both are favorites f they do advance, however.
My projection for the final ranking:
| Projected Final Rank | Team |
| 1st Place | Sproles Royce |
| 2nd Place | Ain't no NCAA' |
| 3rd Place | C-Men |
| 4th Place | Usual Suspects |
Of course, there’s no telling if even this is a valid model. The sample size is small, and there is likely more unutilized predictive power in the data. Maybe the model would be more robust if I’d modeled individual players’ performances - certainly it would help to iron out the noise of changing rosters. Or, how good are the projections provided by Yahoo!? If I had normalized on those would this model be better? Probably.
Who knows? All I really know is that I’m in the playoffs for the first time since I joined this league. That will do.
comments powered by Disqus


Turns on HTTP redirect for all or part of a website.
Set-IisHttpRedirect [-SiteName] <String> [[-VirtualPath] <String>] [-Destination] <String> [[-HttpResponseStatus] {Permanent | Found | Temporary}] [-ExactDestination] [-ChildOnly] [-WhatIf] [-Confirm] [<CommonParameters>]
Configures all or part of a website to redirect all requests to another website/URL. By default, it operates on a specific website. To configure a directory under a website, set VirtualPath
to the virtual path of that directory.
Beginning with Carbon 2.0.1, this function is available only if IIS is installed.
| Name | Type | Description | Required? | Pipeline Input | Default Value |
|---|---|---|---|---|---|
| SiteName | String | The site where the redirection should be setup. |
true | false | |
| VirtualPath | String | The optional path where redirection should be setup. |
false | false | |
| Destination | String | The destination to redirect to. |
true | false | |
| HttpResponseStatus | HttpResponseStatus | The HTTP status code to use. Default is |
false | false | Found |
| ExactDestination | SwitchParameter | Redirect all requests to exact destination (instead of relative to destination). I have no idea what this means. Maybe TechNet can help. |
false | false | False |
| ChildOnly | SwitchParameter | Only redirect requests to content in site and/or path, but nothing below it. I have no idea what this means. Maybe TechNet can help. |
false | false | False |
| WhatIf | SwitchParameter | false | false | ||
| Confirm | SwitchParameter | false | false | ||
| CommonParameters | This cmdlet supports common parameters. For more information type Get-Help about_CommonParameters . |
Set-IisHttpRedirect -SiteName Peanuts -Destination 'http://new.peanuts.com'
Redirects all requests to the Peanuts
website to http://new.peanuts.com
.
Set-IisHttpRedirect -SiteName Peanuts -VirtualPath Snoopy/DogHouse -Destination 'http://new.peanuts.com'
Redirects all requests to the /Snoopy/DogHouse
path on the Peanuts
website to http://new.peanuts.com
.
Set-IisHttpRedirect -SiteName Peanuts -Destination 'http://new.peanuts.com' -StatusCode 'Temporary'
Redirects all requests to the Peanuts
website to http://new.peanuts.com
with a temporary HTTP status code. You can also specify Found
(HTTP 302), or Permanent
(HTTP 301).


| DOSE: T+ 0:00 |
110 mg |
oral |
AMT |
(powder / crystals) |
| T+ 0:30 |
|
smoked |
Cannabis |
(plant material) |
| T+ 6:00 |
|
smoked |
Cannabis |
(plant material) |
This being my second experiment with AMT, I have planned on doubling the dose. While I did vomit about 2 hours into the last experiment, I believe I might know how to prevent that this time around. Namely: drinking lots of water and smoking a little weed. We shall see.
A little background: I have taken LSD well over a hundred times, as well as shrooms and mescaline more than a few dozen, and E about a dozen or more. I was a habitual MJ user (once a day or more) for approximately 9 years up until my current sojourn in this place I live now. With psychedelic substances, I consider myself more of an explorer than a recreational user. This means that something of practical use must emerge for me to regard the experience as a success.
I ingested a solution containing approximately 100-120mg of AMT dissolved in ethanol on an empty stomach at 12:33pm. Hopefully this will deliver the compound into my system as fast as possible. [unfortunately I did not have access to tools which could make exact measurements this tiny] After ingesting the solution, I made an effort to slowly drink a good deal of water to prompt flushing of wastes through urine. This is a record of events as they happened.
T+30min - Well, so much for not puking!! Nausea came on quick this time - there was no option, although the vomit was not worse than a normal vomit, especially since it was mostly water. I was on the second puff from a nice bowl and it struck like lightning. Hopefully the AMT was absorbed - and from the effects I seem to already be feeling, it has. I have a massive body buzz.
T+1hr30min - I puked a second time about 10 min after the last report. Afterwards I felt strong somehow - positive that nausea would not return. At this point I am 'tripping balls' as we used to say (and still do). This is definately no lesser psychedelic - although so far the body buzz clearly predominates over the mental stuff (which is still pleasantly there). I would liken this to halfway between LSD and MDMA on my personal subjective spectrum. And I have apparently taken a strong dose. Very pleasurable so far (aside from the hated puke sessions - always a con in my book), although there is a significant amount of desire for jaw clenching. I am finding that totally relaxing (especially face muscles) almost completely gets rid of it. Visuals are apparent yet subtle, but then again it is daylight all around me.
T+2hr - Damn I feel REALLY good. Bodily, emotionally, mentally - and strangely enough I am objective enough to know it is all drug induced. Yet that is cool - humor is in no lack at all. I am probably going to smoke some weed and go for a walk outside now.
T+3hr - no walk happened, got distracted by music and funky insights then I started having the classic 100% elightenment experience - I am still in rapture at this moment. The drug has a bodily presence but seems greatly minimized by the fact that I have no food in me and just water as beverage. In essence, though - it is only a by-product of what is happening RIGHT NOW. That takes immediate precedence, of course! I feel suffused with pure love.
T+6hr(??) - Time has lost meaning. Im still going strong and I feel like its been generations since I last reported. Had a nice bowl just now - mellowed things out a bit.  I dont think I understand the weird intricacies and hyprocrasies of the whole drug war.
T+11hr - Coming down now. I think the water helped immensely because my body doesn't feel 1/2 as bad as the first time I took AMT (which was at 1/2 the dosage I took today). Of course I also took a Vitamin C pill earlier as well. Even though I know I'm on the downward from here, I am still very much feeling the effects. A wonderful experience all in all. I guess a puke won't stand in my way of trying this stuff again. Although its good to keep in mind you shouldn't be throwing up all the time - very bad for the teeth.  There were deep, cosmic insights but they were all delivered from within love. Now I am surrounded by it. I know it sounds stupid, but I am fairly certain I can draw upon this experience for support in the future. Clearly a 'teacher' drug - and a very benevolent one at that. I am not in the least bit tired yet.
--------------------------------------------
2 days later - Well, the day after was not nearly as bad as the first time - in fact I felt fine if a bit lazy. I am still happy (in a normal sort of way), and it feels like a legacy effect of the good time I had on AMT. It was a refreshing lift above the doldrums of day to day life, very much like a tropical vacation (of the mind). Much more so than the first time I took it (at 1/2 this dosage), I found that the spiritual and 'cosmic' aspects were the main course - with all the body ecstacies and emotional euphorias featured more as highlights. Visuals were subtle throughout, although they were clearly present. I must reiterate that keeping a clean system throughout the experience by drinking only water or juice, (and supplemented by a Vitamin C tablet) completely negated any negative physical side effects (except the jaw clenching and a headache which was relieved by aspirin).
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


--- layout: install ---
Open 3D Slicer. Once it is launched click on the "Extensions Manager" button.
Once the Extension Manager pops up, make sure that the "Install Extensions" tab is selected. Click on the search box on the top right and type DeepInfer.
Click on the install button and wait until it installation is done. Then press the restart button.
Once you installed DeepInfer, follow the steps below to make sure that the DeepInfer is installed correctly and can communicate with the Docker application.
Go to the modules menu and choose Machine Learning > DeepInfer module.
In the DeepInfer module user interface, find the docker settings tab, press the test button to test docker configuration.
If the Docker is installed and configured correctly on your system you will get the following popup widow with information about the version of Docker. Otherwise, if you are getting a warning for docker configuration check your Docker installation and configuration.


//="html/header.html" //="html/question.html" //="html/free-access.html" //="html/market-review.html" //="html/it-way.html" //="html/rewards.html" //="html/footer.html"


Chametz Sale
- Chametz are leavened foods that are forbidden on the Jewish holiday of Passover. According to Jewish law, Jews may not own, eat or benefit from chametz during Passover.
- They are very complicated. See a summary here.
- With the smart contract jews could sell their Chametz for 30 finney (around $1) and buy it back after Passover ends for 60 finney.
- When offering Chametz for sale the seller deposit 30 finney.
- When buying Chametz the buyer pays 30 finney to the contract.
- When passover ends the buyer returns the Chametz and get 60 finney.
- Read the contract.
- Beware that seller is always losing money and buyer always gain some.
- Please buy only if you are not a jew.
The DAPP
Your account:
Loading...


For details refer to http://www.wellenvogel.net/software/avnav/index.php.
License: The MIT License (MIT)
Copyright (c) 2013-2021 Andreas Vogel
Scroll down for privacy information
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Used Libraries and their licenses:https://code.google.com/p/tilers-tools/
http://www.movable-type.co.uk/scripts/latlong.html
http://www.tutorial9.net/downloads/108-mono-icons-huge-set-of-minimal-icons/
free, no attribution
Icon made from Icon Fonts is licensed by CC BY 3.0


--- layout: post status: publish published: true title: Final Ubuntu Hibernate Touches author: display_name: Tomas Restrepo login: tomasr email<EMAIL_ADDRESS>url: http://winterdom.com/ author_login: tomasr author_email<EMAIL_ADDRESS>author_url: http://winterdom.com/ wordpress_id: 669 wordpress_url: http://winterdom.com/2009/02/finalubuntuhibernatetouches date: '2009-02-19 19:11:05 +0000' date_gmt: '2009-02-19 19:11:05 +0000' categories: - Linux tags: [] comments: [] ---
As I commented back in December, I “fixed” the hibernate functionality in Ubuntu 8.10 on my Dell Latitude D820 by making sure there was an active swap partition configured for the resume functionality.
This wasn’t quite true, however. Hibernate seemed to work. but occasionally (about 33% of the time), it would seem as if the machine would restart when trying to resume from hibernation. I didn’t look into this for a while, but it was certainly annoying.
I did figure out what was going on eventually: The machine was actually coming out of hibernation just fine, but X was restarting. I realized this after noticing some live gnu screen sessions running in the background right after coming from hibernation.
So that pretty much meant the problem had to be related to issues with the NVidia video driver, and the fix was something I had already tried in the past: Adjusting /etc/default/acpi-support
:
SAVE_VBE_STATE=false
POST_VIDEO=false
I did this a couple weeks ago, and haven’t run into the resume problem since. Hopefully next time I will remember it when I reinstall the OS instead of fumbling with it for weeks!


Academic Service
I’m actually involved in the co-organization of the ASF GDR Winter school in distributed systems
as well as co-chair for the M4IoT workshop (2021,2020,2019,2018,2017) collocated with ACM/IFIP/USENIX Middleware conference.
I have served as a reviewer for IEEE International Conference on Distributed Computing Systems, ACM SIGCOMM Computer Communication Review and IEEE Transactions on Dependable and Secure Computing.
I also previously served in the Technical Program Committee for DFSD (2020, 2019) as well as Shadow PC member for Eurosys (2019, 2018).
I’ve been a visiting researcher at Università della Svizzera Italiana in Switzerland during summer 2016 under the supervision of Pr. Antonio Carzaniga, working on congestion-centred distributed routing protocols.
Awards
BEST PAPER AWARD
for our paper Khronos: Middleware for Simplified Time Management in CPS with Stefanos Peros, Sam Michiels, Wouter Joosen and Danny Hughes at ACM International Conference on Distributed and Event-Based Systems (DEBS 2019) pdf
BEST PAPER AWARD
for our paper Selective Jamming of LoRaWAN using Commodity Hardware with Emekcan Aras, Nicolas J. Small, Gowri Sankar Ramachandran, Wouter Joosen and Danny Hughes at 14th EAI International Conference on Mobile and Ubiquitous Systems: Computing, Networking and Services (MobiQuitous 2017) pdf
BEST PAPER AWARD
for our paper Exploring the Use of Tags for Georeplicated Content Placement with Davide Frey and François Taïani at IEEE International Conference on Cloud Engineering (IC2E 2016) pdf


| Exercise & Training |
|---|
|
Exercise
Frenchies love being a couch potato but also love exercise and being with their human. They don't need much exercise
to keep them healthy, as long as you're not over feeding them. Just an hour a day of either outside activity or a
walk or just playing around with them in the house would suffice for their exercise. Make sure to take breaks when
they start to pant or breathe heavy, again because of their short snouts.
|
|
Training
Early exposure to people, dogs and places is always good for any dog and especially for French Bulldogs to help with
their socialization skills. French Bulldogs can be stubborn but with the correct motivation and treats to ensure them
of the things they do correctly they will learn and adapt!
|


{#- We can't mount GOV.UK Frontend's assets at root as it's done automatically by the extensions framework. -#} {%- set assetPath = '/govuk/assets' -%} {% extends "govuk-prototype-kit/layouts/govuk-branded.njk" %} {% block head %} {% include "includes/head.html" %} {% endblock %} {% block pageTitle %} GOV.UK Prototype Kit {% endblock %} {% block header %} {% include "includes/cookie-banner.html" %} {# Set serviceName in config.js. #} {{ govukHeader({ homepageUrl: "/", serviceName: serviceName, serviceUrl: "/", containerClasses: "govuk-width-container" }) }}


|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.vertx.java.core.buffer.Buffer org.vertx.groovy.core.buffer.Buffer
@groovy.transform.CompileStatic class Buffer extends Buffer
A Buffer represents a sequence of zero or more bytes that can be written to or read from, and which expands as necessary to accomodate any bytes written to it.
There are two ways to write data to a Buffer: The first method involves methods that take the form setXXX. These methods write data into the buffer starting at the specified position. The position does not have to be inside data that has already been written to the buffer; the buffer will automatically expand to encompass the position plus any data that needs to be written. All positions are measured in bytes and start with zero.
The second method involves methods that take the form appendXXX; these methods append data at the end of the buffer.
Methods exist to both set and append all primitive types, java.lang.String, java.nio.ByteBuffer and other instances of Buffer.
Data can be read from a buffer by invoking methods which take the form getXXX. These methods take a parameter representing the position in the Buffer from where to read data.
Methods putAt and getAt are defined allowing you to use index notation to get/set bytes at a specific position in the buffer.
Methods leftShift are defined to mean append allowing you to use the familiar Groovy << operator on buffers.
We extend JBuffer so we can send Groovy Buffers to writeHandlers of NetSocket and SockJSSocket
| Constructor Summary | |
Buffer(Buffer jBuffer)
|
|
Buffer()
Create an empty buffer |
|
Buffer(int initialSizeHint)
Creates a new empty Buffer that is expected to have a size of initialSizeHint after data has been written to it. |
|
Buffer(byte[] bytes)
Create a new Buffer that contains the contents of a byte[] |
|
Buffer(java.lang.String str, java.lang.String enc)
Create a new Buffer that contains the contents of a String str encoded according to the encoding enc |
|
Buffer(java.lang.String str)
Create a new Buffer that contains the contents of String str encoded with UTF-8 encoding |
| Method Summary | |
|---|---|
Buffer
|
appendBuffer(Buffer buff)
Appends the specified Buffer to the end of this Buffer. |
Buffer
|
appendByte(byte b)
Appends the specified byte to the end of the Buffer. |
Buffer
|
appendBytes(byte[] bytes)
Appends the specified byte[] to the end of the Buffer. |
Buffer
|
appendDouble(double d)
Appends the specified double to the end of the Buffer. |
Buffer
|
appendFloat(float f)
Appends the specified float to the end of the Buffer. |
Buffer
|
appendInt(int i)
Appends the specified int to the end of the Buffer. |
Buffer
|
appendLong(long l)
Appends the specified long to the end of the Buffer. |
Buffer
|
appendShort(short s)
Appends the specified short to the end of the Buffer.The buffer will expand as necessary to accomodate any bytes written. |
Buffer
|
appendString(java.lang.String str, java.lang.String enc)
Appends the specified String to the end of the Buffer with the encoding as specified by enc. |
Buffer
|
appendString(java.lang.String str)
Appends the specified String str to the end of the Buffer with UTF-8 encoding. |
Buffer
|
copy()
Returns a copy of the entire Buffer. |
byte
|
getAt(int pos)
Same as getByte(int) |
Buffer
|
getBuffer(int start, int end)
Returns a copy of a sub-sequence the Buffer as a Buffer starting at position start and ending at position end - 1 |
byte
|
getByte(int pos)
Returns the byte at position pos in the Buffer. |
byte[]
|
getBytes()
Returns a copy of the entire Buffer as a byte[] |
byte[]
|
getBytes(int start, int end)
Returns a copy of a sub-sequence the Buffer as a byte[] starting at position start and ending at position end - 1 |
double
|
getDouble(int pos)
Returns the double at position pos in the Buffer. |
float
|
getFloat(int pos)
Returns the float at position pos in the Buffer. |
int
|
getInt(int pos)
Returns the int at position pos in the Buffer. |
int
|
getLength()
Synonym for length |
long
|
getLong(int pos)
Returns the long at position pos in the Buffer. |
short
|
getShort(int pos)
Returns the short at position pos in the Buffer. |
java.lang.String
|
getString(int start, int end, java.lang.String enc)
Returns a copy of a sub-sequence the Buffer as a String starting at position start and ending at position end - 1 interpreted as a String in the specified encoding |
java.lang.String
|
getString(int start, int end)
Returns a copy of a sub-sequence the Buffer as a String starting at position start and ending at position end - 1 interpreted as a String in UTF-8 encoding |
int
|
hashCode()
|
Buffer
|
leftShift(Buffer buff)
Same as appendBuffer(Buffer) |
Buffer
|
leftShift(byte[] bytes)
Same as appendBytes(byte[]) |
Buffer
|
leftShift(byte b)
Same as appendByte(byte) |
Buffer
|
leftShift(int i)
Same as appendInt(int) |
Buffer
|
leftShift(long l)
Same as appendLong(long) |
Buffer
|
leftShift(short s)
Same as appendShort(short) |
Buffer
|
leftShift(float f)
Same as appendFloat(float) |
Buffer
|
leftShift(double d)
Same as appendDouble(double) |
Buffer
|
leftShift(java.lang.String s)
Same as appendString(String) |
int
|
length()
Returns the length of the buffer, measured in bytes. |
void
|
putAt(int pos, byte b)
Same as setByte(int, byte) |
void
|
putAt(int pos, int i)
Same as setInt(int, int) |
void
|
putAt(int pos, long l)
Same as setLong(int, long) |
void
|
putAt(int pos, double d)
Same as setDouble(int, double) |
void
|
putAt(int pos, float f)
Same as setFloat(int, float) |
void
|
putAt(int pos, short s)
Same as setShort(int, short) |
void
|
putAt(int pos, Buffer b)
Same as setBuffer(int, Buffer) |
void
|
putAt(int pos, java.nio.ByteBuffer b)
Same as setBytes(int, ByteBuffer) |
void
|
putAt(int pos, byte[] b)
Same as setBytes(int, byte[]) |
void
|
putAt(int pos, java.lang.String str)
Same as setString(int, String) |
Buffer
|
setBuffer(int pos, Buffer b)
Sets the bytes at position pos in the Buffer to the bytes represented by the Buffer b. |
Buffer
|
setByte(int pos, byte b)
Sets the byte at position pos in the Buffer to the value b. |
Buffer
|
setBytes(int pos, java.nio.ByteBuffer b)
Sets the bytes at position pos in the Buffer to the bytes represented by the ByteBuffer b. |
Buffer
|
setBytes(int pos, byte[] b)
Sets the bytes at position pos in the Buffer to the bytes represented by the byte[] b. |
Buffer
|
setDouble(int pos, double d)
Sets the double at position pos in the Buffer to the value d. |
Buffer
|
setFloat(int pos, float f)
Sets the float at position pos in the Buffer to the value f. |
Buffer
|
setInt(int pos, int i)
Sets the int at position pos in the Buffer to the value i. |
Buffer
|
setLong(int pos, long l)
Sets the long at position pos in the Buffer to the value l. |
Buffer
|
setShort(int pos, short s)
Sets the short at position pos in the Buffer to the value s. |
Buffer
|
setString(int pos, java.lang.String str)
Sets the bytes at position pos in the Buffer to the value of str endoded in UTF-8. |
Buffer
|
setString(int pos, java.lang.String str, java.lang.String enc)
Sets the bytes at position pos in the Buffer to the value of str encoded in encoding enc. |
Buffer
|
toJavaBuffer()
Returns the underlying Java buffer |
java.lang.String
|
toString()
Returns a String represention of the Buffer with the encoding specified by enc |
| Constructor Detail |
|---|
Buffer(Buffer jBuffer)
Buffer()
Buffer(int initialSizeHint)
Please note that length of the Buffer immediately after creation will be zero.
The initialSizeHint is merely a hint to the system for how much memory to initially allocate to the buffer to prevent excessive automatic re-allocations as data is written to it.
Buffer(byte[] bytes)
Buffer(java.lang.String str, java.lang.String enc)
Buffer(java.lang.String str)
| Method Detail |
|---|
Buffer appendBuffer(Buffer buff)
Returns a reference to this so multiple operations can be appended together.
Buffer appendByte(byte b)
Returns a reference to this so multiple operations can be appended together.
Buffer appendBytes(byte[] bytes)
Returns a reference to this so multiple operations can be appended together.
Buffer appendDouble(double d)
Returns a reference to this so multiple operations can be appended together.
Buffer appendFloat(float f)
Returns a reference to this so multiple operations can be appended together.
Buffer appendInt(int i)
Returns a reference to this so multiple operations can be appended together.
Buffer appendLong(long l)
Returns a reference to this so multiple operations can be appended together.
Buffer appendShort(short s)
Returns a reference to this so multiple operations can be appended together.
Buffer appendString(java.lang.String str, java.lang.String enc)
The buffer will expand as necessary to accomodate any bytes written.
Returns a reference to this so multiple operations can be appended together.
Buffer appendString(java.lang.String str)
The buffer will expand as necessary to accomodate any bytes written.
Returns a reference to this so multiple operations can be appended together
Buffer copy()
byte getAt(int pos)
Buffer getBuffer(int start, int end)
byte getByte(int pos)
byte[] getBytes()
byte[] getBytes(int start, int end)
double getDouble(int pos)
float getFloat(int pos)
int getInt(int pos)
int getLength()
long getLong(int pos)
short getShort(int pos)
java.lang.String getString(int start, int end, java.lang.String enc)
java.lang.String getString(int start, int end)
int hashCode()
Buffer leftShift(Buffer buff)
Buffer leftShift(byte[] bytes)
Buffer leftShift(byte b)
Buffer leftShift(int i)
Buffer leftShift(long l)
Buffer leftShift(short s)
Buffer leftShift(float f)
Buffer leftShift(double d)
Buffer leftShift(java.lang.String s)
int length()
void putAt(int pos, byte b)
void putAt(int pos, int i)
void putAt(int pos, long l)
void putAt(int pos, double d)
void putAt(int pos, float f)
void putAt(int pos, short s)
void putAt(int pos, Buffer b)
void putAt(int pos, java.nio.ByteBuffer b)
void putAt(int pos, byte[] b)
void putAt(int pos, java.lang.String str)
Buffer setBuffer(int pos, Buffer b)
The buffer will expand as necessary to accomodate any value written.
Buffer setByte(int pos, byte b)
The buffer will expand as necessary to accomodate any value written.
Buffer setBytes(int pos, java.nio.ByteBuffer b)
The buffer will expand as necessary to accomodate any value written.
Buffer setBytes(int pos, byte[] b)
The buffer will expand as necessary to accomodate any value written.
Buffer setDouble(int pos, double d)
The buffer will expand as necessary to accomodate any value written.
Buffer setFloat(int pos, float f)
The buffer will expand as necessary to accomodate any value written.
Buffer setInt(int pos, int i)
The buffer will expand as necessary to accomodate any value written.
Buffer setLong(int pos, long l)
The buffer will expand as necessary to accomodate any value written.
Buffer setShort(int pos, short s)
The buffer will expand as necessary to accomodate any value written.
Buffer setString(int pos, java.lang.String str)
The buffer will expand as necessary to accomodate any value written.
Buffer setString(int pos, java.lang.String str, java.lang.String enc)
The buffer will expand as necessary to accomodate any value written.
Buffer toJavaBuffer()
java.lang.String toString()
Groovy Documentation


What The Green Light Means
You’re letting Veterans know you support them as they leave military service and become your
community neighbor.
Let this light shine from your home, workplace or phone.
Green is a powerful color, meaning growth, possibility, beginnings.
As this light shines, it shows that through us, the mission continues.
Leave A Light On
to show your support!


--- layout: post title: How to scrape a webpage with Perl date: 2011-10-02 10:34:00.000000000 +02:00 type: post published: true status: publish categories: - Coding tags: - perl - website scraping meta: posterous_6b63f8d297c73139dd329498419cf441_post_id: '73564954' posterous_6b63f8d297c73139dd329498419cf441_permalink: http://exploringtheweb.net/how-to-scrape-a-webpage-with-perl-searching-f _thumbnail_id: '1338' _edit_last: '1' _wp_old_slug: how-to-scrape-a-webpage-with-perl-getting-book-categories dsq_thread_id: '500590481' author: login: bbWebdesign email<EMAIL_ADDRESS>display_name: Bob first_name: Bob last_name: Belderbos ---
I wanted to have a book category list for a potential feature in My Reading List. I found this page. Then I wondered how I could parse the html to reuse the categories. It turned out to be pretty easy in Perl :)
You can download the script here. It does the following:
Perl's motto is TMTOWTDI (There's more than one way to do it), so I would be happy to hear any suggestions to improve this script.
At least it got the job done. It was just a quick test. Ideally you would want to make it re-usable:
1. receive URL from cli as well
2. put parsing in functions and let user define those as well.
- with this in place it could be extended to be a generic/simple URL/content parser.


You'll soon be able to sign up for office hours via this page. Meanwhile, check out the calendar for a list of office hours.


Author: Sande Gilda, Emmanuel Hugonett
Level: Beginner
Technologies: WebSocket, CDI, JSF
Summary: The websocket-hello
quickstart demonstrates how to create a simple WebSocket application.
Target Product: JBoss EAP
Source: https://github.com/jboss-developer/jboss-eap-quickstarts/
The websocket-hello
quickstart demonstrates how to create a simple WebSocket-enabled application in Red Hat JBoss Enterprise Application Platform. It consists of the following:
jboss-web.xml
file configured to enable WebSocketsWebSockets are a requirement of the Java EE 7 specification and are implemented in JBoss EAP 7.1. They are configured in the undertow
subsystem of the server configuration file. This quickstart uses the WebSocket default settings, so it is not necessary to modify the server configuration to deploy and run this quickstart.
Note: This quickstart demonstrates only a few of the basic functions. A fully functional application should provide better error handling and intercept and handle additional events.
The application this project produces is designed to be run on Red Hat JBoss Enterprise Application Platform 7.1 or later.
All you need to build this project is Java 8.0 (Java SDK 1.8) or later and Maven 3.3.1 or later. See Configure Maven for JBoss EAP 7.1 to make sure you are configured correctly for testing the quickstarts.
In the following instructions, replace EAP7_HOME
with the actual path to your JBoss EAP installation. The installation path is described in detail here: Use of EAP7_HOME and JBOSS_HOME Variables.
For Linux: EAP7_HOME/bin/standalone.sh
For Windows: EAP7_HOME\bin\standalone.bat
mvn clean install wildfly:deploy
This will deploy target/websocket-hello.war
to the running instance of the server.
The application will be running at the following URL: http://localhost:8080/websocket-hello/.
Open Connection
button to create the WebSocket connection and display current status of Open
.Say Hello
to create and send the Say hello to <NAME>
message. The message appears in the server log and a response is sent to the client.Close Connection
button to close the WebSocket connection and display the current status of Closed
.WebSocket connection is not established. Please click the Open Connection button.
mvn wildfly:undeploy
You can also start the server and deploy the quickstarts or run the Arquillian tests from Eclipse using JBoss tools. For general information about how to import a quickstart, add a JBoss EAP server, and build and deploy a quickstart, see Use JBoss Developer Studio or Eclipse to Run the Quickstarts.
If you want to debug the source code of any library in the project, run the following command to pull the source into your local repository. The IDE should then detect it.
mvn dependency:sources


jQuery Simple Slider Examples
Here are a few examples of the functionality available in Simple Slider.
Basic Example
Basic Example (Themed)
Predefined Value
Steps
Range
Range & Steps
Range, Steps & Snap
Predefined List of Values
Predefined List & Snap
Predefined List, Equal Steps & Snap
Highlighted
Highlighted (Themed)


Home
Register
Team
Sponsors
Gallery
Thanks for registration, we'll contact you soon.
Hill
'
ffair 2k19
3
rd
-
5
th
Oct
Register for this Hill
'
ffair
'
s
Battle of Bands
Name
Team
Email
Phone Number
College
City
Battle of Bands
Reason for Registration
Registered Successfully, we'll contact you soon!


To the extent possible under law, the editor has waived all copyright and related or neighboring rights to this work. In addition, as of [DATE], the editor has made this specification available under the Open Web Foundation Agreement Version 1.0, which is available at http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0.
This specification defines features often used when printing books or magazines. Using this functionality, documents written in HTML can be presented in a book-like manner, either on screen or on paper. Real books are being published with functionality described in this specification.
This specification is in the process of establishing itself in WHATWG. Most of this specification has been interoperably implemented and is in daily use by publishers. Implementation coverage is documented here.
The main goal of this specification is to enable authors to write books in HTML or other markup languages. Book publishing is a craft with long traditions and certain formatting conventions have developed over time. This specification adds functionality to CSS so that style sheets can express commonly used features in printed books, on-screen books, and page description languages. These features are also often used by magazines, in brochures, and in other publications.
All diagrams, examples, and notes in this specification are non-normative, as are all sections explicitly marked non-normative. Everything else in this specification is normative.
The key words "MUST", "MUST NOT", "REQUIRED", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this specification are to be interpreted as described in RFC2119. For readability, these words do not appear in all uppercase letters in this specification. RFC2119
Conformance requirements phrased as algorithms or specific steps may be implemented in any manner, so long as the end result is equivalent.
User agents may impose implementation-specific limits on otherwise unconstrained inputs, e.g. to prevent denial of service attacks, to guard against running out of memory, or to work around platform-specific limitations.
A book is a collection of sheets, bound together within covers. Usually, the sheets are printed paper sheets of a uniform size. The book format, known as the codex was developed around 2000 years ago and books gradually replaced scrolls, clay tablets and other competing formats. With the invention of the printing press, books could be printed and distributed inexpesively.
Each sheet of paper has two sides, and most books are have content on both sides of the sheets. Each side is called a "page". When a book is opened, two pages are visible; these form one "spread". The main problem when producing books from web content is to split content into pages and spreads of certain fixed sizes. This problem is not addressed by this specification. Instead, this specification describes how to achieve many of the features printers have developed over the centuries, e.g, running headers, footnotes, sidenotes, and page groups.
To aid navigation in printed material, headers and footers are often printed in the page margins. CSSPAGE describes how to place headers and footers on a page, but not how to fetch headers and footers from elements in the document. This specification offers two ways to achieve this. The first mechanism is named strings which copies the text (without style, structure, or replaced content) of an element for later reuse in margin boxes. The second mechanism is running elements which moves elements (with style, structure, and replaced content) into a margin box.
A named string can be thought of as a variable that hold a string of text. Named strings are created with the 'string-set' property which copies a string of text into a named string. Only text is copied; not style, structure, or replaced content.
Consider this code:
h1 { string-set: heading content() }
Whenever an h1
element is encountered,
its textual content is copied into a named string called
heading. The string can later be retrieved in the 'content'
property:
@page { @top-center { content: string(heading) }}
| Name: | string-set |
| Value: | [[ <identifier> <content-list>] [, <identifier> <content-list>]* ] | none |
| Initial: | none |
| Applies to: | all elements |
| Inherited: | no |
| Percentages: | N/A |
| Media: | all |
| Computed value: | as specified value |
The 'string-set' property accepts a comma-separated list of named strings. Each named string is followed by a content list that specifies the text to assign to the named string. Whenever an element with value of 'string-set' different from ''none'' is encountered, the named strings are assigned their respective value. Implementations must keep track of named string assigments on a per-element basis; references to named strings can only be resolved after pagination (see Using named strings below).
<content-list> expands to one or more of these values, in any order:
The syntax is formally described as:
<content-list> = [ <string> | <counter> | [ content( [ before | after | first-letter ] ) ] ]+
Named strings can only hold the result of one assignment; whenever a new assignment is made to a named string, its old value is replaced.
User agents, however, must be able to remember the several assignments as the ''string()'' functional value (described below) can refer to different assignments.
The scope of a named string is the page of the element to which the 'string-set' property is attached and subsequent pages.
h2 { string-set: header "Chapter " counter(header) ": " content(); counter-increment: header; }
Europa

Note that the string called "header" is different from the counter with the same name. The above code may result in the string called "header" is set to "Chapter 1: Europa".
The textual content of the named string is processed as if 'white-space: normal' has been set.
In this example, the header will consist of three words ("In the beginning") with normal spacing between the words.
h2 { string-set: header "In " ' ' content(); }
 the beginning

In this example, the named string called index will hold the first letter of
 elements.
dt { string-set: index content(first-letter) }
One-letter running headers are often used in dictionaries.
The textual content is copied regardless of values on other CSS properties.
In this example, the first four declarations have no effect on the on the named string copied in the last declaration:
title { display: none; content: "foo"; text-transform: uppercase; text-replace: "foo" "bar"; string-set: title content(); }
Named strings can be referred to with the ''string()'' value on the 'content' property. The ''string()'' value has one required argument (the name of the string), and one optional argument that indicates which string assignment to use. References to named strings can only be resolved after pagination.
@page { @top-center { content: string(header) }} @page { @right-middle { content: string(index) }} @page { @top-left { content: string(entry) }} h1 { string-set: header "Chapter " counter(chapter) content() } dt { string-set: index content(first-letter), entry content() }
If the value of the named string is changed by an element on a certain page, the named string may have several values on that page. In order to specify which of these values should be used, an optional second argument is accepted on the ''string()'' value. This argument can have one of four keywords:
The syntax of the ''string()'' value is:
string( <custom-ident> [ , [ first | start | last | first-except ]]? )
The assignment is considered to take place on the first page where a content box representing the element occurs. If the element does not have any content boxes (e.g., if 'display: none' is set), the assignment is considered to take place on the page where the first content box would have occured if the element had been in the normal flow.
In this example, the first term on the page will be shown in the top left corner and the last term on the page will be shown in the top right corner. In top center of the page, the first letter of first term will be shown.
@page { @top-left { content: string(term, first) }} @page { @top-right { content: string(term, last) }} @page { @top-center { content: string(index, first) }} dt { string-set: index content(first-letter), term content(text) }
Given this CSS code:
h2 { string-set: header content() }
The value of the header string
| page# | HTML code | first | start | last | first-except |
| 1 |

Continents
 ...
Africa
 ... ... | Africa | Africa | Africa | |
| 2 |
...
Americas
 ...
Asia
 ... | Americas | Africa | Asia | |
| 3 |
... ... ... ... | Asia | Asia | Asia | Asia |
| 4 |

Europe
 ...
Oceania
 .. | Europe | Europe | Oceania |
In this example, the term that is being described at the start of the page is shown in the top left header.
@page { @top-left { content: string(term, start) }} dt { string-set: term content() }
@page { @top-left { content: string(term, first) }} @page { @top-right { content: string(term, last) }} @page { @top-center { content: string(index, first) }} dt { string-set: index content(first-letter), term content(text) }
In this example, the header in the top center will be blank on pages where 'h1' elements appear. On other pages, the string of the previous 'h1' element will be shown.
@page { @top-center { content: string(chapter, first-except) }} h1 { string-set: chapter content() }
If the named string referred to in a 'string()' value has not been assigned a value, the empty string is used.
Named strings, as described above, can only hold textual content; any style, structure or replaced content associated with the element is ignored. To overcome this limitation, a way of moving elements into running headers and footers is introduced.
Elements that are moved into headers and footers are repeated on several pages; they are said to be running elements. To support running elements, a new value – running() – is introduced on the 'position' property. It has one required argument: the name by which the running element can be referred to. A running element is not shown in its natural place; there it is treated as if 'display: none' had been set. Instead, the running element is displayed when referred to by the ''element()'' value.
Like counters and named strings, the name of a running element is chosen by the style sheet author, and the names have a separate namespace. A running element can hold one element, including its pseudo-elements and its descendants. Whenever a new element is assigned to a running element, the old element is lost.
User agents, however, must be able to remember the result of more than one assignment as the ''element()'' value (described below) can refer to different assignments.
Running elements inherit through their normal place in the structure of the document.
title { position: running(header) } @page { @top-center { content: element(header) } }
Like the ''string()'' value, the ''element()'' value accepts an optional second argument. The syntax is defined as:
element( <custom-ident> [ , [ first | start | last | first-except ]]? )
The keywords have the same meaning as for the ''string()'' value.
The ''element()'' value is only allowed on the 'content' property within a margin box. The ''element()'' value cannot be combined with any other values.
In this example, the header is hidden from view in all media types except print. On printed pages, the header is displayed top center on all pages, except where h1 elements appear.
 ...
Introduction

An introduction

This code illustrates how to change the running header on one page in the middle of a run of pages:
...  ...
Not now

Da di ha di da di ... NOW! Not now ... da di ha di hum.
 ...The header is "Not now" from the outset, due to the "div" element. The first "span" element changes it to "NOW!" on the page where the "span" element would have appeared. The second "span" element, which would have appeared on the same page as the first is not used because the ''first'' keyword has been specified. However, the second "span" element still sets the exit value for "header" and this value is used on subsequent pages.
A leader is a visual pattern that guides the eye. Typically, leaders are used to visually connect an entry in a list with a corresponding code. For example, there are often leaders between titles and page numbers in a table of contents (TOC). Another example is the phone book where there are leaders between a name and a telephone number.
In CSS3, a leader is composed of series of glyphs through the ''leader()'' value on the 'content' property. The functional notation accepts two values. The first describes the glyph pattern that makes up the leader. The syntax is:
leader( [ dotted | solid | space | <string> ] )
Using the keyword values is equivalent to setting a string value. The table below shows the equivalents:
| Keyword | String | Unicode characters |
|---|---|---|
| leader(dotted) | leader('. ') | \002E \0020 |
| leader(solid) | leader('_') | \005F |
| leader(space) | leader(' ') | \0020 |
The string inside the parenthesis is called the leader string. The leader string must be shown in full at least once, thereby pushing other content to the side (in the writing direction of the element to which the leader is attached). The leader string establishes the minimum length of the leader. If there is empty space on the line, the leader is expanded by repeating it as many times as possible. The expansion of a leader from its minimum length never causes line breaks to change. At the end of the leader, a partial leader string may be shown.
Line-breaking characters inside leader strings must be ignored. A list of line-breaking characters are found in [Unicode Technical Report #13]. Other white space characters are collapsed according to the values of white-space properties. A leader consisting only of whitespace characters is called a whitespace leader.
To determine the length of the leaders, user agents must do the following for each line where a leader appears:
By adding a leader to the ::after pseudo-element, a leader is added after the content of an element:
h1::after { content: leader(dotted) }
Dotted news

The formatted result may be:
|Dotted news...................|
By setting 'white-space: pre', the white space in the leader string is preserved:
h1::after { content: leader(' - '); white-space: pre; }
Dashing news

The formatted result may be:
|Dashing news - - - -|
If a leader is set on an inline element inside a justified paragraph, there will not be any empty space on the line. Therefore, the leader is shown only once.
span::after { content: leader('...'); }
A paragraph with a span inside.would be formatted as:
A paragraph with a span... inside.
The presence of a leader may influence tables. Consider this example with two table cells in one row:
td.leader::after { content: leader('..') }

foo	 bar

In UAs that don't do leaders, the two cells will have the same width and the table cells could be rendered like this:
|foo |bar |
When leaders are supported, the maximum cell width of the first cell grows, and the table cell could be rendered like this:
|foo........................................................|bar|
A table of contents often use leaders to visually connect a chapter title with the corresponding page number. This can be achieved with code like:
ul.toc a::after { content: leader(". . . ") target-counter(attr(href url), page); }
The formatted result could be:
Africa ...........1 America...........9 Antarctica.......56 Asia............134
The appearance of leaders is influenced by the same set of properties that influence the appearance of fixed strings.
The same properties can affect the presentation of the fixed string and the leader.
content: "..."; content: leader("...");
Line numbers sometimes displayed on the side of poetry, for reference purposes. In this example, a counter is dsplayed on every other line and pushed to the right by an invisible leader.
@page { counter-reset: line } .line { counter-increment: line } .line:nth-of-type(2n+1)::after { content: leader(space) counter(line) }
The formatted result could be:
Oh! let that eye, which, wild as the gazelle's, 1 Now brightly bold or beautifully shy, Wins as it wanders, dazzles where it dwells, 3 Glance o'er this page, nor to my verse deny
Note that the formatter doesn't really count lines, but rather elements marked up as lines.
A leader is only present on one line. If the presence of a minimum length leader at the end of a line results in subsequent content being moved to the next line, the leader will also be moved to the next line.
Consider this code:

 Douglas Adams 43

Depending on the width of the containing block, the content may or may not fit on one line. In the rendered examples below, the thrird rendition the leader and its subsequent content is moved to the second line.
|Douglas Adams......42|
|Douglas Adams...42|
|Douglas Adams | |..............42|
The purpose of a leader is most often to connect two strings visually. To achieve this, User Agents may chose to move content appearing before the leader onto the same line as the leader.
In this renditon, the User Agen has chosen to move "Adams" to the next line to preserve a visual connection:
|Douglas | |Adams.........42|
In cases where there is not enough space for content on both sides of the leader, the leader will remain on the same line as the following content.
|Douglas | |Adams | |.......42|
|Dou|glas |Ada|ms |...|42
In this example, a whitespace leader is placed before a  element:

 For a moment, nothing happend. Then, after a second or so, nothing continued to happen. Douglas Adams

Whitespace leaders do not connect two strings in the same way that visible leaders do. User Agents may therefore chose to not move content appearing before the leader onto the same line as the leader. This may result in a rendition like:
|For a moment, nothing happend. | |Then, after a second or so, | |nothing continued to happen. | | Douglas Adams|
Rather than:
|For a moment, nothing happend. | |Then, after a second or so, | |nothing continued to | |happen. Douglas Adams|
When possible, User Agents should align corresponding glyphs from the leaders of consecutive lines.
In this example, the dotted lines are aligned horizontally so that the dots appear directly above and below each other:
Alfa ........ 5 Bravo ...... 41 Charlie ... 125
It is common to refer to other parts of a document by way of a section number (e.g., "See section 3.4.1"), a page number (e.g., "See discussion on page 72"), or a string (e.g., "See the chapter on Europe"). This specification describes how to resolve cross-references automatically by introducing two new values on the 'content' property.
Numerical cross-references are generated by ''target-counter()'' and ''target-counters()'' values on the 'content' property that fetch the value of a counter at the target end of the link. These functions are similar to the ''counter()'' and ''counters()'' functions, except that they fetch counter values from remote elements. ''target-counter()'' has two required arguments: the url of the link, and the name of a counter. ''target-counters()'' has three required arguments: the url of the link, the name of a counter, and a separator string. Both functions accepts an optional argument at the end that describes which list style type to use when presenting the resulting number; ''decimal'' being the default. The syntax is defined as:
target-counter( <url> , <custom-ident> [ , <counter-style> ]? ) target-counters( <url> , <custom-ident> , <string> [ , <counter-style> ]? )
This style sheet specifies that a string like " (see page 72)" is added after a link:
a::after { content: "(see page " target-counter(attr(href url), page, decimal) ")" }
This style sheet specifies that a string like " (see section 1.3.5)" is added after a link:
a::after { content: "(see section " target-counters(attr(href url), section, ".", decimal) ")" }
Textual cross-references are generated by ''target-text()'' which fetches the textual content from the target end of the link. Only text is copied; not style, structure, or replaced content. ''target-text()'' has one required argument: the url of the link. An optional second argument specifies exactly which content is fetched. There are four possible values: ''content'', ''before'', ''after'', ''first-letter''; these keywords are defined on 'string-set' above. The syntax is:
target-text( <url> [, [ content | before | after | first-letter ]]? )
To generate this text:
from this markup:See Chapter 3 ("A better way") on page 31 for an in-depth evaluation.

See this chapter for an in-depth evaluation. ...
A better way
this CSS code can be used:
h2 { counter-increment: chapter } a { content: "Chapter " target-counter(attr(href url), chapter) ' ("' target-text(attr(href url), content) '") on page ' target-counter(attr(href url), page);
When an element is turned into a footnote, certain things happen: the element is moved to the footnote area, a footnote call is left behind in its place, a footnote marker is displayed before the element, and the footnote counter is incremented.
A footnote is a note typically placed at the bottom of a page that comments on, or cites, a reference. References to footnotes are marked with a footnote call in the main text which corresponds to a footnote marker in the footnote area. The rendering of footnotes is complex. As far as possible, footnotes try to reuse other parts of CSS. However, due to the typographic traditions of footnotes, some new functionality is required.
In its simplest form, making a footnote is simple.

A sentence consists of words.Most often..
In this example, the text Most often.
will be placed in a
footnote. A note-call will be left behind in the main text and a
corresponding marker will be shown next to the footnote. Here is one
possible rendering:
A sentence consists of words.¹ ¹ Most often.
Footnotes make sense in paged media, but in continous media the information is better displayed inline. Here is an example of how to support both paged and contious media:

A sentence consists of words.Most often..
In contious media, the presentaion will be:
A sentence consists of words. (Most often.)
Consider this markup:

Sorry, we're closing for lunch.
The content of the "title" attribute can be turned into a footnote with this code:
span[title]::after { content: attr(title); float: footnote; }
An element with ''float: footnote'' (called a footnote element) is moved to the footnote area and a footnote-call pseudo-element is put in its original place.
span.footnote { float: footnote; }
Footnote elements are presented inside the footnote area, but they inherit through their normal place in the structure of the document.
For each new footnote element, the ''footnote'' counter is automatically incremented.
All elements with ''float: footnote'' are moved to the footnote area. The footnote area is described by an @footnote-rule inside the @page-rule. By default, the footnote area appears at the bottom of the page, but it can be positioned in other places.
These rules place the footnote area at the bottom of the page, spanning all columns of the outermost multicol element:
@page { @footnote { float: bottom; float-reference: page; } }
The code above is part of the default style sheet.
These rules place the footnote area at the bottom of the first column:
@page { @footnote { float: bottom; float-reference: column; } }
These rules place the footnote area at the bottom of the page. Also, the footnote area is split into three columns which the footnotes are flowed into:
@page { @footnote { float: bottom; float-reference: page; columns: 3; } }
This code places the footnote area at the bottom of the last column of the outermost multicol element:
@page { @footnote { float: bottom; float-defer-column: last; } }
The content of the footnote area is considered to come before other content which may compete for the same space on the same page.
@page { @footnote { float: bottom; float-reference: page; }} figure { float: bottom; column-span: all }
If figures and footnotes are on the same page, the footnotes will appear below the figures as they are floated to the bottom before the figures.
Potentially, every page has a footnote area. If there are no footnotes on the page, the footnote area will not take up any space. If there are footnotes on a page, the layout of the footnote area will be determined by the properties/values set on it, and by the footnote elements inside it.
These properties apply to the footnote area: 'float', 'float-reference', 'content', 'border', 'padding', 'margin', 'height', 'width', 'max-height', 'max-width', 'min-height', 'min-width', and the background properties.
This example uses some of the applicable properties on @footnote:
@footnote { margin-top: 0.5em; border-top: thin solid black; border-clip: 4em; padding-top: 0.5em; }
The result of this code is a footnote area separated from other content above it by margin, border and padding. Only 4em of the border is visible due to the 'border-clip' property, which is defined in CSS Backgrounds and Borders Module Level 4.
When an element is moved to the footnote area, a footnote-call is left behind. By default, User Agents must behave as if this code is part of the default style sheet:
::footnote-call { content: counter(footnote, super-decimal); }
The resulting note call is a super-script decimal number.
A ::footnote-marker pseudo-element is added to each footnote element, before the ::before pseudo-element (if any), and replacing the ::marker pseudo-element (if any). User agents must, by default, show the "footnote" counter in the footnote-marker.
User Agents may display footnote-calls and footnote-markers this way by default:
::footnote-call { content: counter(footnote, super-decimal); } ::footnote-marker { content: counter(footnote, super-decimal); }
Marker elements are discussed in more detail in the CSS Lists module [CSSLIST]. One suggested change to that module is to honor the value of 'list-style-position' on the ::footnote-marker pseudo-element itself rather than the corresponding list-item element. Further, one clarification to the horizontal placement of the marker is suggested: the margin box of the marker box is horizontally aligned with the start of the line box.
The "footnote" counter is automatically incremented each time a footnote is generated. That is, the "footnote" counter is incremented by one each time an element with ''float: footnote'' appears.
This code adds square brackets around footnote calls and
::footnote-call { content: " [" counter(footnote) "]"; }
The footnote counter can be reset with the 'counter-reset' property.
This code resets the "footnote" counter on a per-page page basis:
@page { counter-reset: footnote }
Footnotes can also be combined with other counters. In this example, a poem is shown with line numbers on the side. The "line" counter is also used in the footnoter marker.
@page { counter-reset: line } div.line { counter-increment: line } div.line:nth-of-type(2n+1)::after { content: leader(space) counter(line) } .footnote { float: footnote } .footnote::footnote-call { content: "" } .footnote::footnote-marker { content: counter(line) }
The formatted result could be:
Come, blue-eyed maid of heaven! - but thou, alas, 1 Didst never yet one mortal song inspire - Goddess of Wisdom! here thy temple was, 3 And is, despite of war and wasting fire, 1 From "Childe Harold's Pilgrimage" by Lord Byron 3 The use of uppercase "W" indicates great wisdom
Footnotes must appear as early as possible under the following constraints:
The page area and footnote area are predefined areas in CSS; all content is shown in the page area by default, and footnotes can be floated to the page area. This section describes a generic mechanism to create named areas, how to posistion named areas, and how to flow content into named areas.
@area
Named areas can be generated by the style sheet to provide space for sidenotes, figures and other content which is presented apart from the main flow. The @area
construct is used to create named areas, into which content can be flowed into with the 'flow' property.
Named areas are can be absolutely positioned, or positiond with the 'float' property. When absolutely positioned, measurements are relative to the page box.
In this example, a named area called sidenote is created.
@page { margin-left: 10em; @area sidenote { position: absolute; left: -8em; top: 0; width: 6em; height: auto } }
The left edge of the named area is 8em to the left of the left edge of the page box.
Areas with the same name are connected and content can flow from such area to the next, when necessary.
In this example, both left and right pages have a sidenote area:
@page :left { margin-left: 10em; @area sidenote { position: absolute; left: -8em; top: 0; width: 6em; height: auto } } @page :right { margin-right: 10em; @area sidenote { position: absolute; right: -8em; top: 0; width: 6em; height: auto } }
The baseline of the sidenotes are aligned with the baseline of their reference point.
To support having several identically named areas on the same page, a second level of @area blocks are used. Only two levels of @area are allowed. The outer @area must always have a name, and the inner @area must never have a name. The named areas are painted as if they appeared in the source file after the footnote area, and before any content.
@page { margin-left: 1cm 5cm; /* wide side margins */ @area sidenote { @area { position: absolute; left: -4cm; top: 0; bottom: 0; width: 3.5cm; } /* left */ @area { position: absolute; right: -4cm; top: 0; bottom: 0; width: 3.5cm; } /* right */ } }
The 'flow' property is introduced to flow content into a named area. A functional notation indicates a named area, alignment within the named area, and placement policy.
area(<ident> [, <alignment> [, <placement-policy> ]]);
Aligmment is one of:
An optional exclamation mark ('!') can be added to the above keywords to express that aligment is essential: if it cannot be honored, the ele,ment will not be shown.
This code moves  elements to the named area called "sidenote" on the same page as the reference point:
aside { flow: area(sidenote, same-page); }
In this example, images are flowed to right pages, where the "photos" area take up all available space:
@page :right { @area photos { float: top; float-reference: bleed-box; width: 1vw; height: 1vh; } } img { flow: area(photos) }
The result is a document where content in the normal flow is shown on left pages, and right pages hold images. The images are filled into the named area in sequential order.
@page { margin-left: 1cm 5cm; /* wide side margins */ @area sidenote { @area { position: absolute; left: -4cm; top: 0; bottom: 0; width: 3.5cm; } /* left */ @area { position: absolute; right: -4cm; top: 0; bottom: 0; width: 3.5cm; } /* right */ } } .sidenote { flow: area(sidenote, baseline) }
One possible rendering is:
........ ......... ........ ......... ........ ...2..... second ........ ......... sidenote ........ ......... first ....1... ......... sidenote ........ ......... ........ ....3.... third ........ ......... sidenote ........ .........
The digits mark the call points.
In this example there are two streams of footnotes, both using named areas. The first stream flowed into the "fn1" area, and the second is flowed into "fn2". The first stream is referenced by numbers, and the second by lower-alpha.
@page { @area fn1 { float: bottom; float-reference: page } @area fn2 { float: bottom; float-reference: page } } .fn1 { flow: area(fn1, same-page); counter-increment: fn1 } .fn1::call { content: "[" counter(fn1) "]" } .fn2::marker { content: "[" counter(fn1) "]" } .fn2 { flow: area(fn2,same-page); counter-increment: fn2 } .fn2::call { content: "[" counter(fn2, lower-alpha) "]" } .fn2::marker { content: "[" counter(fn2, lower-alpha) "]" }
In the formatted result, the named areas appear at the bottom of the page; fn1 is floated to the bottom first and therefore appears below fn2. A possible rendering could be:
[a] From "Childe Harold's Pilgrimage" by Lord Byron [3] The use of uppercase "W" indicates great wisdom
In this example there are two streams of footnotes. The first stream is floated to the predefined "footnote" area, and the second is flowed to a name area called "fn2". The first stream is referenced by line numbers, and the second by lower-alpha.
@page { counter-reset: line @area fn2 { float: bottom; float-reference: page; } } div.line { counter-increment: line } div.line:nth-of-type(2n+1)::after { content: leader(space) counter(line) } .footnote { float: footnote } .footnote::footnote-call { content: "[" counter(footnote, lower-alpha) "]" } .footnote::footnote-marker { content: "[" counter(footnote, lower-alpha) "]" } .fn2 { flow: area(fn2, same-page) } .fn2::call { content: "" } .fn2::marker { content: "[" counter(line) "]" }
In the formatted result, the footnote area appears below the named area.
Come, blue-eyed maid of heaven! - but thou, alas,[a] 1 Didst never yet one mortal song inspire - Goddess of Wisdom! here thy temple was, 3 And is, despite of war and wasting fire, [3] The use of uppercase "W" indicates great wisdom [a] From "Childe Harold's Pilgrimage" by Lord Byron
Consider this code:
.s1 { flow: area(sidenote, same-page) } .s2 { flow: area(sidenote, same-page) }
When there is one sidenote area, to the left of the first column, the rendering may look like:
┌─────┐......1..... ............ │ s1 │............ ............ └─────┘............ ............ ┌─────┐............ ............ │ s2 │............ ............ └─────┘............ ............ ............ ....2....... ............ ............ ............ ............
This example is similar to the previous example, except that there are two sidenote areas: left of the first column, and right of the second column. The sidenote elements are move to the closest sidenote area:
.s1 { flow: area(sidenote, same-page) .s2 { flow: area(sidenote, same-page)
┌─────┐......1..... ............┌─────┐ │ s1 │............ ............│ s2 │ └─────┘............ ............└─────┘ ............ ............ ............ ............ ............ ............ ............ ....2....... ............ ............ ............ ............
In this example, figures appear in the main flow, while captions are flowed to the closest sidenote areas (there are two: left of the first column, and right of the second column). The captions are aligned with the top of the figure element.
figcaption { flow: area(sidenote, top-edge) }

s1

s2

............ ............ ............ ............ ┌─────┐┌──────────┐ ............ │ s1 ││ fig1 │ ┌──────────┐┌─────┐ └─────┘│ │ │ fig2 ││ s2 │ │ │ │ │└─────┘ └──────────┘ │ │ ............ └──────────┘ ............ ............ ............ ............ ............ ............
In this example, the figure has an image that spans the width of the page and bleeds to the edges. The caption follows underneath, in the sidenote area. The intended rendering is:
┌──────────────────────┐ │ image │ │ │ │ │ └──────────────────────┘ ┌────────┐ ........... │caption │ ........... └────────┘ ........... ........... ...........
The style sheet define two name areas, one for the photograph and one for the sidenote. The "photo" named area is floated to the top, while the "sidenote" area is absolutely positioned. The two named areas overlap. Therefore, the order of the content is significant; the image is first flowed into the "photo" area. The position of the caption will be influcenced by the height of the image.
@page { margin: 7mm 7mm 7mm 40mm; @area photo { float: top; float-reference: bleed-box } @area sidenote { position: absolute; left: -40mm; top: 0; bottom: 0; width: 35mm; } } figure img { flow: area(photo, same-page); clear: page } figcaption { flow: area(sidenote, same-page) } ...

caption

In this example, photographs are shown on right pages while the corresponding captions are flowed to a sidenote area on left pages.
@page :right { margin-right: 10em; @area photos { position: absolute; top: 0; right: -10em; bottom: 0; left: 0; } } @page :left { margin-left: 10em; @area sidenote { position: absolute; right: -8em; top: 0; width: 6em; height: auto } } img { flow: area(photos) } caption { flow: area(sidenote) }
When there is one sidenote area, to the left of the first column, the rendering may look like:
┌─────┐ ......1..... ┌─────────────┐ │ s1 │ ............ │photo 1 │ └─────┘ ............ │ │ ┌─────┐ ............ └─────────────┘ │ s2 │ ............ ┌──────────┐ └─────┘ ............ │photo 2 │ .........2.. │ │ ............ └──────────┘ ............
This is fairly sketchy
An optional argument indicates a placement policy:
In this example, there are two named areas called "sidenote", one on the left side of the first column, and the other on the right side of the second column. Three reference points are marked with 1, 2, and 3. Exact alignment along the baseline is possible for all three notes.
........ ......... ........ ......... ........ ...2..... second ........ ......... sidenote ........ ......... first ....1... ......... sidenote ........ ......... ........ ....3.... third ........ ......... sidenote ........ .........
The code used to achieve this is:
.sidenote { flow: area(sidenote, baseline) }
This example is similar to the previous one, except for the placement of the third reference point: it appears much closer to the second reference point. As a result, the second sidenote pushes down the third sidenote, which is no longer exactly aligned along the baseline.
........ ......... ........ ......... ........ ...2..... second ........ .....3... sidenote ........ ......... third first ....1... ......... sidenote sidenote ........ ......... ........ ......... ........ ......... ........ .........
This example is similar to the previous one, except that 'baseline!' is used:
.sidenote { flow: area(sidenote, baseline!) }
As a result, the third sidnote (which cannot be granted its requested placement) is not shown:
........ ......... ........ ......... ........ ...2..... second ........ .....3... sidenote ........ ......... first ....1... ......... sidenote ........ ......... ........ ......... ........ ......... ........ .........
First, move an element to a named area:
aside { flow: area(sidenote, same-page) }
Then, make the element stick so that it is shown on succeeding pages:
h1.copy { flow: area(sidenote, same-page, stick) }
aside { flow: area(sidenote, same-page, erase) }
In this example, the h1 element is copied into a running header which is defined with @area. The copied element is restyled. It erases the running header when it enters, and is set to stick (until eased by another element):
@page :left { @area running-header { position: absolute; top: -2cm; left: 0; width: 3.5cm; height: 1cm @inside h1 { font: 12pt sans-serif; text-align: right; } } } @page :right { @area running-header { position: absolute; top: -2cm; right: 0; width: 3.5cm; height: 1cm @inside h1 { font: 12pt sans-serif; text-align: right; } } } h1 { flow: area(running-header, same-page, stick) }
In this example, the named area called "running header" is placed in the center top of the page. It is filled with three elements, one being the copy
@page { @area running-header { position: absolute; top: -2cm; left: 0; right: 0; height: 1cm; text-align: center; @inside h1 { font: 12pt sans-serif; display: inline; }}} #pagecounter { flow: area(running-header, fill, stick); content: counter(page); } #ornament { flow: area(running-header, fill, stick); color: red; content: "\2747" /* snow crystal */} h1 { flow: area(running-header, fill, copy stick); font: 12pt serif }
Erin Hildebrand

::call
Elements that are floated to named areas can add a "call", similar to a footnote-call, at the place where they were floated from.
.sidenote { flow: area(sidenote, same-page); counter-increment: sn; } .sidenote::call { content: counter(sn, lower-alpha); font-size: 0.6em; vertical-align: top; }
Margin boxes can be considered a special type of named areas. Unlike names areas, margin boxes:
The 'margin()' function moves elements to margin areas:
target-pull()
To support legacy browsers, it is often better to make a link to the note rather than including the text inline. This example shows how to fetch the content of a note and place it in a footnote.
 ...
A sentence consists of words [3]. ...
[3] Most often.
When shown in a legacy browser, the content of the element will be shown as a clickable link to an endnote. When printed according to this specification, there will be a footnote:
A sentence consists of words¹. ¹ Most often.
When footnotes are long or complex, it may be impractical to keep their content at the point of reference. Instead, the content of the footnote may be stored at some other point in the source file. This example shows how to fetch the content of a note and place it in a footnote.
 ...
A sentence consists of words. ...
Most often, a sentence consists of words. However, some sentences also have numbers. And punctuation, don't forget punctuation.

Some document formats have the capability to represent bookmarks into the document. These bookmarks can e.g. be used to show an outline or an index of the document. Bookmarks are typically shown outside the document itself, often in a tree-structured and clickable table of contents. To generate bookmarks, these properties are defined: 'bookmark-level', 'bookmark-label', and 'bookmark-state'.
| Name: | bookmark-level |
| Value: | none | <integer> |
| Initial: | none |
| Applies to: | all elements |
| Inherited: | no |
| Percentages: | N/A |
| Media: | all |
| Computed value: | specified value |
This property describes what level a certain bookmark has in a hierarchical bookmark structure. The values are:
| Name: | bookmark-label |
| Value: | <content-list> | none |
| Initial: | none |
| Applies to: | all elements |
| Inherited: | no |
| Percentages: | N/A |
| Media: | all |
| Computed value: | specified value |
This property specifies the label of the bookmark, i.e., the text that will represent the bookmark in the bookmark structure. This properly will only be consulted if 'bookmark-level' is different from 'none'. The values are:
This code would generate a simple hierachical outline of a document that uses three heading levels:
h1 { bookmark-level: 1 } h2 { bookmark-level: 2 } h3 { bookmark-level: 3 } h1, h2, h3 { bookmark-label: content() }
This code will make bookmarks from links.
a[href] { bookmark-label: attr(href); bookmark-level: 1 } a[title] { bookmark-label: attr(title); bookmark-level: 1 }
If a title
attribute exisits, its value will be used as the bookmark label. Otherwisee, the URL is used.
This code specififies a string to be used as the bookmark label:
#frog { bookmark-label: "The green frog"; bookmark-level: 1 }
Consider this code:
h1 { bookmark-label: content(before) ": " content(); bookmark-level: 1 } h1:before { content: "Chapter" }
Africa

The resulting bookmark would be: "Chapter: Africa".
| Name: | bookmark-state |
| Value: | open | closed |
| Initial: | open |
| Applies to: | block-level elements |
| Inherited: | no |
| Percentages: | N/A |
| Media: | all |
| Computed value: | specified value |
A hierarchy of bookmarks may be shown in an open or closed state. The user will typically be able to toggle the state to navigate in the bookmarks. This property describes the initial state of a bookmark.
In this example, h1
and h2
elements are set to have an open initial bookmark stat, all other elements will be closed initially:
* { bookmark-state: closed } h1, h2 { bookmark-state: open }
A document consists of a linear sequence of pages. In simple documents, all pages have the same page area and marginalia. In more complex documents, pages may have different sizes, marginalia and orientation. Being able to style pages differently is therefore important.
In CSS2, first, left and right pages, as well as named pages, can be selected. This specification adds more advanced page selectors. Page selectors are similar to normal selectors in the sense that they query a data set and select parts of it. However, page selectors and normal selector are different in what they query (normal selectors query a document tree; page selectors query a sequence of pages) and what they select (normal selectors find structured elements, page selectors find formatted pages).
nth()
page pseudo-classThe nth()
construct is added to select a numbered page.
These are equivalent, they both select the first page of a document:
@page :first { background: lime } @page :nth(1) { background: lime }
The grammar of nth-child() pseudo-class can be used with nth()
:
In this example, pages in a document will cycle through pink, lime and white backgrounds:
@page :nth(3n) { background: pink } @page :nth(3n+1) { background: lime } @page :nth(3n+2) { background: white }
A page group is a sequence of pages with the same name. Being able to style the first page of page group different from the other pages in the page group is important. To support this, the named page and the :first
and :nth()
selector can be combined with the page name in page selectors:
In this example, various background colors will be set on different pages in the "chapter" page group:
@page chapter:first { background: pink } /* the first page */ @page chapter:nth(1) { background: pink } /* the first page */ @page chapter:nth(2) { background: lime } /* the second page */ @page chapter:nth(3n+2) { background: white } /* every third page */
A new page group is started when an element is set to a named page which is different from the preceding element, or different from the ancestor element.
In this example, the first article starts a new page group due to having a different named page than its ancestor. However, the second article continues in the same page group as the first, due to having the same named page. As a result, there will only be one page with a green background.
@page chapter:first { background: green } body { page: upright } article { page: chapter }
...

...

To enable page groups to be created when sibling elements use the same named page, the 'break-before' and 'break-after' properties are consulted. When a forced page break has been set between the two elements (either 'break-after: page' on the first element, or 'break-before: page' on the second element), the second element will create a new page group.
In this example, both articles start new page groups due to there being an explicit page break between them.
@page chapter:first { background: lime } body { page: upright } article { page: chapter; break-before: page }
...

...

Content is sometimes displayed or hidden based on their placement after formatting. This specification proposes the 'condition' property to express conditions that must be met in order for the element to be displayed; if the condition is not met, the effect will be as if 'display: none' had been set.
In this example, thematic breaks within the prose is normally indicated by a few blank lines. However, if the thematic break appears at a page break, it will be indicated by three asterisks.
.tb:before { content: "***"; condition: at-page-break; margin: 1em 0; text-align: center; } .tb:after { content: "\a\a\a"; condition: not-at-page-break }

| Name: | column-rule-clip |
| Value: | none | auto | [ <length> <length>? ] |
| Initial: | none |
| Applies to: | multicol elements |
| Inherited: | no |
| Percentages: | N/A |
| Media: | visual |
| Computed value: | as specified |
Values are:
Spanners split column rules, and each fragment is possibly clipped by this property.
This section sketches several possible solutions.
To select elements depending on which page they start on, these pseudo-classes can be used:
aside:left { background: red } aside:right { background: green } aside:first { background: blue } aside:nth(4n+1) { background: pink }
To select elements within a page, normal selectors can be combined with a page selector.
@page :first p { background: lime } @page :nth(1) .sidenote { background: lime } @page :nth(3n+1) p:first-line { background: lime } @page funky:nth(1) p { background: pink }
The syntax is:
@page \S+ <page-selector> \S+ <selector>
In an alternative longhand syntax, selectors are placed inside an @inside-block:
These are identical:
@page :left { @inside { p { text-align: left } } } @page :left p { text-align: left }
The longhand syntax also allows the styling of elements that appear inside page areas and margin boxes.
In this example, two sidenote areas are declared. Paragraphs inside those areas are given a differnet styling based on which side they are in.
@page { margin-left: 1cm 5cm; /* wide side margins */ @area sidenote { @area { position: absolute; left: -4cm; top: 0; bottom: 0; width: 3.5cm; /* left sidenote */ @inside p { text-align: right; /* paragraphs in left sidenotes are aligned right */ } } @area { position: absolute; right: -4cm; top: 0; bottom: 0; width: 3.5cm; /* right sidenote */ @inside p { text-align: left; /* paragraphs in right sidenotes are aligned left */ } } } }
@page :left { background: pink; /* declaration applies to pages */ @inside { p { text-align: left } /* declaration applies to elements on page */ } @top-center { background: orange; /* declaration applies to margin box */ @inside { p { text-align: left } /* declaration applies to elements in top-center margin boxes */ } } }
This section is not fully developed.
div.chapter:column(3) /* the 3rd column of the element */ div.chapter:column(2n) /* all even columns of the element */ div.chapter:column(3+) /* all columns but the 1st and 2nd */ div.chapter:column(2,2) /* second column on second page */ div.chapter:column(*,2) /* all columns on the second page */ div.chapter:column(1,*) /* the first column on all pages */
Text in adjacent columns often use the same baselines. This appears more pleasant to typographers, and reduces show-through, where a printed line shows through to the other side of the sheet. By aligning text to a grid of baselines, a baseline rhythm is established. Subheadings and figures may disturb the baseline rhythm, but subsequent text should find it again. The 'baseline-grid' property is introduced to define, engage and clear baseline grids, while the 'baseline-block-snap' property indicates how to align elements that do not align themselves with a baseline grid.
| Name: | baseline-grid |
| Value: | normal | none | new | root | page |
| Initial: | normal |
| Applies to: | block containers |
| Inherited: | no |
| Percentages: | N/A |
| Media: | visual |
| Computed value: | as specified |
This property is used to define, engage, and clear baseline grids. When a baseline grid is enganged, it will be in effect on content inside the block container (including child elements) until another baseline grid is engaged, or the baseline grid is cleared. When a baseline grid is in effect, content will be aligned with the baseline grid.
In this example, the article
element defines an enganges a baseline grid. Content inside the article will align with the baseline grid, except for headlines and figures.
article { baseline-grid: new } h1, h2, figure { baseline-grid: none }
One possible rendition is:
Notice how the body text aligns with the baseline grid (shown in orange for illustration purposes), while the heading, figure and figure caption do not. After the heading and figure, the main text starts again on the next available baseline.
In this example there are sidenotes in different scripts:
aside { font: 12pt serif; baseline-grid: new } [lang=ar] { font: 10pt 'Amiri', serif } ... ... ...
The  elements establish a baseline grid from the used font (font: 12pt serif
). Content inside the  elements, even in different scripts, fonts and sizes, align with the baseline grid established by the  elements.
The root baseling grid is automatically defined, but is not automatically engaged. In this example, the root baseline grid is enganged by the root element.
:root { baseline-grid: root }
The root baseline grid is handy when only a few elements want to opt-in to use a baseline grid.
p, li, blockquote { baseline-grid: root }
The 'page' baseline grid is automatically defined so that pages with different page margins still can align content to to the same baseline grid. In this example, the 'page' basedline grid is applied to all sidenotes:
aside { baseline-grid: page }
| Name: | baseline-block-snap |
| Value: | [before | after | center | auto] || [margin-box | border-box] |
| Initial: | auto |
| Applies to: | elements with 'baseline-grid: new' or 'baseline-grid: none' |
| Inherited: | no |
| Percentages: | N/A |
| Computed value: | specified value |
This property describes how to align content that is not aligned to a baseline grid. Values are:
In this example, elements that do not follow the baseline grid will snap upwards towards their older siblings.
h2, h2, figure { baseline-block-snap: before; }
It is sometimes convenient to replace one character or string with another without changing the source document. The ‘text-replace’ property offers a way to perform the replacement in the style sheet.
| Name: | text-replace |
| Value: | [<string> <string>]+ | none |
| Initial: | none |
| Applies to: | all elements |
| Inherited: | yes |
| Percentages: | N/A |
| Media: | visual |
| Computed value: | as specified value |
This property replaces all occurrences of a certain string with another string in the content of the element. The property accepts pairs of strings as value, in addition to the initial 'none' value. For each pair of strings, occurrences of the first string in the content will be replaced with the second string. If 'none' is specified, no replacements will occur.
In this example, three consecutive period characters are replaced with an ellipsis character and the apostrophe character is replaced with a quotation character:
body { text-replace: "..." "\2026" "'" "\2019" }
As a result, the string "It's the beginning...!" will be changed to "It’s the beginning…!".
In this example, a narrow no-break space is added before exclamation marks in French texts. This is known as "quart de cadratin" in French.
html:lang(fr) { text-replace "!" "\202F!" }
As a result, the string "Mais, oui!" is changed to "Mais, oui !".
In this example, a hair space is added before and after em-dashes.
body { text-replace: "—" "\200A—\200A" }
As a result, this string "no—not yet" is changed to "no — not yet".
Text replacements are applied serially; the first pair of strings is applied to the textual content of the element, then the second pair of strings is applied to the outcome etc.
The two rules below yield the same result. In the first rule all 'a' characters are converted to 'b'. Subsequently, all 'b' characters are converted to 'c'. In the second rule, all 'a' and 'b' characters are converted directly to 'c'.
body { text-replace: "a" "b" "b" "c" } body { text-replace: "a" "c" "b" "c" }
The first string in a pair must have at least one character, while the second may be empty.
In this example, all 'a' characters are removed.
body { text-replace: "a" "" }
If the first string of a pair is empty, or if an odd number of strings has been specified, the whole value is ignored and no text replacements are performed. Text replacements do not occur across element boundaries.
No text replacement will occur in this example:
h1 { text-replace: "foo" "bar" "" "foo" } /* ignore value */ h2 { text-replace: "foo" "bar" "foobar" } /* ignore value */ h3 { text-replace: "foobar" "barfoo" } /* accept value, but ... */
foobar

This property is evaluated after the content property, and before text-transform.
Microtypography is a range of methods for improving the appearance of text. Often, small adjustments in the space between letters and words can achieve a more even presentation with less need for hyphenation and fewer widows and orphans. This specification extends two existing CSS properties — 'letter-spacing' and 'word-spacing' — with minimum and maximum values to guide User Agents when laying out text.
The 'letter-spacing' and 'word-spacing' properties are extended to accept up to three values:
[ normal | <length> | <percentage>]{1,3}
Values are:
If one value is specified, it describes the optimum value, as well as the minimum and maximum values. If two values are specified, the first denotes the optimum and the minimum, and the second denotes the maximum. If three values are specified, they describe the optimum, minimum and maximum values.
p { letter-spacing: -0.04em 0 0.04em; word-spacing: -0.2em normal 0.2em; }
What are min/max values relative to? Are they relative to the normal position (like the opt values are), or to the opt position?
If we add percentage values, what are they relative to? Something other than em? CSS3 Text suggested advance measure/width for word-spacing, which probably means the space character?
letter-spacing: -5% 0% 5%; letter-spacing: -5% 0% 5%; word-spacing: 80% 100% 120%; word-spacing: 80% 100% 120%;
Would it be better to only use positive numbers? Like this:
p { letter-spacing: 0.04em 0 0.05em; word-spacing: 0.2em normal 0.2em; }
If so, one could often just use two values::
p { letter-spacing: 0 0.05em; word-spacing: normal 0.2em; }
In commonly used apps, pages are often laid out spatially so that users can nagivate from one page to another by moving up, down, right or left. To support this feature for web content, a new @-rule is proposed: @layout. The purpose of @layout is to describe how pages are laid out spatially relative to the current document.
Four new properties are allowed inside @layout: nav-up, nav-right, nav-bottom, nav-right.
The name of the properties inside @layout are borrowed from CSS3 Basic User Interface Module.
The properties accept these values:
<link rel=index href="../index.html"> <link rel=previous href=g3.html> <link rel=next href=g1.html> ... @layout { nav-up: go(index); nav-left: go(previous); nav-right: go(next); }
This functionality relies on semantics in HTML and CSS. Other languages may have other other ways to describe such semantics. One possible solution for other languages is "link[rel=index] { nav-up: attr(href) }"
@layout { nav-left: back; }
@layout { nav-up: url(..); nav-down: url(a1.html); }
@layout { nav-up: url-doc(..); nav-down: url-doc(a1.html); }
Combined with the @document-rule, navigation maps can be described:
@document url("http://example.com/foo") { @layout { nav-right: link-rel(next); } } @document url("http://example.com/bar") { @layout { nav-up: link-rel(next); } }
alternative name: @navigation, @neighborhood, @hood
To describe page shift effects, four new properties inside @layout are proposed: nav-up-shift, nav-right-shift, nav-down-shift, nav-left-shift. These properties take one of several keyword values:
The proposed keyword values are loosely described. Are there better ways to describe transitions?
@layout { nav-up-shift: pan; nav-down-shift: flip; }
@page { counter-reset: footnote; @footnote { counter-increment: footnote; float: bottom; column-span: all; height: auto; } } ::footnote-call { counter-increment: footnote; content: counter(footnote, super-decimal); } ::footnote-marker { content: counter(footnote, super-decimal); } h1 { bookmark-level: 1 } h2 { bookmark-level: 2 } h3 { bookmark-level: 3 } h4 { bookmark-level: 4 } h5 { bookmark-level: 5 } h6 { bookmark-level: 6 }
This document has been improved by Bert Bos, Michael Day, Melinda Grant, David Baron, Markus Mielke, Steve Zilles, Ian Hickson, Elika Etemad, Laurens Holst, Mike Bremford, Allan Sandfeld Jensen, Kelly Miller, Werner Donné, Tarquin (Mark) Wilton-Jones, Michel Fortin, Christian Roth, Brady Duga, Del Merritt, Ladd Van Tol, Tab Atkins Jr., Jacob Grundtvig Refstrup, James Elmore, Ian Tindale, Murakami Shinyu, Paul E. Merrell, Philip Taylor, Brad Kemper, Peter Linss, Daniel Glazman, Tantek Çelik, Florian Rivoal, Alex Mogilevsky, Simon Sapin, Cameron McCormack, Liam R E Quin, Peter Moulder, Morten Stenshorne, Rune Lillesveen, Lars Erik Bolstad, Anton Prowse, Michel Onoff, Dave Cramer.