Alir3z4 / Alir3z4/html2text

mark_code with <p class="pre">

オープン
#189 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
2.2k
フォーク
296
PR マージ指標
30日以内にマージされた PR はありません

説明

$ html2text --version
html2text 2016.9.19
$ python --version
Python 2.7.14

I noticed the code doesn't handle marking code when its wrapped around ```

``` tags. I found during parsing it doesn't handle attrs and I was able to get around this by:
```
$ diff -u __init__.py /usr/local/lib/python2.7/dist-packages/html2text/__init__.py
--- __init__.py 2017-10-22 22:23:31.588370064 -0700
+++ /usr/local/lib/python2.7/dist-packages/html2text/__init__.py 2016-09-18 15:03:55.000000000 -0700
@@ -600,7 +600,7 @@
if tag in ["td", "th"] and start:
self.td_count += 1

- if tag == "pre" or ('class' in attrs and attrs['class'] == 'pre') or tag == 'p' and self.pre == 1:
+ if tag == "pre":
if start:
self.startpre = 1
self.pre = 1
```

-----
This works though it seems a bit messy to submit a PR from. Any better ideas?

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。