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

脚注の追加 #129

Closed
abap34 opened this issue May 25, 2024 · 6 comments · Fixed by #149
Closed

脚注の追加 #129

abap34 opened this issue May 25, 2024 · 6 comments · Fixed by #149
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers parser
Milestone

Comments

@abap34
Copy link
Owner

abap34 commented May 25, 2024

脚注の機能がないのであるとよさそう。

  1. 適当な構文で脚注の表示とidを振れるようにする (例: これは Aによる研究 [^a_research] により示された。)
  2. id に対応する脚注の文を書くと、末尾に生成される。例: [a_reserch]: example.com
  3. もとの文に連番が振られる。

構文は既存の仕様の調査が必要そう。

@abap34 abap34 added enhancement New feature or request good first issue Good for newcomers parser labels May 25, 2024
@abap34 abap34 added this to the Release v1.0 milestone May 25, 2024
@potato167
Copy link
Contributor

potato167 commented Jun 17, 2024

○○論文は 1 番で、☆☆本は 2 番。
みたいな対応をどこかで std::map とかで保存しないといけないと思うんですけど、どこでやるのが良いでしょうか?

@abap34
Copy link
Owner Author

abap34 commented Jun 17, 2024

パース途中で得られる全体に影響する情報は Reader クラスで管理しています。

almo/src/reader.hpp

Lines 52 to 68 in dd09f27

void set_meta_data(std::string key, std::string value){
// for required_pyodide (stop warning)
if (key == "required_pyodide" && value == "true"){
assert(meta_data.contains("required_pyodide"));
if (meta_data["required_pyodide"] == "false"){
meta_data[key] = value;
}
return ;
}
if (meta_data.contains(key)){
if (meta_data[key] == value) return ;
std::cerr << "Warning : key is duplicating. value is overwritten." << std::endl;
std::cerr << "duplicated key : " << key << std::endl;
std::cerr << "previous value : " << meta_data[key] << std::endl;
std::cerr << " new value : " << value << std::endl;
}
meta_data[key] = value;

たとえば、「実行可能なコードブロックがソースコード全体に一つでもあるか?」という情報も管理しているんですが、(これをすることで不要な場合読み込みをスキップして高速化できます)

ここ

read.set_meta_data("required_pyodide","true");

set_meta_data を使って追加しています。

一旦書き出しの処理は後で考えることにして、文法を定義 → パーサを書いて Reader に持たせる までやってみるといいかもしれません (作業移ってくれるのであれば assign します 👁️

@potato167
Copy link
Contributor

わかりました
作業したいと思います。

@abap34
Copy link
Owner Author

abap34 commented Jun 19, 2024

assign しました!

@potato167
Copy link
Contributor

"[^" + expr + "]:" + hoge という形に分解したいんですけど、それをどうやるかがわかっておりません

@noya2ruler
Copy link
Collaborator

正規表現の使い方がわからない、という話ですか?

abap34 added a commit that referenced this issue Jul 18, 2024
abap34 added a commit that referenced this issue Aug 7, 2024
脚注の完全なサポート
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants