Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

texソースにおけるcaption_divのエラー #54

Closed
kmuto opened this issue Feb 25, 2021 · 2 comments
Closed

texソースにおけるcaption_divのエラー #54

kmuto opened this issue Feb 25, 2021 · 2 comments

Comments

@kmuto
Copy link
Owner

kmuto commented Feb 25, 2021

ソース

\section{テスト}

\begin{table}
  \caption{テスト}
  \label{tbl:2_phone}
  \begin{tabular}{|c||c|c|c|c|c|} \hline
      & a & i & u & e & o \\\hline\hline
  \end{tabular}
\end{table}

実行 (pandoc 2.11.4)

$ pandoc -t lua/review.lua --lua-filter lua/filters.lua genko/test.tex
Error running filter lua/filters.lua:
lua/filters.lua:105: attempt to get length of a nil value (field 'content')
stack traceback:
	filters.lua:105: in function <lua/filters.lua:100>

コード

local function caption_div(div)
  local class = div.classes[1]
  local caption = div.attributes.caption

  if ((#div.content == 1) and
      (#div.content[1].content == 1) and ←ここでcontent[1].contentを取ろうとして失敗する
      (div.content[1].content[1].tag == "Math") and
      (div.identifier)) then

div.content[1].content を呼ぶことがダメなので、 div.content[1].content ~= nil 判定だとダメだった。「.content」フィールドの存在有無を確認するにはどうしたらよいのだろう?

@kmuto
Copy link
Owner Author

kmuto commented Feb 25, 2021

      (div.content[1].content) and

でいいのか。

//{
//table[table1][テスト]{
@<dtp>{table align=center}	@<dtp>{table align=center}a	@<dtp>{table align=center}i	@<dtp>{table align=center}u	@<dtp>{table align=center}e	@<dtp>{table align=center}o
--------------
//}
//}

なのも直したいかな。

@kmuto
Copy link
Owner Author

kmuto commented Feb 25, 2021

review.luaのDivのところであえてreturn "//{\n としているのでいいのかこれで。

@kmuto kmuto mentioned this issue Feb 25, 2021
@kmuto kmuto closed this as completed in 8180381 Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant