Skip to content

Commit 728e60f

Browse files
committed
Apply to the Library Fundamentals TS Working Paper the Proposed Wording from N3916, "Polymorphic Memory Resources"
This includes a big update to the html-doc-framework to support the changes.
1 parent 19e598b commit 728e60f

23 files changed

+6451
-1037
lines changed

PooledResourcesImage.png

82.3 KB
Loading

bower_components/cxx-html-doc-framework/.bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
"dependencies": {
1313
"polymer-ajax": "Polymer/polymer-ajax#0.2.0"
1414
},
15-
"_release": "7a8c0684ad",
15+
"_release": "23c55aa6ee",
1616
"_resolution": {
1717
"type": "branch",
1818
"branch": "master",
19-
"commit": "7a8c0684ad9796ff5da2b83f89cdc8379dcb12fa"
19+
"commit": "23c55aa6eec38c9796de104237bbf809cad95080"
2020
},
2121
"_source": "git://github.com/cplusplus/html-doc-framework.git",
2222
"_target": "*",

bower_components/cxx-html-doc-framework/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ Contributor License Agreement at https://developers.google.com/open-source/cla/i
1919
Custom C++-specific elements
2020
----------------------------
2121

22+
Some of these elements define a `checkInvariants()` method, so you can run:
23+
24+
document.querySelectorAll('*').array().forEach(
25+
function(node){ if (node.checkInvariants) node.checkInvariants(); });
26+
27+
to see if you've gotten anything wrong.
28+
29+
### `<cxx-include href="other.html">`
30+
31+
This one isn't really C++-specific: it allows partitioning a main document
32+
into multiple pieces. `other.html`'s body will be copied in place of the
33+
`<cxx-include>` element.
34+
35+
2236
### `<cxx-clause>` and `<cxx-section>`
2337

2438
These automatically number clauses and sections, fill in

bower_components/cxx-html-doc-framework/clause.html

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,21 @@
1616
<polymer-element name="cxx-clause" extends="cxx-section">
1717
<script>
1818
(function() {
19-
var clause_num = 1;
19+
function updateTocClauses() {
20+
this.super();
21+
var toc = document.querySelector('cxx-toc');
22+
if (toc) {
23+
toc.clauses = document.querySelectorAll('cxx-clause');
24+
}
25+
}
2026
Polymer('cxx-clause', {
21-
attached: function() {
22-
this.super();
23-
var my_clause_num = clause_num++;
24-
25-
this.async(function() {
26-
// async() lets the descendant elements upgrade; after which we
27-
// need to traverse them to collect section numbers.
28-
this.update_sec_nums(my_clause_num);
29-
});
27+
// Convenience function at the clause level, which gets called from <cxx-toc>.
28+
set_clause_num: function(clause_num) {
29+
this.update_sec_nums(clause_num);
3030
},
31+
32+
attached: updateTocClauses,
33+
detached: updateTocClauses,
3134
});
3235
})();
3336
</script>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<!-- Copyright 2014 Google Inc. All rights reserved.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
-->
15+
16+
<!--
17+
Uses the HTML <figure> content model, but automatically adds a number to
18+
the <figcaption>.
19+
-->
20+
<polymer-element name="cxx-figure" constructor="CxxFigureElement">
21+
<template>
22+
<style>
23+
:host { margin-left: auto; margin-right: auto; }
24+
figcaption { white-space: nowrap; text-align: center; }
25+
/* @polyfill figcaption figcaption */
26+
::content figcaption { display: inline; }
27+
28+
</style>
29+
<figure>
30+
<figcaption>Figure {{figure_num}} — <wbr><content select="figcaption"></content></figcaption>
31+
<content></content>
32+
</figure>
33+
</template>
34+
<script>
35+
(function() {
36+
function renumberFigures() {
37+
document.querySelectorAll('cxx-figure').array().forEach(function(figure, index) {
38+
figure.figure_num = index + 1;
39+
});
40+
}
41+
Polymer('cxx-figure', {
42+
attached: renumberFigures,
43+
detached: renumberFigures,
44+
});
45+
})();
46+
</script>
47+
</polymer-element>

bower_components/cxx-html-doc-framework/framework.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@
2222
<link rel="import" href="section.html"/>
2323
<link rel="import" href="clause.html"/>
2424
<link rel="import" href="table.html"/>
25+
<link rel="import" href="figure.html"/>
2526
<link rel="import" href="definition-section.html"/>
2627
<link rel="import" href="toc.html"/>
2728
<link rel="import" href="ref.html"/>
2829
<link rel="import" href="foreign-index.html"/>
2930
<link rel="import" href="titlepage.html"/>
31+
<script src="include.js"></script>
3032
<link rel="import" href="email.html"/>
3133
<link rel="import" href="ednote.html"/>
3234
<link rel="import" href="note.html"/>

bower_components/cxx-html-doc-framework/function.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@
6262
});
6363
</script>
6464
</polymer-element>
65+
<polymer-element name="cxx-preconditions" extends="cxx-attribute">
66+
<!-- This extension was introduced by N3916. -->
67+
<script>
68+
Polymer('cxx-preconditions', {
69+
heading: 'Preconditions',
70+
});
71+
</script>
72+
</polymer-element>
6573
<polymer-element name="cxx-effects" extends="cxx-attribute">
6674
<script>
6775
Polymer('cxx-effects', {
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/* Copyright 2014 Google Inc. All rights reserved.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
*/
15+
16+
/* The <cxx-include href> element replaces itself with the contents at
17+
* 'href'. It doesn't use a shadow root so that the other document
18+
* acts exactly as part of the current document. */
19+
20+
(function() {
21+
"use strict";
22+
var includeProto = Object.create(HTMLElement.prototype);
23+
includeProto.attachedCallback = function() {
24+
this.link = document.createElement('link');
25+
this.link.setAttribute('rel', 'import');
26+
this.link.setAttribute('href', this.getAttribute('href'));
27+
this.link.onload = this.loaded.bind(this);
28+
this.link.onerror = function(e) {
29+
console.error(e);
30+
}
31+
document.head.appendChild(this.link);
32+
};
33+
includeProto.loaded = function(e) {
34+
var imported = this.link.import;
35+
this.link.parentNode.removeChild(this.link);
36+
var parent = this.parentNode;
37+
for (var elem = imported.body.firstChild; elem; elem = elem.nextSibling) {
38+
parent.insertBefore(elem.cloneNode(true), this);
39+
}
40+
parent.removeChild(this);
41+
};
42+
document.registerElement('cxx-include', {prototype: includeProto});
43+
})();

bower_components/cxx-html-doc-framework/publish.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,24 @@ limitations under the License.
6060
});
6161
}
6262

