Skip to content

Commit 0997977

Browse files
authored
FIX ng g @scullyio/init:post: Special characters cause failure during render (#463)
* docs(schematics): mARKDOWN: update docs for markdown and blog * docs(scully): gettingStarted: update getting started with the last options and text from scully * fix(schematics): remove wrong characters in routes for mds
1 parent 9523df0 commit 0997977

4 files changed

Lines changed: 8 additions & 4 deletions

File tree

schematics/scully/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

schematics/scully/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@scullyio/init",
3-
"version": "0.0.22",
3+
"version": "0.0.24",
44
"description": "Add scully to your angular app",
55
"repository": {
66
"type": "GIT",

schematics/scully/src/add-post/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import {Rule, SchematicContext, SchematicsException, Tree} from '@angular-devkit
22
import {strings} from '@angular-devkit/core';
33

44
import {Schema} from './schema';
5-
import {yamlToJson, jsonToJaml} from '../utils/utils';
5+
import {yamlToJson, jsonToJaml, removeWrongCharacters} from '../utils/utils';
66

77
export default function(options: Schema): Rule {
88
return (host: Tree, context: SchematicContext) => {
99
const name = options.name;
1010
const nameDasherized = options.name ? strings.dasherize(options.name) : 'blog-X';
1111
const targetDasherized = options.target ? strings.dasherize(options.target) : 'blog';
12-
const filename = `./${targetDasherized}/${nameDasherized}.md`;
12+
const filename = `./${targetDasherized}/${removeWrongCharacters(nameDasherized)}.md`;
1313

1414
let metaData = {
1515
title: '',

schematics/scully/src/utils/utils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,7 @@ export const checkProjectExist = (host: Tree, projectName: string) => {
248248
}
249249
return false;
250250
};
251+
252+
export const removeWrongCharacters = (str: string) => {
253+
return str.replace(/\{|\}|\(|\)|\;/g, '');
254+
};

0 commit comments

Comments
 (0)