ultrabug / mkdocs-static-i18n

MkDocs i18n plugin using static translation markdown files
https://ultrabug.github.io/mkdocs-static-i18n/
MIT License
232 stars 39 forks source link

KeyError: 'fixed_link' #150

Closed NetheriteTree closed 2 years ago

NetheriteTree commented 2 years ago
ERROR    -  Error building page 'index.en.md': 'fixed_link'
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.7/x64/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/opt/hostedtoolcache/Python/3.10.7/x64/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.10.7/x64/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/opt/hostedtoolcache/Python/3.10.7/x64/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/hostedtoolcache/Python/3.10.7/x64/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/hostedtoolcache/Python/3.10.7/x64/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.10.7/x64/lib/python3.10/site-packages/mkdocs/__main__.py", line 277, in gh_deploy_command
    build.build(cfg, dirty=not clean)
  File "/opt/hostedtoolcache/Python/3.10.7/x64/lib/python3.10/site-packages/mkdocs/commands/build.py", line 329, in build
    _build_page(file.page, config, doc_files, nav, env, dirty)
  File "/opt/hostedtoolcache/Python/3.10.7/x64/lib/python3.10/site-packages/mkdocs/commands/build.py", line [22](https://github.com/NetheriteTree/xenondevsDocs/actions/runs/3254610698/jobs/5343060489#step:6:23)6, in _build_page
    context = config.plugins.run_event(
  File "/opt/hostedtoolcache/Python/3.10.7/x64/lib/python3.10/site-packages/mkdocs/plugins.py", line 514, in run_event
    result = method(item, **kwargs)
  File "/opt/hostedtoolcache/Python/3.10.7/x64/lib/python3.10/site-packages/mkdocs_static_i18n/plugin.py", line 480, in on_page_context
    fixed_link = alternate["fixed_link"]
KeyError: 'fixed_link'

This only occurs with the 0.48 version.

This is my mkdocs.yml

site_name: xenondevs docs
site_url: https://xenondevs.tree.pink/
repo_url: https://github.com/xenondevs/Nova
repo_name: xenondevs/Nova
edit_uri: ""
copyright: Copyright &copy; 2022 xenondevs. Translated by Jeansou.

extra:
  social:
    - icon: fontawesome/brands/github
      link: https://github.com/xenondevs
    - icon: fontawesome/brands/discord
      link: https://discord.com/invite/EpVMXtXB2t
    - icon: fontawesome/brands/patreon
      link: https://patreon.com/xenondevs
    - icon: fontawesome/solid/pen
      link: https://github.com/JeansouLiu/xenondevsDocs
      name: 在 GitHub 上改善此翻译
  analytics:
    provider: google
    property: G-*******
  alternate:
    - name: English
      link: /en/
      lang: en
    - name: 简体中文
      link: /zh/
      lang: zh

extra_css:
  - assets/stylesheets/extra.css

theme:
  name: material
  font: false
  logo: assets/logo.png
  palette:
    scheme: slate
    primary: deep purple
    accent: green
  features:
    - content.tabs.link
    - navigation.tabs
    - content.code.annotate
  icon:
    repo: fontawesome/brands/github

markdown_extensions:
  - pymdownx.highlight:
      anchor_linenums: true
  - pymdownx.tabbed:
      alternate_style: true
  - pymdownx.tasklist:
      custom_checkbox: true
  - pymdownx.emoji:
      emoji_index: !!python/name:materialx.emoji.twemoji
      emoji_generator: !!python/name:materialx.emoji.to_svg
  - pymdownx.inlinehilite
  - pymdownx.snippets
  - pymdownx.superfences
  - pymdownx.details
  - admonition
  - attr_list
  - md_in_html
  - tables

plugins:
  - search
  - i18n:
      default_language: en
      languages:
        en:
          name: English
          site_name: xenondevs docs
        zh:
          name: 简体中文
          site_name: xenondevs 帮助文档
      nav_translations:
        zh:
          "Home": 首页
          "For Server Admins": 安装及配置帮助
          "Setup": 安装
          "Configuration": 插件配置
          "Compatibility": 兼容性
          "List of compatible Plugins": 兼容的插件
          "Troubleshooting": 疑难解答
          "Recipes": 配方
          "Custom Recipes": 自定义配方
          "Vanilla Recipe Types": 原版类配方
          "Machines Recipe Types": 机械类配方
          "FAQ": 常见问题
          "Addons": 扩展
          "Getting Started": 入门
          "AssetPacks": 资源包
          "Basics": 基础
          "Creating Items": 创建物品
          "Creating Blocks": 创建方块
          "Creating GUIs": "创建 GUI"
          "Language Files": 语言文件
          "Items": 物品相关
          "Registering Materials": 创建材料
          "Item Behaviors": 物品行为
          "Using ItemNovaMaterial": "使用 ItemNovaMaterial"
          "Item Categories": 物品种类
          "TileEntities": 方块实体
          "Config": 配置
          "Blocks": 方块相关
          "TileEntity Data": 方块实体信息
          "Upgrades": 升级
          "Particles": 粒子效果
          "GUI Textures": "GUI 贴图"
          "Advancements": 进度
          "Recipes": 配方
          "Structure": 结构
          "Configure Addon": 配置扩展

nav:
  - "Nova":
      - "Home": "nova/index.md"
      - "For Server Admins":
          - "Setup": "nova/admin/setup.md"
          - "Configuration": "nova/admin/configuration.md"
          - "Compatibility":
              - "List of compatible Plugins": "nova/admin/compatibility/index.md"
              - "Troubleshooting": "nova/admin/compatibility/troubleshooting.md"
              - "ItemsAdder": "nova/admin/compatibility/itemsadder.md"
              - "GriefDefender": "nova/admin/compatibility/griefdefender.md"
          - "Recipes":
              - "Custom Recipes": "nova/admin/recipes/index.md"
              - "Vanilla Recipe Types": "nova/admin/recipes/vanilla.md"
              - "Machines Recipe Types": "nova/admin/recipes/machines.md"
          - "FAQ": "nova/admin/faq.md"
      - "Addons":
          - "Getting Started": "nova/addon/index.md"
          - "Configure Addon": "nova/addon/addon-configuration.md"
          - "AssetPacks":
              - "Basics": "nova/addon/asset-packs/assetpack-basics.md"
              - "Creating Items": "nova/addon/asset-packs/creating-items.md"
              - "Creating Blocks": "nova/addon/asset-packs/creating-blocks.md"
              - "Creating GUIs": "nova/addon/asset-packs/creating-guis.md"
              - "Language Files": "nova/addon/asset-packs/language-files.md"
          - "Items":
              - "Registering Materials": "nova/addon/items/registering-materials.md"
              - "Item Behaviors": "nova/addon/items/item-behaviors.md"
              - "Using ItemNovaMaterial": "nova/addon/items/using-item-nova-material.md"
              - "Item Categories": "nova/addon/items/item-categories.md"
          - "Configs": "nova/addon/configs.md"
          - "Blocks":
              - "Registering Materials": "nova/addon/blocks/registering-materials.md"
              - "TileEntities":
                  - "Basics": "nova/addon/blocks/tileentity/base.md"
                  - "Config": "nova/addon/blocks/tileentity/config.md"
                  - "GUI": "nova/addon/blocks/tileentity/gui.md"
                  - "TileEntity Data": "nova/addon/blocks/tileentity/data.md"
                  - "Holders": "nova/addon/blocks/tileentity/holders.md"
                  - "Upgrades": "nova/addon/blocks/tileentity/upgrades.md"
                  - "Regions": "nova/addon/blocks/tileentity/region.md"
                  - "Particles": "nova/addon/blocks/tileentity/particles.md"
          - "GUI Textures": "nova/addon/guitexture.md"
          - "Overlays": "nova/addon/overlays.md"
          - "Advancements": "nova/addon/advancements.md"
          - "Attachments": "nova/addon/attachments.md"
          - "Abilities": "nova/addon/abilities.md"
          - "Recipes": "nova/addon/recipes.md"
      - "API for Plugins":
          - "Getting Started": "nova/api/index.md"
          - "Protection": "nova/api/protection/protectionintegration.md"
          - "NovaMaterial": "nova/api/material/index.md"
          - "Blocks":
              - "BlockManager": "nova/api/blocks/blockmanager.md"
              - "BlockState": "nova/api/blocks/blockstate.md"
          - "TileEntity":
              - "TileEntityManager": "nova/api/tileentity/tileentitymanager.md"
              - "TileEntity": "nova/api/tileentity/tileentity.md"
          - "Events":
              - "NovaLoadDataEvent": "nova/api/events/novaloaddataevent.md"
              - "TileEntityBreakBlockEvent": "nova/api/events/tileentitybreakblockevent.md"
          - "WailaManager": "nova/api/player/wailamanager.md"
  - "InvUI":
      - "Getting Started": "invui/index.md"
      - "Basics": "invui/basics.md"
      - "Items": "invui/items.md"
      - "Structure": "invui/structure.md"
      - "GUIs":
          - "Overview": "invui/guis/index.md"
          - "Normal GUI": "invui/guis/normal.md"
          - "Paged GUI": "invui/guis/paged.md"
          - "Scroll GUI": "invui/guis/scroll.md"
          - "Tab GUI": "invui/guis/tab.md"
      - "Windows": "invui/windows.md"
      - "VirtualInventory": "invui/virtualinventory.md"
  - "CBF":
      - "Getting Started": "cbf/index.md"
      - "Binary Adapters": "cbf/binaryadapter.md"
      - "Instance Creators": "cbf/instancecreator.md"
      - "Serialization": "cbf/serialization.md"
      - "Compounds": "cbf/compound.md"
ultrabug commented 2 years ago

@dariocurr

Guess I trusted the tests too much :(

Sorry about that @NetheriteTree , will investigate ASAP

ultrabug commented 2 years ago

hotfix version 0.49 is out! sorry for the noise.

dariocurr commented 2 years ago

It's curious that the tests don't cover that case. I'll give them a look!

ultrabug commented 2 years ago

It's curious that the tests don't cover that case.

It's because the tests do only simulate on_config but are not running on_context

ultrabug commented 2 years ago

Added https://github.com/ultrabug/mkdocs-static-i18n/commit/a48edef520334fd266030235705d65eeac612fd3

Thanks