{"action":"created","issue":{"url":"https://api.github.com/repos/simoncozens/sile/issues/304","repository_url":"https://api.github.com/repos/simoncozens/sile","labels_url":"https://api.github.com/repos/simoncozens/sile/issues/304/labels{/name}","comments_url":"https://api.github.com/repos/simoncozens/sile/issues/304/comments","events_url":"https://api.github.com/repos/simoncozens/sile/issues/304/events","html_url":"https://github.com/simoncozens/sile/pull/304","id":145366372,"number":304,"title":"Make relevant percentage lengths explicit and introduce more useful units","user":{"login":"alerque","id":173595,"avatar_url":"https://avatars.githubusercontent.com/u/173595?v=3","gravatar_id":"","url":"https://api.github.com/users/alerque","html_url":"https://github.com/alerque","followers_url":"https://api.github.com/users/alerque/followers","following_url":"https://api.github.com/users/alerque/following{/other_user}","gists_url":"https://api.github.com/users/alerque/gists{/gist_id}","starred_url":"https://api.github.com/users/alerque/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alerque/subscriptions","organizations_url":"https://api.github.com/users/alerque/orgs","repos_url":"https://api.github.com/users/alerque/repos","events_url":"https://api.github.com/users/alerque/events{/privacy}","received_events_url":"https://api.github.com/users/alerque/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-04-02T12:04:19Z","updated_at":"2016-05-31T14:04:36Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/simoncozens/sile/pulls/304","html_url":"https://github.com/simoncozens/sile/pull/304","diff_url":"https://github.com/simoncozens/sile/pull/304.diff","patch_url":"https://github.com/simoncozens/sile/pull/304.patch"},"body":"I've been struggling with some layouts that are highly dependent on the relative size of the page canvas (which comes in multiple sizes for the same content) and finally decided that the limiting factor was access to relative units. Scripting out to find sizes at every turn was cumbersome when I could just add new unit definitions, so I started doing that in my own libraries. I found #302 in the process of reviewing how units are handled.\r\n\r\nIt turns out that bug not  being caught is symptomatic of the exist `%` unit being entirely ambiguous. There were two completely separate parsers for it and two different calc methods depending on whether the context was frames or not. The not-frames version wasn't even being used anywhere and the code was  full of self-identified \"dirty hacks\" to disambiguate directions. After tying my brain in knots trying to figure out how to get `\\rule` that was based on the height of a document rather than the width, it finally dawned on me that the whole thing was bogus. Percentages shouldn't be ambiguous, they should be a percentage of something.\r\n\r\nThis:\r\n\r\n  - [x] Replaces the ambiguous `%` unit with`%pw` units for percentage of page width and `%ph` units for percentage of page height. You can now specify any length (frame size, rules, fonts, etc.) relative to either the hight or width of something else instead of being railroaded into one direction (previously the active axis for frames or horizontal only for other lengths).\r\n  - [x] Adds assorted other units (similar to [CSS viewport units](https://css-tricks.com/viewport-sized-typography/)) such as `%pmax` for whatever is larger of the page height and width, `%min`, a whole set for relative to the current frame rather than the page, etc.\r\n  - [x] Rips out the percentage calculator from the frames code and replaces it with the main dimensioned unit calculator. Dimensions in frame specs now work the same way as everywhere else.\r\n  - [x] Updates some of the existing code.\r\n\r\nTodo:\r\n\r\n  - [x] Add tests to show they actually work.\r\n  - [x] Document the new units and breaking change to previous syntax."},"comment":{"url":"https://api.github.com/repos/simoncozens/sile/issues/comments/222698584","html_url":"https://github.com/simoncozens/sile/pull/304#issuecomment-222698584","issue_url":"https://api.github.com/repos/simoncozens/sile/issues/304","id":222698584,"user":{"login":"alerque","id":173595,"avatar_url":"https://avatars.githubusercontent.com/u/173595?v=3","gravatar_id":"","url":"https://api.github.com/users/alerque","html_url":"https://github.com/alerque","followers_url":"https://api.github.com/users/alerque/followers","following_url":"https://api.github.com/users/alerque/following{/other_user}","gists_url":"https://api.github.com/users/alerque/gists{/gist_id}","starred_url":"https://api.github.com/users/alerque/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alerque/subscriptions","organizations_url":"https://api.github.com/users/alerque/orgs","repos_url":"https://api.github.com/users/alerque/repos","events_url":"https://api.github.com/users/alerque/events{/privacy}","received_events_url":"https://api.github.com/users/alerque/received_events","type":"User","site_admin":false},"created_at":"2016-05-31T14:04:36Z","updated_at":"2016-05-31T14:04:36Z","body":"And there are some docs to float this barge..."}}
{"actor":{"display_login":"alerque"}}