feat(aio): support unannotated JSON example files
This commit is contained in:
parent
1c08f1a6b2
commit
1282da1b14
|
@ -20,6 +20,7 @@ regionParserImpl.regionMatchers = {
|
||||||
css: blockC,
|
css: blockC,
|
||||||
yaml: inlineHash,
|
yaml: inlineHash,
|
||||||
jade: inlineCOnly,
|
jade: inlineCOnly,
|
||||||
|
json: inlineC,
|
||||||
'json.annotated': inlineC
|
'json.annotated': inlineC
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -97,6 +98,9 @@ function regionParserImpl(contents, fileType) {
|
||||||
// this line contained an annotation so let's filter it out
|
// this line contained an annotation so let's filter it out
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
if (!regionMap['']) {
|
||||||
|
regionMap[''] = {lines};
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
contents: lines.join('\n'),
|
contents: lines.join('\n'),
|
||||||
regions: mapObject(regionMap, (regionName, region) => region.lines.join('\n'))
|
regions: mapObject(regionMap, (regionName, region) => region.lines.join('\n'))
|
||||||
|
|
|
@ -25,7 +25,7 @@ describe('regionParser service', () => {
|
||||||
|
|
||||||
it('should return just the contents if there is a region-matcher but no regions', () => {
|
it('should return just the contents if there is a region-matcher but no regions', () => {
|
||||||
const output = regionParser('some contents', 'test-type');
|
const output = regionParser('some contents', 'test-type');
|
||||||
expect(output).toEqual({contents: 'some contents', regions: {}});
|
expect(output).toEqual({contents: 'some contents', regions: { '': 'some contents' }});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should remove start region annotations from the contents', () => {
|
it('should remove start region annotations from the contents', () => {
|
||||||
|
|
Loading…
Reference in New Issue