mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 15:02:21 -04:00
add config option to turn off html stripping
This commit is contained in:
parent
1b2f44d29b
commit
c92a00d90b
4 changed files with 19 additions and 6 deletions
|
@ -98,6 +98,7 @@ class Config(dict):
|
|||
'sortIndex': 0,
|
||||
'splitQA': True,
|
||||
'standaloneWindows': True,
|
||||
'stripHTML': True,
|
||||
'studyOptionsScreen': 0,
|
||||
'suppressEstimates': False,
|
||||
'suppressUpdate': False,
|
||||
|
|
|
@ -1021,7 +1021,7 @@ class FactEdit(QTextEdit):
|
|||
if source.hasHtml() and "qrichtext" in unicode(source.html()):
|
||||
self.insertHtml(source.html())
|
||||
return
|
||||
if source.hasText():
|
||||
if source.hasText() and ankiqt.mw.config['stripHTML']:
|
||||
txt = unicode(source.text())
|
||||
l = txt.lower()
|
||||
if l.startswith("http://") or l.startswith("file://"):
|
||||
|
@ -1095,6 +1095,8 @@ class FactEdit(QTextEdit):
|
|||
|
||||
def simplifyHTML(self, html):
|
||||
"Remove all style information and P tags."
|
||||
if not ankiqt.mw.config['stripHTML']:
|
||||
return html
|
||||
html = re.sub("\n", " ", html)
|
||||
html = re.sub("<br ?/?>", "\n", html)
|
||||
html = re.sub("<p ?/?>", "\n\n", html)
|
||||
|
|
|
@ -218,6 +218,7 @@ class Preferences(QDialog):
|
|||
self.dialog.openLastDeck.setChecked(self.config['loadLastDeck'])
|
||||
self.dialog.deckBrowserOrder.setChecked(self.config['deckBrowserOrder'])
|
||||
self.dialog.deleteMedia.setChecked(self.config['deleteMedia'])
|
||||
self.dialog.stripHTML.setChecked(self.config['stripHTML'])
|
||||
self.dialog.deckBrowserLen.setValue(self.config['deckBrowserNameLength'])
|
||||
|
||||
def updateAdvanced(self):
|
||||
|
@ -232,6 +233,7 @@ class Preferences(QDialog):
|
|||
self.config['alternativeTheme'] = self.dialog.alternativeTheme.isChecked()
|
||||
self.config['showProgress'] = self.dialog.showProgress.isChecked()
|
||||
self.config['preventEditUntilAnswer'] = self.dialog.preventEdits.isChecked()
|
||||
self.config['stripHTML'] = self.dialog.stripHTML.isChecked()
|
||||
self.config['loadLastDeck'] = self.dialog.openLastDeck.isChecked()
|
||||
if self.dialog.deckBrowserOrder.isChecked():
|
||||
self.config['deckBrowserOrder'] = 1
|
||||
|
|
|
@ -548,7 +548,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="7" column="0">
|
||||
<widget class="QCheckBox" name="showStudyOptions">
|
||||
<property name="text">
|
||||
<string>Show study options on deck load</string>
|
||||
|
@ -562,28 +562,28 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<item row="11" column="0">
|
||||
<widget class="QCheckBox" name="addZeroSpace">
|
||||
<property name="text">
|
||||
<string>Add hidden char to text (fixes Thai on OSX)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<item row="8" column="0">
|
||||
<widget class="QCheckBox" name="openLastDeck">
|
||||
<property name="text">
|
||||
<string>Always open last deck on startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<item row="9" column="0">
|
||||
<widget class="QCheckBox" name="deckBrowserOrder">
|
||||
<property name="text">
|
||||
<string>Show decks with cards due first in browser</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<item row="10" column="0">
|
||||
<widget class="QCheckBox" name="deleteMedia">
|
||||
<property name="text">
|
||||
<string>Delete original media on add</string>
|
||||
|
@ -597,6 +597,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="stripHTML">
|
||||
<property name="text">
|
||||
<string>Strip HTML when pasting text</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -711,6 +718,7 @@
|
|||
<tabstop>colourTimes</tabstop>
|
||||
<tabstop>showTimer</tabstop>
|
||||
<tabstop>showTray</tabstop>
|
||||
<tabstop>stripHTML</tabstop>
|
||||
<tabstop>showStudyOptions</tabstop>
|
||||
<tabstop>openLastDeck</tabstop>
|
||||
<tabstop>deckBrowserOrder</tabstop>
|
||||
|
|
Loading…
Reference in a new issue