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

課題などを出力した際、コンソール画面から先頭がはみ出してしまう #9

Closed
igrep opened this issue Oct 8, 2018 · 7 comments
Assignees
Labels
priority:high なるべくHaskell Day当日までに直したいもののうち、特に重要なもの

Comments

@igrep
Copy link
Member

igrep commented Oct 8, 2018

標準出力がttyな場合に less などの pagerを通すのがいいんだろうけど、Mac, Linux, Windowsすべてで動くやり方がないものか。

@igrep
Copy link
Member Author

igrep commented Oct 8, 2018

moreコマンドがあるからそれでいけるか。
http://hackage.haskell.org/package/pager がそのまま動いたらそれを使おう。

@igrep
Copy link
Member Author

igrep commented Oct 21, 2018

むー、やっぱりunixパッケージに依存してるしWindowsでは動かないな。。。妥協案としてはアリだけど。。。

@igrep
Copy link
Member Author

igrep commented Oct 21, 2018

どうせmarkdownで出力するんだし、いっそのことpandocで変換して http://hackage.haskell.org/package/open-browser/docs/Web-Browser.html で表示する、みたいなやり方の方がいいかも。

@igrep
Copy link
Member Author

igrep commented Oct 28, 2018

ブラウザの起動がうまくいかなかったらコンソールに書き出す、みたいな挙動にするのがよさそう。
コンソールに書き出すのを強制できるオプションも着けたい。

@igrep igrep added the priority:high なるべくHaskell Day当日までに直したいもののうち、特に重要なもの label Oct 28, 2018
@igrep
Copy link
Member Author

igrep commented Oct 28, 2018

実装としては、恐らくEnv型にprintMarkdownみたいな関数を追加して、withMainEnv関数で終了後に処理できるようtmpファイルに書き込みつつ、
最終的にHTMLに変換してブラウザを立ち上げるか、そのままコンソールに出すと良いのではないかと思います。

いじるのは主に https://github.com/haskell-jp/makeMistakesToLearnHaskell/blob/master/src/Education/MakeMistakesToLearnHaskell.hs

@waddlaw
Copy link
Contributor

waddlaw commented Oct 29, 2018

実装する前に質問です。やりたいこととしては以下の内容で合ってますか?

  • cmark を使ってマークダウンファイルを HTML に変換 (起動時?show コマンドの実行毎?)
  • mmlh show nn.html をブラウザで開く

@igrep
Copy link
Member Author

igrep commented Oct 29, 2018

すみません、遅くなりました。
恐らく実装が簡単なのは

  • showコマンドを実行する都度変換して、
  • mmlh show nn.mdを変換したHTMLを開く」だと思っています。

途中まで実装したのを https://github.com/haskell-jp/makeMistakesToLearnHaskell/compare/issue9?expand=1 に上げました(本当に最初のところだけですが)。
tmpファイルがいいかと思ってtemporaryパッケージを追加してみたものの、リロードしたら消えちゃう、というのも困るので、実際には使わない方がいいかもしれません。どこに書き込むかはお任せします。
書き込み場所について一点だけ気になるのが、TMPディレクトリー以外だと、ホームディレクトリー以下のどこかになるようにした方がいいと思います。
assets以下だと、root権限でインストールされている可能性も0ではないので。。。

@waddlaw waddlaw mentioned this issue Oct 30, 2018
@igrep igrep closed this as completed Oct 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:high なるべくHaskell Day当日までに直したいもののうち、特に重要なもの
Projects
None yet
Development

No branches or pull requests

2 participants