digraphs: .vim option to give ex commands of shiar proposals
authorMischa POSLAWSKY <perl@shiar.org>
Fri, 10 Oct 2008 00:54:38 +0000 (00:54 +0000)
committerMischa POSLAWSKY <perl@shiar.org>
Fri, 10 Oct 2008 01:27:23 +0000 (01:27 +0000)
Give a plain text with :digr commands to attain the unofficial digraphs
at digraphs.vim.plp.

.htaccess
digraphs.css
digraphs.plp
digraphs.vim.plp [new file with mode: 0644]
shiar.inc.txt

index f322d756e81f3e949d030d0a4ae6f3b5b8b96fb6..24ee14d3f0d0ef874a4838edfa1de4985d6a42ab 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -3,6 +3,9 @@ DirectoryIndex index.plp
 RewriteEngine  on
 RewriteBase    /
 
 RewriteEngine  on
 RewriteBase    /
 
+# serve vim commands when requesting /digraphs.ex as well
+RewriteRule    ^(digraphs)\.ex(/.*)?$ $1.vim$2
+
 # add .plp if a file exists with .plp appended (topdir only)
 RewriteCond    %{REQUEST_FILENAME}.plp  -f
 RewriteRule    ^/*([^/]+)(.*)           $1.plp$2
 # add .plp if a file exists with .plp appended (topdir only)
 RewriteCond    %{REQUEST_FILENAME}.plp  -f
 RewriteRule    ^/*([^/]+)(.*)           $1.plp$2
index 9e037a90b6880ac36277a30d065a795b089d08ea..22c2d6f6aff5bf235314d21f7fba718d0661b9c7 100644 (file)
@@ -79,7 +79,7 @@ td.X  {background: #FFF} /* unidentified */
 td.Xr {background: #EEE} /* reverse */
 td.Xa {color: #0A0} /* ascii */
 td.Xl {color: #070} /* latin1 */
 td.Xr {background: #EEE} /* reverse */
 td.Xa {color: #0A0} /* ascii */
 td.Xl {color: #070} /* latin1 */
-td.Xz {color: #D00} /* proposed */
+  .Xz {color: #D00} /* proposed */
 
 td.Lm, td.Mc, td.Me, td.Zl, td.Zp, td.Cs {background: #F00} /* unstyled */
 
 
 td.Lm, td.Mc, td.Me, td.Zl, td.Zp, td.Cs {background: #F00} /* unstyled */
 
index 81944b2e50c63d8186f81c3abbc8bb734b933c0d..068961dd3289bb01771c7d4058dcd8a165481731 100644 (file)
@@ -24,6 +24,9 @@ $header{content_type} = 'text/html; charset=utf-8';
 <p>i^k in <a href="/">Vim</a>.
 Also see <a href="/unicode">common digraphs</a>.</p>
 
 <p>i^k in <a href="/">Vim</a>.
 Also see <a href="/unicode">common digraphs</a>.</p>
 
+<p style="font-size:72%">Unofficial <span class="Xz">proposals</span>
+are available as <a href="/digraphs.vim">ex commands</a>.</p>
+
 <:
 my $di = do 'digraphs.inc.pl';
 
 <:
 my $di = do 'digraphs.inc.pl';
 
diff --git a/digraphs.vim.plp b/digraphs.vim.plp
new file mode 100644 (file)
index 0000000..d21a5f6
--- /dev/null
@@ -0,0 +1,28 @@
+<:
+use strict;
+use warnings;
+use open IO => ':utf8';
+
+our $VERSION = '1.0';
+
+$header{content_type} = 'text/plain; charset=us-ascii';
+print '" vim digraph proposals <http://vi.shiar.net/digraphs>', "\n";
+PLP_END { print "\n" };
+
+open my $include, '<', 'shiar.inc.txt' or do {
+       print qq{\n" $_} for '>>> SERVER ERROR <<<', "($!; try again later)";
+       warn $!;  # log it as well
+       exit;
+};
+
+my $init = 1;
+for (readline $include) {
+       m{^([!"%'-Z_a-z]{2}) (.)} or next;
+       print "\n:digr" if $init;
+       printf ' %s %d', $1, ord $2;
+}
+continue {
+       # repeat header for next entry if line was empty
+       $init = !m{\S} unless m{^#};
+}
+
index fb4803c70608bfd326df440ca753f0975de3d184..258d40be51e26ce6159365dc97d38455780255a0 100644 (file)
@@ -1,6 +1,5 @@
 # vim
 =e €
 # vim
 =e €
-
 # zsh
 Eu €
 
 # zsh
 Eu €