Skip to content

Commit a7148af

Browse files
committed
Update the HTML document framework.
1 parent 46a4cdb commit a7148af

14 files changed

+283
-122
lines changed

Diff for: bower_components/cxx-html-doc-framework/.bower.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
"polymer": "Polymer/polymer#0.5.2",
1414
"core-ajax": "Polymer/core-ajax#0.5.2"
1515
},
16-
"version": "0.3.1",
17-
"_release": "0.3.1",
16+
"version": "0.3.2",
17+
"_release": "0.3.2",
1818
"_resolution": {
1919
"type": "version",
20-
"tag": "0.3.1",
21-
"commit": "355de1737c3e1ee7e941b1ccf7ab0a69d5f63dea"
20+
"tag": "0.3.2",
21+
"commit": "9604bb1ff78b2f33fbcbcb941ea0fbae2e65d943"
2222
},
2323
"_source": "git://github.com/cplusplus/html-doc-framework.git",
2424
"_target": "*",

Diff for: bower_components/cxx-html-doc-framework/base.css

+20-9
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,23 @@ limitations under the License.
1515

1616
@page {
1717
margin: 10%;
18-
@top-left { content: "© ISO/IEC"; font-size: 10pt; }
19-
@top-right { content: string(docnum); font-weight: bold; font-size: 10pt; }
20-
@bottom-left { content: string(current-section, last); font-size: 10pt; }
18+
}
19+
@page :left {
20+
@top-left { content: string(docname); font-weight: bold; font-size: 10pt; }
21+
@top-right { content: normal; }
22+
@bottom-left { content: counter(page); font-size: 10pt; }
23+
@bottom-right { content: "© ISO/IEC " string(pubyear) " — All rights reserved";
24+
font-size: 10pt; }
25+
}
26+
@page :right {
27+
@top-left { content: normal; }
28+
@top-right { content: string(docname); font-weight: bold; font-size: 10pt; }
29+
@bottom-left { content: "© ISO/IEC " string(pubyear) " — All rights reserved";
30+
font-size: 10pt; }
2131
@bottom-right { content: counter(page); font-size: 10pt; }
2232
}
2333
@page :first {
24-
/* @top-left is defined by base.js. */
34+
@top-left { content: normal; }
2535
@top-right { content: normal; }
2636
@bottom-left { content: normal; }
2737
@bottom-right { content: normal; }
@@ -48,22 +58,23 @@ body { margin: 0; }
4858
html, body {height: 100%}
4959
}
5060

51-
cxx-docnum { string-set: docnum content(); }
61+
* /deep/ .docname { string-set: docname content(); }
62+
* /deep/ .pubyear { string-set: pubyear content(); }
5263

53-
cxx-clause { page-break-before: always; }
64+
cxx-clause, cxx-foreword { page-break-before: always; }
5465
@media screen {
55-
cxx-clause, cxx-toc { margin-top: 3em; }
66+
cxx-clause, cxx-toc, cxx-foreword { margin-top: 3em; }
5667
}
5768

58-
cxx-clause::shadow header { font-size: 150%; }
69+
cxx-clause::shadow header, cxx-foreword::shadow h1 { font-size: 150%; }
5970
cxx-toc::shadow h1 { font-size: 150%; }
6071
cxx-clause cxx-section::shadow header { font-size: 117%; }
6172
cxx-clause cxx-section cxx-section::shadow header { font-size: 100%; }
6273

6374
[data-bookmark-label] { bookmark-label: attr(data-bookmark-label); }
6475
h1 { bookmark-level: 1; }
6576
cxx-toc::shadow h1 { bookmark-level: 2; }
66-
cxx-clause h1 { bookmark-level: 2; }
77+
cxx-clause h1, cxx-foreword h1 { bookmark-level: 2; }
6778
cxx-clause cxx-section h1 { bookmark-level: 3; }
6879
cxx-clause cxx-section cxx-section h1 { bookmark-level: 4; }
6980
/* The <h2> is a subtitle, which shouldn't get a PDF bookmark. */

