Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit37c1c6d

Browse files
committed
Add the Foreword to the table of contents.
1 parent75207ee commit37c1c6d

File tree

6 files changed

+42
-11
lines changed

6 files changed

+42
-11
lines changed

‎base.css‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,20 @@ cxx-docnum { string-set: docnum content(); }
6262
*/deep/ .docname {string-set: docnamecontent(); }
6363
*/deep/ .pubyear {string-set: pubyearcontent(); }
6464

65-
cxx-clause {page-break-before: always; }
65+
cxx-clause,cxx-foreword {page-break-before: always; }
6666
@media screen {
67-
cxx-clause,cxx-toc {margin-top:3em; }
67+
cxx-clause,cxx-toc,cxx-foreword {margin-top:3em; }
6868
}
6969

70-
cxx-clause::shadowheader {font-size:150%; }
70+
cxx-clause::shadowheader,cxx-foreword::shadowh1 {font-size:150%; }
7171
cxx-toc::shadowh1 {font-size:150%; }
7272
cxx-clausecxx-section::shadowheader {font-size:117%; }
7373
cxx-clausecxx-sectioncxx-section::shadowheader {font-size:100%; }
7474

7575
[data-bookmark-label] {bookmark-label:attr(data-bookmark-label); }
7676
h1 {bookmark-level:1; }
7777
cxx-toc::shadowh1 {bookmark-level:2; }
78-
cxx-clauseh1 {bookmark-level:2; }
78+
cxx-clauseh1,cxx-forewordh1 {bookmark-level:2; }
7979
cxx-clausecxx-sectionh1 {bookmark-level:3; }
8080
cxx-clausecxx-sectioncxx-sectionh1 {bookmark-level:4; }
8181
/* The <h2> is a subtitle, which shouldn't get a PDF bookmark. */

‎clause.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
this.super();
2121
vartoc=document.querySelector('cxx-toc');
2222
if(toc){
23-
toc.clauses=document.querySelectorAll('cxx-clause');
23+
toc.updateClauses();
2424
}
2525
}
2626
Polymer('cxx-clause',{

‎foreword.html‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<!--
1717
This element is empty and auto-generates the necessary content.
1818
-->
19-
<polymer-elementname="cxx-foreword"noscript>
19+
<polymer-elementname="cxx-foreword">
2020
<template>
2121
<style>
2222
:host { display: block; min-height: 100%; }
@@ -77,4 +77,9 @@ <h1>Foreword</h1>
7777
</p>
7878
</section>
7979
</template>
80+
<script>
81+
Polymer({
82+
title:"Foreword",
83+
});
84+
</script>
8085
</polymer-element>

‎titlepage.js‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,20 @@ limitations under the License.
4848
}
4949
},
5050

51+
addISOSections:function(){
52+
if(this.stage!=='ts'){
53+
// Only include the ISO requirements in the
54+
// document sent for publication.
55+
return;
56+
}
57+
vartoc=document.querySelector('cxx-toc');
58+
if(toc){
59+
varforeword=document.createElement('cxx-foreword');
60+
foreword.id='foreword';
61+
document.body.insertBefore(foreword,toc.nextSibling);
62+
}
63+
},
64+
5165
domReady:function(){
5266
this.projectNumber=this.querySelector('cxx-project-number');
5367
this.docnum=this.querySelector('cxx-docnum');
@@ -77,6 +91,8 @@ limitations under the License.
7791
if(this.title){
7892
document.title=this.title+stage_suffix;
7993
}
94+
95+
this.addISOSections();
8096
this.completedDomReady=true;
8197
},
8298
})

‎toc.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ <h1>Contents</h1>
4040
<templateif="{{sections.length > 0}}">
4141
<ol>
4242
<templaterepeat="{{sections}}">
43-
<li><spanclass="marker">{{elem.sec_num}}</span><ahref="#{{elem.id}}">{{title.textContent}}</a><templatebind=""ref="hierarchy"
43+
<li><templateif="{{elem.sec_num}}"><spanclass="marker">{{elem.sec_num}}</span></template><ahref="#{{elem.id}}">{{title}}</a><templatebind=""ref="hierarchy"
4444
></template></li>
4545
</template>
4646
</ol>

‎toc.js‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,30 @@ limitations under the License.
3030
continue;
3131
sections.push(this.collectSections(child));
3232
}
33+
varh1=root.querySelector('h1');
3334
return{elem:root,
34-
title:root.querySelector('h1'),
35+
title:h1 ?h1.textContent :root.title,
3536
sections:sections};
3637
},
3738

39+
updateClauses:function(){
40+
this.clauses=document.querySelectorAll('cxx-foreword,cxx-clause');
41+
},
42+
3843
clausesChanged:function(){
39-
this.sections=this.clauses.array().map(function(clause,index){
40-
clause.set_clause_num(index+1);
44+
varindex=0;
45+
this.sections=this.clauses.array().map(function(clause){
46+
if(clause.set_clause_num){
47+
// Don't number things that can't accept numbers, indicated
48+
// by not having a set_clause_num method.
49+
clause.set_clause_num(++index);
50+
}
4151
returnthis.collectSections(clause);
4252
},this);
4353
},
4454

4555
domReady:function(){
46-
this.clauses=document.querySelectorAll('cxx-clause');
56+
this.updateClauses();
4757
}
4858
})
4959
})();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp