From e7cdeda4bc64fe54fe9a222b1857bc6679aea506 Mon Sep 17 00:00:00 2001 From: Hauke D Date: Fri, 7 Sep 2018 12:25:04 +0200 Subject: [PATCH] Added and used import_regex_tester.pl --- _misc/import_regex_tester.pl | 31 +++++++++++++++++++++++++++++++ regex.html | 19 ++++++++++--------- 2 files changed, 41 insertions(+), 9 deletions(-) create mode 100755 _misc/import_regex_tester.pl diff --git a/_misc/import_regex_tester.pl b/_misc/import_regex_tester.pl new file mode 100755 index 0000000..6b304e9 --- /dev/null +++ b/_misc/import_regex_tester.pl @@ -0,0 +1,31 @@ +#!/usr/bin/env perl +use warnings; +use strict; +use FindBin (); + +# A quick and dirty script for importing regex_tester.html to pages + +my $infn = "$FindBin::Bin/../../web/regex_tester.html"; +my $outfn = "$FindBin::Bin/../regex.html"; + +my $html = do { open my $ifh, '<:encoding(UTF-8)', $infn or die "$infn: $!"; local $/; <$ifh> }; + +my $msg = <<'ENDMSG'; +This is essentially a copy of +https://github.com/haukex/webperl/blob/master/web/regex_tester.html +with the following differences: +- webperl.js from CDN +- $RUN_CODE_IN_IFRAME enabled +- URL updated to https://github.com/haukex/webperl/blob/gh-pages/regex.html +(see import_regex_tester.pl) +ENDMSG + +( $html =~ s{ <(?script\s+src="webperl\.js"\s*> }{}xms )==1 or die; +( $html =~ s{ }{<$+{x}>}xms )==1 or die; +( $html =~ s{ ^ \s* our \s+ \$RUN_CODE_IN_IFRAME\s*=\s*\K0(?=\s*;\s*) }{1}xms )==1 or die; +( $html =~ s{ https?://github.com/haukex/webperl/blob/\Kmaster/web/regex_tester.html }{gh-pages/regex.html}xms )==1 or die; +( $html =~ s{ \#\#\#\#\#\s*-->\n\K }{\n\n}xms )==1 or die; + +open my $ofh, '>:encoding(UTF-8)', $outfn or die "$outfn: $!"; +print $ofh $html; +close $ofh; diff --git a/regex.html b/regex.html index b60e6a0..154163d 100644 --- a/regex.html +++ b/regex.html @@ -4,7 +4,7 @@ WebPerl Regex Tester - +##### --> @@ -43,7 +44,7 @@ body { div { font-family: Calibri, Ubuntu, "Droid Sans", Tahoma, Arial, Helvetica, sans-serif; } -pre,tt,textarea { +pre,kbd,var,code,samp,textarea { font-family: Consolas, "Ubuntu Mono", "Droid Sans Mono", "Lucida Console", "Courier New", Courier, monospace; } pre { @@ -110,7 +111,7 @@ textarea.samp_ta { + integrity="sha256-jL8SB7St5ou4+hb0frK0k6VCQXsWQ1wolDrdU7i4juc=" crossorigin="anonymous"> @@ -164,7 +165,7 @@ if ($RUN_CODE_IN_IFRAME) { # https://www.html5rocks.com/en/tutorials/security/sa