diff options
| author | nsfisis <nsfisis@gmail.com> | 2023-03-18 15:47:05 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2023-03-18 15:47:05 +0900 |
| commit | 2b50e1778b164e641c03c2e77176b6f47ca1e278 (patch) | |
| tree | 3fa48f5c5c3c2b9d8753ce82d438aa2523856660 /public/posts/2021-10-02 | |
| parent | 4ce1f674055ac1dd1c4864f366aac212f5643248 (diff) | |
| download | blog.nsfisis.dev-2b50e1778b164e641c03c2e77176b6f47ca1e278.tar.gz blog.nsfisis.dev-2b50e1778b164e641c03c2e77176b6f47ca1e278.tar.zst blog.nsfisis.dev-2b50e1778b164e641c03c2e77176b6f47ca1e278.zip | |
refactor: add RawHTML type to represent text node not being escaped
Diffstat (limited to 'public/posts/2021-10-02')
5 files changed, 25 insertions, 25 deletions
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 @@ 上記ページの例から引用する: </p> - <pre class="highlight" language="shell-session" linenumbering="unnumbered"><code class="highlight">$ ruby-1.9.1 -ve 'p RUBY_ENGINE' + <pre class="highlight" language="shell-session" linenumbering="unnumbered"><code>$ 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"</code></pre> 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 次のような構文エラーが出力される。 </p> - <pre class="monospaced highlight"><code>20:1: syntax error, unexpected local variable or method, expecting `then' or ';' or '\n' -if true puts 'Hello, World!' end + <pre class="highlight monospaced"><code>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</code></pre> +20:1: syntax error, unexpected `end', expecting end-of-input +...f true puts 'Hello, World!' end</code></pre> <p> 二つ目のメッセージは無視して一つ目を読むと、<code>then</code>か<code>;</code>か改行が来るはずのところ変数だかメソッドだかが現れたことによりエラーとなっているようだ。 @@ -182,7 +182,7 @@ b <a href="https://github.com/ruby/ruby/blob/221ca0f8281d39f0dfdfe13b2448875384bbf735/parse.y#L3961-L3986">https://github.com/ruby/ruby/blob/221ca0f8281d39f0dfdfe13b2448875384bbf735/parse.y#L3961-L3986</a> </p> - <pre class="highlight" language="yacc" linenumbering="unnumbered"><code class="highlight">p_case_body : keyword_in + <pre class="highlight" language="yacc" linenumbering="unnumbered"><code>p_case_body : keyword_in { SET_LEX_STATE(EXPR_BEG|EXPR_LABEL); p->command_start = FALSE; @@ -213,7 +213,7 @@ b 簡略版: </p> - <pre class="highlight" language="yacc" linenumbering="unnumbered"><code class="highlight">p_case_body : keyword_in p_top_expr then compstmt p_cases + <pre class="highlight" language="yacc" linenumbering="unnumbered"><code>p_case_body : keyword_in p_top_expr then compstmt p_cases ;</code></pre> <p> 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 @@ <code>rustc</code>はセルフホストされている (=<code>rustc</code>自身が Rust で書かれている) ので、<code>bool</code>や<code>char</code>などで適当に検索をかけてもノイズが多すぎて話にならない。 しかし、お誂え向きなことに<code>i128</code>/<code>u128</code>というコンパイラ自身が使うことがなさそうな型が存在するのでこれを使って<code>git grep</code>してみる。 </p> - <pre class="monospaced highlight"><code>$ git grep "\bi128\b" | wc # i128 + <pre class="highlight monospaced"><code>$ 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</code></pre> <p> 165 程度であれば探すことができそうだ。今回は、クレート名を見ておおよその当たりをつけた。 </p> - <pre class="monospaced highlight"><code>$ git grep "\bi128\b" + <pre class="highlight monospaced"><code>$ git grep "\bi128\b" ... rustc_resolve/src/lib.rs: table.insert(sym::i128, Int(IntTy::I128)); ...</code></pre> 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 = <span class="hljs-string">'EncodingChanged'</span>, ところで、上では取り上げなかった<code>FileEncoding</code>だが、これは<code>:help FileEncoding</code>にしっかりと書いてある。 </p> - <pre class="monospaced highlight"><code> *FileEncoding* + <pre class="highlight monospaced"><code> *FileEncoding* FileEncoding Obsolete. It still works and is equivalent to |EncodingChanged|.</code></pre> </section> 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 @@ なお、<code>:g/^/m0</code>は全ての行を入れ替えるが、<code>:N,Mg/^/mN-1</code>とすることで N行目から M行目を処理範囲とするよう拡張できる。手でこれを入力するわけにはいかないので、次のようなコマンドを用意する。 </p> - <pre class="highlight" language="vim" linenumbering="unnumbered"><code class="highlight">command! -bar -range=% + <pre class="highlight" language="vim" linenumbering="unnumbered"><code class="highlight">command! -bar -<span class="hljs-built_in">range</span>=% \ Reverse -\ <line1>,<line2>g/^/m<line1>-1</code></pre> +\ <span class="hljs-symbol"><line1></span>,<span class="hljs-symbol"><line2></span>g/^/<span class="hljs-keyword">m</span><span class="hljs-symbol"><line1></span>-<span class="hljs-number">1</span></code></pre> <p> これは望みの動作をするが、実際に実行してみると全行がハイライトされてしまう。次節で詳細を述べる。 @@ -160,13 +160,13 @@ 前述した<code>:Reverse</code>コマンドの定義を少し変えて、次のようにする: </p> - <pre class="highlight" language="vim" linenumbering="unnumbered"><code class="highlight">function! s:reverse_lines(from, to) abort - execute printf("%d,%dg/^/m%d", a:from, a:to, a:from - 1) - endfunction + <pre class="highlight" language="vim" linenumbering="unnumbered"><code class="highlight"><span class="hljs-keyword">function!</span> <span class="hljs-title">s</span>:reverse_lines<span class="hljs-params">(from, to)</span> abort + <span class="hljs-keyword">execute</span> <span class="hljs-built_in">printf</span>(<span class="hljs-string">"%d,%dg/^/m%d"</span>, <span class="hljs-variable">a:from</span>, <span class="hljs-variable">a:to</span>, <span class="hljs-variable">a:from</span> - <span class="hljs-number">1</span>) + <span class="hljs-keyword">endfunction</span> - command! -bar -range=% + command! -bar -<span class="hljs-built_in">range</span>=% \ Reverse - \ call <SID>reverse_lines(<line1>, <line2>)</code></pre> + \ <span class="hljs-keyword">call</span> <span class="hljs-symbol"><SID></span>reverse_lines(<span class="hljs-symbol"><line1></span>, <span class="hljs-symbol"><line2></span>)</code></pre> <p> 実行しているコマンドが変わったわけではないが、関数呼び出しを経由するようにした。これだけで前述の問題が解決する。 @@ -217,9 +217,9 @@ </p> </blockquote> - <pre class="highlight" language="vim" linenumbering="unnumbered"><code class="highlight">command! -bar -range=% + <pre class="highlight" language="vim" linenumbering="unnumbered"><code class="highlight">command! -bar -<span class="hljs-built_in">range</span>=% \ Reverse - \ keeppatterns <line1>,<line2>g/^/m<line1>-1</code></pre> + \ keeppatterns <span class="hljs-symbol"><line1></span>,<span class="hljs-symbol"><line2></span>g/^/<span class="hljs-keyword">m</span><span class="hljs-symbol"><line1></span>-<span class="hljs-number">1</span></code></pre> <p> まさにこのための Exコマンド、<code>:keeppatterns</code>が存在する。<code>:keeppatterns {command}</code>のように使い、読んで字の如く、後ろに続く Exコマンドを「現在の検索パターンを保ったまま」実行する。はるかに分かりやすく意図を表現できる。 @@ -234,11 +234,11 @@ <section id="section--_コピペ用再掲"> <h2><a href="#section--_コピペ用再掲">コピペ用再掲</a></h2> - <pre class="highlight" language="vim" linenumbering="unnumbered"><code class="highlight">" License: Public Domain + <pre class="highlight" language="vim" linenumbering="unnumbered"><code class="highlight"><span class="hljs-comment">" License: Public Domain</span> - command! -bar -range=% + command! -bar -<span class="hljs-built_in">range</span>=% \ Reverse - \ keeppatterns <line1>,<line2>g/^/m<line1>-1</code></pre> + \ keeppatterns <span class="hljs-symbol"><line1></span>,<span class="hljs-symbol"><line2></span>g/^/<span class="hljs-keyword">m</span><span class="hljs-symbol"><line1></span>-<span class="hljs-number">1</span></code></pre> </section> </div> </article> |
