2016-09-20 21:12:13 +02:00
|
|
|
import {Converter} from "./converter";
|
|
|
|
|
|
|
|
export class HTMLEntitiesEncoder implements Converter {
|
2017-04-15 18:51:22 +02:00
|
|
|
getDisplayname(): string {
|
|
|
|
return "Encode HTML entities";
|
|
|
|
}
|
2016-09-20 21:12:13 +02:00
|
|
|
|
2017-04-15 18:51:22 +02:00
|
|
|
getId(): string {
|
|
|
|
return "encodehtmlentities";
|
|
|
|
}
|
2016-09-20 21:12:13 +02:00
|
|
|
|
2017-04-15 18:51:22 +02:00
|
|
|
convert(input: string): string {
|
|
|
|
return input
|
|
|
|
.replace(/\&/g, "&")
|
|
|
|
.replace(/\</g, "<")
|
|
|
|
.replace(/\>/g, ">")
|
|
|
|
.replace(/\"/g, """);
|
|
|
|
}
|
2016-09-20 21:12:13 +02:00
|
|
|
}
|