From 2b50e1778b164e641c03c2e77176b6f47ca1e278 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 18 Mar 2023 15:47:05 +0900 Subject: refactor: add RawHTML type to represent text node not being escaped --- .../ruby-detect-running-implementation/index.html | 4 ++-- .../ruby-then-keyword-and-case-in/index.html | 12 +++++------ .../rust-where-are-primitive-types-from/index.html | 8 ++++---- .../index.html | 2 +- .../vim-swap-order-of-selected-lines/index.html | 24 +++++++++++----------- 5 files changed, 25 insertions(+), 25 deletions(-) (limited to 'public/posts/2021-10-02') diff --git a/public/posts/2021-10-02/ruby-detect-running-implementation/index.html b/public/posts/2021-10-02/ruby-detect-running-implementation/index.html index 03bae40..4d17e71 100644 --- a/public/posts/2021-10-02/ruby-detect-running-implementation/index.html +++ b/public/posts/2021-10-02/ruby-detect-running-implementation/index.html @@ -75,10 +75,10 @@ 上記ページの例から引用する:

-
$ ruby-1.9.1 -ve 'p RUBY_ENGINE'
+          
$ ruby-1.9.1 -ve 'p RUBY_ENGINE'
 ruby 1.9.1p0 (2009-03-04 revision 22762) [x86_64-linux]
 "ruby"
-$ jruby -ve 'p RUBY_ENGINE'
+$ jruby -ve 'p RUBY_ENGINE'
 jruby 1.2.0 (ruby 1.8.6 patchlevel 287) (2009-03-16 rev 9419) [i386-java]
 "jruby"
diff --git a/public/posts/2021-10-02/ruby-then-keyword-and-case-in/index.html b/public/posts/2021-10-02/ruby-then-keyword-and-case-in/index.html index 25fb3bb..c027417 100644 --- a/public/posts/2021-10-02/ruby-then-keyword-and-case-in/index.html +++ b/public/posts/2021-10-02/ruby-then-keyword-and-case-in/index.html @@ -119,11 +119,11 @@ a 次のような構文エラーが出力される。

-
20:1: syntax error, unexpected local variable or method, expecting `then' or ';' or '\n'
-if true puts 'Hello, World!' end
+            
20:1: syntax error, unexpected local variable or method, expecting `then' or ';' or '\n'
+if true puts 'Hello, World!' end
         ^~~~
-20:1: syntax error, unexpected `end', expecting end-of-input
-...f true puts 'Hello, World!' end
+20:1: syntax error, unexpected `end', expecting end-of-input +...f true puts 'Hello, World!' end

二つ目のメッセージは無視して一つ目を読むと、then;か改行が来るはずのところ変数だかメソッドだかが現れたことによりエラーとなっているようだ。 @@ -182,7 +182,7 @@ b https://github.com/ruby/ruby/blob/221ca0f8281d39f0dfdfe13b2448875384bbf735/parse.y#L3961-L3986