Diff for: bower_components/cxx-html-doc-framework/base.js

-24
This file was deleted.

Diff for: bower_components/cxx-html-doc-framework/clause.html

+15-2
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,26 @@
2020
this.super();
2121
var toc = document.querySelector('cxx-toc');
2222
if (toc) {
23-
toc.clauses = document.querySelectorAll('cxx-clause');
23+
toc.updateClauses();
2424
}
2525
}
2626
Polymer('cxx-clause', {
27-
// Convenience function at the clause level, which gets called from <cxx-toc>.
27+
28+
// Convenience function at the clause level, which gets called
29+
// from <cxx-toc>. If the clause is explicitly numbered, then
30+
// this sets the clause_num to that value. Otherwise, the clause
31+
// number is set to the argument clause_num. This returns
32+
// 1 + the value set.
33+
//
34+
// Note that this will recursively set the section numbers for
35+
// this clause.
2836
set_clause_num: function(clause_num) {
37+
// If the author explicitly specified the clause number, don't
38+
// use a different number.
39+
if (this.number)
40+
clause_num = Number(this.number)
2941
this.update_sec_nums(clause_num);
42+
return clause_num + 1;
3043
},
3144

3245
domReady: updateTocClauses,

Diff for: bower_components/cxx-html-doc-framework/ednote.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
<polymer-element name="cxx-ednote" noscript>
1717
<template>
1818
<style>
19-
:host { display: block; }
20-
:host-context(body.cxx-pdts) { display: none; }
19+
:host { display: none; }
20+
:host-context(body.cxx-draft) { display: block; }
2121
aside { float: right; max-width: 40%;
2222
margin: 1ex;
2323
border: 1px dashed #888;
+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<!-- Copyright 2015 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+
This element is empty and auto-generates the necessary content.
18+
-->
19+
<polymer-element name="cxx-foreword">
20+
<template>
21+
<style>
22+
:host { display: block; min-height: 100%; }
23+
:host { page-break-before: always; page-break-after: always; min-height: 100vh; margin-bottom: 2em; }
24+
25+
:host-context(body.cxx-draft) :host { display: none; }
26+
</style>
27+
<section>
28+
<h1>Foreword</h1>
29+
30+
<p>
31+
ISO (the International Organization for Standardization) is a
32+
worldwide federation of national standards bodies (ISO member
33+
bodies). The work of preparing International Standards is
34+
normally carried out through ISO technical committees. Each
35+
member body interested in a subject for which a technical
36+
committee has been established has the right to be represented
37+
on that committee. International organizations, governmental
38+
and non-governmental, in liaison with ISO, also take part in
39+
the work. ISO collaborates closely with the International
40+
Electrotechnical Commission (IEC) on all matters of
41+
electrotechnical standardization.
42+
</p>
43+
<p>
44+
The procedures used to develop this document and those
45+
intended for its further maintenance are described in the
46+
ISO/IEC Directives, Part 1. In particular the different
47+
approval criteria needed for the different types of ISO
48+
documents should be noted. This document was drafted in
49+
accordance with the editorial rules of the ISO/IEC Directives,
50+
Part 2.
51+
<a href="http://www.iso.org/directives">www.iso.org/directives</a>
52+
</p>
53+
<p>
54+
Attention is drawn to the possibility that some of the
55+
elements of this document may be the subject of patent rights.
56+
ISO shall not be held responsible for identifying any or all
57+
such patent rights. Details of any patent rights identified
58+
during the development of the document will be in the
59+
Introduction and/or on the ISO list of patent declarations
60+
received.
61+
<a href="http://www.iso.org/patents">www.iso.org/patents</a>
62+
</p>
63+
<p>
64+
Any trade name used in this document is information given for
65+
the convenience of users and does not constitute an
66+
endorsement.
67+
</p>
68+
<p>
69+
For an explanation on the meaning of ISO specific terms and
70+
expressions related to conformity assessment, as well as
71+
information about ISO's adherence to the WTO principles in the
72+
Technical Barriers to Trade (TBT) see the following URL:
73+
<a href="http://www.iso.org/iso/home/standards_development/resources-for-technical-work/foreword.htm">Foreword - Supplementary information</a>
74+
</p>
75+
<p>
76+
The committee responsible for this document is ISO/IEC JTC1.
77+
</p>
78+
</section>
79+
</template>
80+
<script>
81+
Polymer({
82+
title: "Foreword",
83+
});
84+
</script>
85+
</polymer-element>

Diff for: bower_components/cxx-html-doc-framework/framework.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<link rel="import" href="ref.html"/>
2929
<link rel="import" href="foreign-index.html"/>
3030
<link rel="import" href="titlepage.html"/>
31+
<link rel="import" href="foreword.html"/>
3132
<script src="include.js"></script>
3233
<link rel="import" href="email.html"/>
3334
<link rel="import" href="ednote.html"/>
@@ -40,4 +41,3 @@
4041
<link rel="import" href="codeblock.html"/>
4142
<link rel="import" href="grammar.html"/>
4243
<link rel="import" href="weak-break.html"/>
43-
<script src="base.js"></script>

Diff for: bower_components/cxx-html-doc-framework/section.html

+7-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@
1414
-->
1515

1616
<!--
17-
Recognizes attributes 'id' and 'title', but marking these as attributes
17+
Sections auto-number themselves and their paragraphs. The chosen number can
18+
be overridden by setting the 'number' attribute. A paragraph can also be
19+
marked as a continuation of the previous paragraph (without its own number)
20+
by giving it a 'cont' class.
21+
22+
Also recognizes attributes 'id' and 'title', but marking these as attributes
1823
cause problems for the ShadowDOM polyfill.
1924
-->
20-
<polymer-element name="cxx-section" constructor="CxxSectionElement">
25+
<polymer-element name="cxx-section" constructor="CxxSectionElement" attributes="number">
2126
<template>
2227
<style>
2328
:host { display: block; }

Diff for: bower_components/cxx-html-doc-framework/section.js

+13-6
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ limitations under the License.
3030
// Assume there aren't any elements between cxx-section levels.
3131
for (var child = this.firstChild; child; child = child.nextSibling) {
3232
if (child instanceof CxxSectionElement) {
33-
child.update_sec_nums(this.sec_num + '.' + (child_index++));
33+
if (child.number)
34+
child_index = Number(child.number);
35+
child.update_sec_nums(this.sec_num + '.' + child_index);
36+
child_index++;
3437
}
3538
}
3639
},
@@ -58,19 +61,22 @@ limitations under the License.
5861
child = child.nextElementSibling) {
5962
if (child instanceof CxxSectionElement)
6063
return para_num;
61-
else if (child instanceof HTMLParagraphElement &&
62-
!child.classList.contains('cont'))
63-
this.numberParagraph(para_num++, child);
64+
else if (child instanceof HTMLParagraphElement && !child.classList.contains('cont'))
65+
para_num = this.numberParagraph(para_num, child);
6466
else if (child instanceof CxxFunctionElement) {
65-
this.numberParagraph(para_num++, child);
67+
para_num = this.numberParagraph(para_num, child);
6668
para_num = this.numberParagraphChildren(child, para_num);
6769
} else if (child instanceof CxxFunctionAttributeElement)
68-
this.numberParagraph(para_num++, child);
70+
para_num = this.numberParagraph(para_num, child);
6971
}
7072
return para_num;
7173
},
7274

7375
numberParagraph: function(number, element) {
76+
// If the paragraph is explicitly numbered, use that number.
77+
if (element.hasAttribute("number"))
78+
number = Number(element.getAttribute("number"))
79+
7480
var id = this.id + '.' + number;
7581
if (element.id) {
7682
console.warn('Paragraph already has id:', element);
@@ -81,6 +87,7 @@ limitations under the License.
8187
element.id = id;
8288
}
8389
element.setAttribute('para_num', number);
90+
return number + 1
8491
}
8592
})
8693
})();

0 commit comments

Comments
 (0)