터미널에서 명령의 혼합 일반 텍스트와 HTML 출력을 렌더링합니다.

터미널에서 명령의 혼합 일반 텍스트와 HTML 출력을 렌더링합니다.

나는 사용하고있다표준 편차Collins Cobuild 5다음과 같은 사전 출력 HTML입니다.

    # czxyl @ archlinux in ~/Dropbox [12:57:27] C:16
$ sdcv hello               
Found 7 items, similar to hello.
-->CMU American English spelling
-->hello

[hə'ləu]

-->dictd_www.dict.org_gcide
-->Hello

Hello \Hel*lo"\, interj. & n.
   An exclamation used as a greeting, to call attention, as an
   exclamation of surprise, or to encourage one. This variant of
   {Halloo} and {Holloo} has become the dominant form. In the
   United States, it is the most common greeting used in
   answering a telephone.
   [1913 Webster +PJC]


-->WordNet
-->hello

hello
     n : an expression of greeting; "every morning they exchanged
         polite hellos" [syn: {hullo}, {hi}, {howdy}, {how-do-you-do}]

-->Webster's Revised Unabridged Dictionary (1913)
-->Hello

Hello \Hel*lo"\, interj. & n.
   See {Halloo}.

-->牛津现代英汉双解词典
-->hello

= hallo.

-->Longman Dictionary of Contemporary English
-->hello

S1   interjection, n  also  hallo, hullo BrE  [C]   [Date: 1800-1900; Origin: hollo a shout to call attention  (16-19 centuries)]//
  1 used as a greeting when you see or meet someone:  --Hello, John! How are you?//  --Stanley, come and say hello to your nephew.//  --Well, hello there ! I haven't seen you for ages.//
  2 used when answering the telephone or starting a telephone conversation:  --Hello - may I speak to Anne?//
  3 used when calling to get someone's attention:  --Hello! Is there anybody home?//
  4 used when you think someone is not acting sensibly or has said something stupid:  --You didn't remember her birthday? Hello!//
  5  BrE used to show that you are surprised or confused by something:  --Hello! What's happened here?//
  6  say hello:  to have a quick conversation with someone//  --Promise you'll look in and say hello when you have time.//

-->Collins Cobuild 5
-->golden hello

<b>gold|en hel|lo</b> <b>(golden hellos)</b><br><FONT COLOR="#007000">[N-COUNT]</FONT><br>  A <b>golden hello</b> is a sum of money that a company offers to a person in order to persuade them to join the company. (BUSINESS)<br>  ● <font color="#004080"><i>Most people recognise the need to pay a golden hello to attract the best.</i></font><hr>

나는 보기를 희망한다:

여기에 이미지 설명을 입력하세요.

편집하다:

출력에는 코드( 출력 제공 , 다른 코드 제공) plain text가 포함되어 있기 때문에 세그먼트 만 렌더링하고 싶습니다 . 내 솔루션은 로컬 마크다운(로컬 파일 인 경우 함께 압착됨 )으로 리디렉션한 다음 렌더링을 사용하는 것 입니다 . 코드는 내 답변에 있습니다 .htmlCollins Cobuild 5htmlplain texthtmlstdouthtmlplain textspandocmarkdownhtmlelink -dump local-htmlstdout

답변1

다음과 같은 텍스트 모드 브라우저를 사용하십시오.w3m또는살쾡이. HTML이 아닌 접두사를 제거하고 브라우저에 이것이 HTML이라고 알려줍니다(lynx는 이를 가정하지만 w3m은 그렇지 않습니다. 왜냐하면 이것은 완전한 문서가 아니라 HTML 단편이기 때문입니다). 대화형 인터페이스를 표시하는 대신 화면에 덤프하도록 브라우저에 지시합니다.

$ /usr/bin/sdcv counterpart | awk '/^</ {p=1} p' | w3m -T text/html -dump
◆ counter|part /k'aʊntə^rpɑː^rt/ (counterparts)
[N-COUNT] with supp, usu poss N
Someone's or something's counterpart is another person or thing that has a
similar function or position in a different place.
● The Foreign Secretary telephoned his Italian counterpart to protest.
$ /usr/bin/sdcv counterpart | awk '/^</ {p=1} p' | lynx -stdin -dump
   ◆ counter|part /k'aʊntə^rpɑː^rt/ (counterparts)
   [N-COUNT] with supp, usu poss N
   Someone's or something's counterpart is another person or thing that
   has a similar function or position in a different place.
   ● The Foreign Secretary telephoned his Italian counterpart to protest.
     __________________________________________________________________

답변2

pandoc나는 and를 사용하여 문제를 해결했습니다 elinks. 출력(stdout)을 마크다운 파일로 저장한 다음, pandocrender md를 html 파일에 사용하고, elink마지막으로 -dump를 사용하여 로컬 html 파일을 렌더링합니다. 아래는 내 스크립트입니다.


#tt.sh
/usr/bin/sdcv $1 > /home/czxyl/Documents/firstlove.md
pandoc /home/czxyl/Documents/firstlove.md -o /home/czxyl/Documents/firstlove.html
elinks -dump /home/czxyl/Documents/firstlove.html
rm /home/czxyl/Documents/firstlove.html /home/czxyl/Documents/firstlove.md

alias def='. tt.sh'


# czxyl @ archlinux in ~ [0:22:34] 
$ def hello
   Found 7 items, similar to hello. –>CMU American English spelling –>hello

   [hə’ləu]

   –>dictd_www.dict.org_gcide –>Hello

   Hello lo“, interj. & n. An exclamation used as a greeting, to call
   attention, as an exclamation of surprise, or to encourage one. This
   variant of {Halloo} and {Holloo} has become the dominant form. In the
   United States, it is the most common greeting used in answering a
   telephone. [1913 Webster +PJC]

   –>WordNet –>hello

   hello n : an expression of greeting; “every morning they exchanged polite
   hellos” [syn: {hullo}, {hi}, {howdy}, {how-do-you-do}]

   –>Webster’s Revised Unabridged Dictionary (1913) –>Hello

   Hello lo“, interj. & n. See {Halloo}.

   –>牛津现代英汉双解词典 –>hello

   = hallo.

   –>Longman Dictionary of Contemporary English –>hello

   S1 interjection, n also hallo, hullo BrE [C] [Date: 1800-1900; Origin:
   hollo a shout to call attention (16-19 centuries)]// 1 used as a greeting
   when you see or meet someone: –Hello, John! How are you?// –Stanley, come
   and say hello to your nephew.// –Well, hello there ! I haven’t seen you
   for ages.// 2 used when answering the telephone or starting a telephone
   conversation: –Hello - may I speak to Anne?// 3 used when calling to get
   someone’s attention: –Hello! Is there anybody home?// 4 used when you
   think someone is not acting sensibly or has said something stupid: –You
   didn’t remember her birthday? Hello!// 5 BrE used to show that you are
   surprised or confused by something: –Hello! What’s happened here?// 6 say
   hello: to have a quick conversation with someone// –Promise you’ll look in
   and say hello when you have time.//

   –>Collins Cobuild 5 –>golden hello

   gold|en hel|lo (golden hellos)
   [N-COUNT]
   A golden hello is a sum of money that a company offers to a person in
   order to persuade them to join the company. (BUSINESS)
   ● Most people recognise the need to pay a golden hello to attract the
   best.

   ══════════════════════════════════════════════════════════════════════════

# czxyl @ archlinux in ~ [0:22:40] 
$ 

관련 정보