63+
function inlineImages(images) {
64+
Array.prototype.forEach.call(images,
65+
function(image) {
66+
if (image.naturalWidth == 0)
67+
console.error(image, "hasn't loaded yet.");
68+
var canvas = document.createElement('canvas');
69+
canvas.width = image.naturalWidth;
70+
canvas.height = image.naturalHeight;
71+
canvas.getContext('2d').drawImage(image, 0, 0, canvas.width, canvas.height);
72+
image.src = canvas.toDataURL();
73+
});
74+
}
75+
6376
function cloneStaticAndInline(doc) {
77+
// Inline the images on the source document instead of the copy
78+
// because the copy doesn't have time to load the images.
79+
inlineImages(doc.getElementsByTagName('img'));
80+
6481
var copy = doc.cloneNode(true);
6582
function removeAll(nodes) {
6683
forEach(nodes, function(node) {

bower_components/cxx-html-doc-framework/ref.html

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
limitations under the License.
1414
-->
1515

16+
<link rel="import" href="util/get-element-by-id.html"/>
17+
1618
<!--
1719
The 'to' attribute is the id of a <cxx-section> or <cxx-table> element (or subclass).
1820
@@ -27,13 +29,16 @@
2729

2830
<polymer-element name="cxx-ref" attributes="to insynopsis in">
2931
<template
32+
><cxx-get-element-by-id elemId="{{in}}" elem="{{inElem}}"></cxx-get-element-by-id
33+
><template if="{{!in}}"><cxx-get-element-by-id elemId="{{to}}" elem="{{toElem}}"></cxx-get-element-by-id></template
3034
><template id="target_num"
31-
><template if="{{in_elem.index}}">{{in_elem.name}} &#xa7;{{in_elem.index[to]}}</template
32-
><template if="{{!in}}"><a href="#{{to}}"
33-
><template if="{{to_elem.sec_num}}">{{to_elem.sec_num}}</template
34-
><template if="{{to_elem.table_num}}">Table {{to_elem.table_num}}</template></a></template
35+
><template if="{{inElem.index}}">{{inElem.name}} <span title="{{to}}">&#xa7;{{inElem.index[to]}}</span></template
36+
><template if="{{!in}}"><a title="{{to}}" href="#{{to}}"
37+
><template if="{{toElem.sec_num}}">{{toElem.sec_num}}</template
38+
><template if="{{toElem.table_num}}">Table {{toElem.table_num}}</template
39+
><template if="{{toElem.figure_num}}">Figure {{toElem.figure_num}}</template></a></template
3540
></template
36-
><template if="{{insynopsis}}">// <i><template bind="" ref="target_num"></template>, {{to_elem.title_element.textContent}}</i></template
41+
><template if="{{insynopsis}}">// <i><template bind="" ref="target_num"></template>, {{toElem.title_element.textContent}}</i></template
3742
><template if="{{!insynopsis}}"><template bind="" ref="target_num"></template></template
3843
></template>
3944
<script src="ref.js"></script>

0 commit comments

Comments
 (0)