Formátítko si namele hubu, když nespecifikuji jazyk #34

Closed
opened 2023-08-26 10:20:30 +02:00 by jirikalvoda · 1 comment
Owner
<main>
Traceback (most recent call last):
  File "/home/jiri/mff/bakararka/zapoctak-past/venv/bin/formatitko", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/formatitko.py", line 64, in main
    HTMLGenerator(sys.stdout, katexClient, imageProcessor).generate(doc2)
  File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/html_generator.py", line 35, in generate
    super().generate(e)
  File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/output_generator.py", line 121, in generate
    self.TYPE_DICT_MISC[type(e)](e)
  File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/output_generator.py", line 435, in generate_Doc
    self.generate_simple_tag(e)
  File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/output_generator.py", line 206, in generate_simple_tag
    self.generate_simple_block_tag(tag, content, attributes)
  File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/output_generator.py", line 216, in generate_simple_block_tag
    self.generate(content)
  File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/html_generator.py", line 35, in generate
    super().generate(e)
  File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/output_generator.py", line 110, in generate
    self.generate_ListContainer(e)
  File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/output_generator.py", line 235, in generate_ListContainer
    self.generate(child)
  File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/html_generator.py", line 35, in generate
    super().generate(e)
  File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/output_generator.py", line 114, in generate
    self.generate_Block(e)
  File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/output_generator.py", line 368, in generate_Block
    self.TYPE_DICT_BLOCK[type(e)](e)
  File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/html_generator.py", line 205, in generate_BlockGroup
    self.generate_Group(e)
  File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/html_generator.py", line 209, in generate_Group
    self.generate_simple_tag(e, attributes=self.common_attributes(e) | {"lang":self.context.get_metadata("lang")})
  File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/output_generator.py", line 206, in generate_simple_tag
    self.generate_simple_block_tag(tag, content, attributes)
  File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/output_generator.py", line 214, in generate_simple_block_tag
    self.writeln(self.start_tag(tag, attributes))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/html_generator.py", line 49, in start_tag
    words.append(f"{key}=\"{self.escape_special_chars(value)}\"")
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/html_generator.py", line 38, in escape_special_chars
    text = text.replace("&", "&amp;")
           ^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'replace'

Zde get metadata vrátí None:

		self.generate_simple_tag(e, attributes=self.common_attributes(e) | {"lang":self.context.get_metadata("lang")})
``` <main> Traceback (most recent call last): File "/home/jiri/mff/bakararka/zapoctak-past/venv/bin/formatitko", line 8, in <module> sys.exit(main()) ^^^^^^ File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/formatitko.py", line 64, in main HTMLGenerator(sys.stdout, katexClient, imageProcessor).generate(doc2) File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/html_generator.py", line 35, in generate super().generate(e) File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/output_generator.py", line 121, in generate self.TYPE_DICT_MISC[type(e)](e) File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/output_generator.py", line 435, in generate_Doc self.generate_simple_tag(e) File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/output_generator.py", line 206, in generate_simple_tag self.generate_simple_block_tag(tag, content, attributes) File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/output_generator.py", line 216, in generate_simple_block_tag self.generate(content) File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/html_generator.py", line 35, in generate super().generate(e) File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/output_generator.py", line 110, in generate self.generate_ListContainer(e) File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/output_generator.py", line 235, in generate_ListContainer self.generate(child) File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/html_generator.py", line 35, in generate super().generate(e) File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/output_generator.py", line 114, in generate self.generate_Block(e) File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/output_generator.py", line 368, in generate_Block self.TYPE_DICT_BLOCK[type(e)](e) File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/html_generator.py", line 205, in generate_BlockGroup self.generate_Group(e) File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/html_generator.py", line 209, in generate_Group self.generate_simple_tag(e, attributes=self.common_attributes(e) | {"lang":self.context.get_metadata("lang")}) File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/output_generator.py", line 206, in generate_simple_tag self.generate_simple_block_tag(tag, content, attributes) File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/output_generator.py", line 214, in generate_simple_block_tag self.writeln(self.start_tag(tag, attributes)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/html_generator.py", line 49, in start_tag words.append(f"{key}=\"{self.escape_special_chars(value)}\"") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jiri/mff/bakararka/zapoctak-past/formatitko/src/formatitko/html_generator.py", line 38, in escape_special_chars text = text.replace("&", "&amp;") ^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'replace' ``` Zde get metadata vrátí `None`: ``` self.generate_simple_tag(e, attributes=self.common_attributes(e) | {"lang":self.context.get_metadata("lang")}) ```
Author
Owner

Funguje.

Funguje.
Sign in to join this conversation.
No labels
ksp-implementace
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: KSP/formatitko#34
No description provided.