aboutsummaryrefslogtreecommitdiffhomepage
path: root/public/posts/2021-10-02
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2023-03-18 15:47:05 +0900
committernsfisis <nsfisis@gmail.com>2023-03-18 15:47:05 +0900
commit2b50e1778b164e641c03c2e77176b6f47ca1e278 (patch)
tree3fa48f5c5c3c2b9d8753ce82d438aa2523856660 /public/posts/2021-10-02
parent4ce1f674055ac1dd1c4864f366aac212f5643248 (diff)
downloadblog.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')
-rw-r--r--public/posts/2021-10-02/ruby-detect-running-implementation/index.html4
-rw-r--r--public/posts/2021-10-02/ruby-then-keyword-and-case-in/index.html12
-rw-r--r--public/posts/2021-10-02/rust-where-are-primitive-types-from/index.html8
-rw-r--r--public/posts/2021-10-02/vim-difference-between-autocmd-bufwrite-and-bufwritepre/index.html2
-rw-r--r--public/posts/2021-10-02/vim-swap-order-of-selected-lines/index.html24
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 &#x27;p RUBY_ENGINE&#x27;
+ <pre class="highlight" language="shell-session" linenumbering="unnumbered"><code>$ ruby-1.9.1 -ve &apos;p RUBY_ENGINE&apos;
ruby 1.9.1p0 (2009-03-04 revision 22762) [x86_64-linux]
&quot;ruby&quot;
-$ jruby -ve &#x27;p RUBY_ENGINE&#x27;
+$ jruby -ve &apos;p RUBY_ENGINE&apos;
jruby 1.2.0 (ruby 1.8.6 patchlevel 287) (2009-03-16 rev 9419) [i386-java]
&quot;jruby&quot;</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&apos; or &apos;;&apos; or &apos;\n&apos;
+if true puts &apos;Hello, World!&apos; 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&apos;, expecting end-of-input
+...f true puts &apos;Hello, World!&apos; 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-&gt;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 &quot;\bi128\b&quot; | wc # i128
165 1069 15790
-$ git grep "\bu128\b" | wc # u128
+$ git grep &quot;\bu128\b&quot; | wc # u128
293 2127 26667
-$ git grep "\bbool\b" | wc # cf. bool の結果
+$ git grep &quot;\bbool\b&quot; | 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 &quot;\bi128\b&quot;
...
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">&#x27;EncodingChanged&#x27;</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
-\ &lt;line1&gt;,&lt;line2&gt;g/^/m&lt;line1&gt;-1</code></pre>
+\ <span class="hljs-symbol">&lt;line1&gt;</span>,<span class="hljs-symbol">&lt;line2&gt;</span>g/^/<span class="hljs-keyword">m</span><span class="hljs-symbol">&lt;line1&gt;</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(&quot;%d,%dg/^/m%d&quot;, 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">&quot;%d,%dg/^/m%d&quot;</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 &lt;SID&gt;reverse_lines(&lt;line1&gt;, &lt;line2&gt;)</code></pre>
+ \ <span class="hljs-keyword">call</span> <span class="hljs-symbol">&lt;SID&gt;</span>reverse_lines(<span class="hljs-symbol">&lt;line1&gt;</span>, <span class="hljs-symbol">&lt;line2&gt;</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 &lt;line1&gt;,&lt;line2&gt;g/^/m&lt;line1&gt;-1</code></pre>
+ \ keeppatterns <span class="hljs-symbol">&lt;line1&gt;</span>,<span class="hljs-symbol">&lt;line2&gt;</span>g/^/<span class="hljs-keyword">m</span><span class="hljs-symbol">&lt;line1&gt;</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">&quot; License: Public Domain
+ <pre class="highlight" language="vim" linenumbering="unnumbered"><code class="highlight"><span class="hljs-comment">&quot; License: Public Domain</span>
- command! -bar -range=%
+ command! -bar -<span class="hljs-built_in">range</span>=%
\ Reverse
- \ keeppatterns &lt;line1&gt;,&lt;line2&gt;g/^/m&lt;line1&gt;-1</code></pre>
+ \ keeppatterns <span class="hljs-symbol">&lt;line1&gt;</span>,<span class="hljs-symbol">&lt;line2&gt;</span>g/^/<span class="hljs-keyword">m</span><span class="hljs-symbol">&lt;line1&gt;</span>-<span class="hljs-number">1</span></code></pre>
</section>
</div>
</article>