feat(aio): support unannotated JSON example files
This commit is contained in:
parent
1c08f1a6b2
commit
1282da1b14
|
@ -20,6 +20,7 @@ regionParserImpl.regionMatchers = {
|
|||
css: blockC,
|
||||
yaml: inlineHash,
|
||||
jade: inlineCOnly,
|
||||
json: inlineC,
|
||||
'json.annotated': inlineC
|
||||
};
|
||||
|
||||
|
@ -97,6 +98,9 @@ function regionParserImpl(contents, fileType) {
|
|||
// this line contained an annotation so let's filter it out
|
||||
return false;
|
||||
});
|
||||
if (!regionMap['']) {
|
||||
regionMap[''] = {lines};
|
||||
}
|
||||
return {
|
||||
contents: 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', () => {
|
||||
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', () => {
|
||||
|
|
Loading…
Reference in New Issue