-
p_case_body : keyword_in
+            
p_case_body : keyword_in
   {
   SET_LEX_STATE(EXPR_BEG|EXPR_LABEL);
   p->command_start = FALSE;
@@ -213,7 +213,7 @@ b
               簡略版:
             

-
p_case_body : keyword_in p_top_expr then compstmt p_cases
+            
p_case_body : keyword_in p_top_expr then compstmt p_cases
 ;

diff --git a/public/posts/2021-10-02/rust-where-are-primitive-types-from/index.html b/public/posts/2021-10-02/rust-where-are-primitive-types-from/index.html index bc40aaa..0554341 100644 --- a/public/posts/2021-10-02/rust-where-are-primitive-types-from/index.html +++ b/public/posts/2021-10-02/rust-where-are-primitive-types-from/index.html @@ -119,20 +119,20 @@ rustcはセルフホストされている (=rustc自身が Rust で書かれている) ので、boolcharなどで適当に検索をかけてもノイズが多すぎて話にならない。 しかし、お誂え向きなことにi128/u128というコンパイラ自身が使うことがなさそうな型が存在するのでこれを使ってgit grepしてみる。

-
$ git grep "\bi128\b" | wc      # i128
+            
$ git grep "\bi128\b" | wc      # i128
 165    1069   15790
 
-$ git grep "\bu128\b" | wc      # u128
+$ git grep "\bu128\b" | wc      # u128
 293    2127   26667
 
-$ git grep "\bbool\b" | wc      # cf. bool の結果
+$ git grep "\bbool\b" | wc      # cf. bool の結果
 3563   23577  294659

165 程度であれば探すことができそうだ。今回は、クレート名を見ておおよその当たりをつけた。

-
$ git grep "\bi128\b"
+            
$ git grep "\bi128\b"
 ...
 rustc_resolve/src/lib.rs:        table.insert(sym::i128, Int(IntTy::I128));
 ...
diff --git a/public/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre/index.html b/public/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre/index.html index 0e1e296..d2da2e5 100644 --- a/public/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre/index.html +++ b/public/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre/index.html @@ -157,7 +157,7 @@ FileEncoding = 'EncodingChanged', ところで、上では取り上げなかったFileEncodingだが、これは:help FileEncodingにしっかりと書いてある。

-
                                                           *FileEncoding*
+              
                                                           *FileEncoding*
 FileEncoding                    Obsolete.  It still works and is equivalent
 to |EncodingChanged|.
diff --git a/public/posts/2021-10-02/vim-swap-order-of-selected-lines/index.html b/public/posts/2021-10-02/vim-swap-order-of-selected-lines/index.html index 8dbea05..22042a8 100644 --- a/public/posts/2021-10-02/vim-swap-order-of-selected-lines/index.html +++ b/public/posts/2021-10-02/vim-swap-order-of-selected-lines/index.html @@ -125,9 +125,9 @@ なお、:g/^/m0は全ての行を入れ替えるが、:N,Mg/^/mN-1とすることで N行目から M行目を処理範囲とするよう拡張できる。手でこれを入力するわけにはいかないので、次のようなコマンドを用意する。

-
command! -bar -range=%
+              
command! -bar -range=%
 \ Reverse
-\ <line1>,<line2>g/^/m<line1>-1
+\ <line1>,<line2>g/^/m<line1>-1

これは望みの動作をするが、実際に実行してみると全行がハイライトされてしまう。次節で詳細を述べる。 @@ -160,13 +160,13 @@ 前述した:Reverseコマンドの定義を少し変えて、次のようにする:

-
function! s:reverse_lines(from, to) abort
-  execute printf("%d,%dg/^/m%d", a:from, a:to, a:from - 1)
-  endfunction
+            
function! s:reverse_lines(from, to) abort
+  execute printf("%d,%dg/^/m%d", a:from, a:to, a:from - 1)
+  endfunction
 
-  command! -bar -range=%
+  command! -bar -range=%
   \ Reverse
-  \ call <SID>reverse_lines(<line1>, <line2>)
+ \ call <SID>reverse_lines(<line1>, <line2>)

実行しているコマンドが変わったわけではないが、関数呼び出しを経由するようにした。これだけで前述の問題が解決する。 @@ -217,9 +217,9 @@

-
command! -bar -range=%
+            
command! -bar -range=%
   \ Reverse
-  \ keeppatterns <line1>,<line2>g/^/m<line1>-1
+ \ keeppatterns <line1>,<line2>g/^/m<line1>-1

まさにこのための Exコマンド、:keeppatternsが存在する。:keeppatterns {command}のように使い、読んで字の如く、後ろに続く Exコマンドを「現在の検索パターンを保ったまま」実行する。はるかに分かりやすく意図を表現できる。 @@ -234,11 +234,11 @@

コピペ用再掲

-
" License: Public Domain
+            
" License: Public Domain
 
-  command! -bar -range=%
+  command! -bar -range=%
   \ Reverse
-  \ keeppatterns <line1>,<line2>g/^/m<line1>-1
+ \ keeppatterns <line1>,<line2>g/^/m<line1>-1
-- cgit v1.2.3-70-g09d2