Skip to content

Commit 62c3e8e

Browse files
committed
gen docs
1 parent 20d0f1b commit 62c3e8e

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

build/generate-docs.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,16 @@ function convertPropertyToMarkdown(key: string, value: JsonObject, keyPrefix = '
225225
const isProjection = value.type === 'projection' && value.values && !Array.isArray(value.values);
226226
if (isProjection) {
227227
markdown += '\n\r';
228-
markdown += `Projections: ${value.values['projections'].map(val=>`\`${val}\``).join(', ')}. `;
229-
markdown += '\n\r';
230-
markdown += `Presets: ${value.values['presets'].map(val=>`\`${val}\``).join(', ')}. `;
228+
markdown += 'Projections:\n\r';
229+
230+
Object.keys(value.values['projections']).map((projection) =>{
231+
markdown += `- \`${projection}\`: ${value.values['projections'][projection].doc}\n\r`;
232+
})
231233
markdown += '\n\r';
234+
markdown += 'Presets:\n\r';
235+
Object.keys(value.values['presets']).map((projection) =>{
236+
markdown += `- \`${projection}\`: ${value.values['presets'][projection].doc}\n\r`;
237+
})
232238
}
233239

234240
const isEnum = value.type === 'enum' && value.values && !Array.isArray(value.values);

build/generate-style-spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ fs.writeFileSync('src/types.g.ts',
126126
127127
export type ColorSpecification = string;
128128
129-
export type ProjectionPresetT = ${projectionTypes.presets.map(p => `'${p}'`).join(' | ')};
130-
export type ProjectionPrimitiveT = ${projectionTypes.projections.map(p => `'${p}'`).join(' | ')};
129+
export type ProjectionPresetT = ${Object.keys(projectionTypes.presets).map(p => `'${p}'`).join(' | ')};
130+
export type ProjectionPrimitiveT = ${Object.keys(projectionTypes.projections).map(p => `'${p}'`).join(' | ')};
131131
export type ProjectionT = [ProjectionPrimitiveT, ProjectionPrimitiveT, number];
132132
export type ProjectionSpecification = ProjectionPresetT | ProjectionPrimitiveT | ProjectionT | PropertyValueSpecification<ProjectionT>
133133

src/reference/v8.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4602,13 +4602,19 @@
46024602
]
46034603
},
46044604
"values": {
4605-
"projections": [
4606-
"mercator",
4607-
"stereographic"
4608-
],
4609-
"presets": [
4610-
"globe"
4611-
]
4605+
"projections": {
4606+
"mercator": {
4607+
"doc": "Web Mercator projection."
4608+
},
4609+
"stereographic": {
4610+
"doc": "Stereographic projection."
4611+
}
4612+
},
4613+
"presets": {
4614+
"globe": {
4615+
"doc": "Globe projection with zoom transition from Stereographic projection to Web Mercator projection."
4616+
}
4617+
}
46124618
},
46134619
"property-type": "data-constant"
46144620
}

0 commit comments

Comments
 (0)