mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Dont serialize the default namespace on ever tag
This commit is contained in:
parent
7687c3dab6
commit
cb9b08b369
@ -311,7 +311,7 @@ class Serializer {
|
||||
}
|
||||
if (!write_str_literal("{\"n\":")) return false;
|
||||
if (!this->write_string_as_json(tag_name)) return false;
|
||||
if (nsindex > -1) {
|
||||
if (nsindex > 0) {
|
||||
char buf[32];
|
||||
this->write_data(buf, snprintf(buf, sizeof(buf), ",\"s\":%d", nsindex));
|
||||
}
|
||||
|
@ -252,14 +252,14 @@ class ContentTest(LibraryBaseTest):
|
||||
bc = data['tree']['c'][1]['c']
|
||||
self.ae(bc, body_children)
|
||||
|
||||
t('<p>a<!--c-->t</p>l', [{"n":"p","s":0,"x":"a","l":"l","c":[{"s":"c","x":"c","l":"t"}]}])
|
||||
t('<p class="foo" id="bar">a', [{"n":"p","s":0,"x":"a","a":[['class','foo'],['id','bar']]}])
|
||||
t('<p>a<!--c-->t</p>l', [{"n":"p","x":"a","l":"l","c":[{"s":"c","x":"c","l":"t"}]}])
|
||||
t('<p class="foo" id="bar">a', [{"n":"p","x":"a","a":[['class','foo'],['id','bar']]}])
|
||||
t(
|
||||
'<svg xlink:href="h"></svg>', [{'n': 'svg', 's': 1, 'a': [['href', 'h', 2]]}],
|
||||
('http://www.w3.org/1999/xhtml', 'http://www.w3.org/2000/svg', 'http://www.w3.org/1999/xlink')
|
||||
)
|
||||
text = '🐈\n\t\\mūs"'
|
||||
t("<p id='{}'>Peña".format(text), [{"n":"p","s":0,"x":"Peña","a":[['id',text]]}])
|
||||
t("<p id='{}'>Peña".format(text), [{"n":"p","x":"Peña","a":[['id',text]]}])
|
||||
text = 'a' * (127 * 1024)
|
||||
t('<p>{0}<p>{0}'.format(text), [{"n":"p","s":0,"x":text}, {'n':'p','s':0,'x':text}])
|
||||
t('<p>{0}<p>{0}'.format(text), [{"n":"p","x":text}, {'n':'p','x':text}])
|
||||
# }}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user