Skip to content
Snippets Groups Projects
  1. Mar 29, 2024
  2. Feb 28, 2024
  3. Feb 20, 2024
  4. Dec 19, 2023
    • Vegard Nossum's avatar
      docs: translations: add translations links when they exist · 7418ec5b
      Vegard Nossum authored
      
      Add a new Sphinx extension that knows about the translations of kernel
      documentation and can insert links to the translations at the top of
      the document.
      
      It basically works like this:
      
      1. Register a new node type, LanguagesNode.
      
      2. Register a new transform, TranslationsTransform, that inserts a new
         LanguageNode at the top of every document. The LanguageNode contains
         "pending references" to translations of the document. The key here
         is that these are pending (i.e. unresolved) references that may or
         may not actually exist.
      
      3. Register a 'doctree-resolved' event that iterates over all the
         LanguageNode nodes. Any unresolved references are filtered out; the
         list of resolved references is passed to the 'translations.html'
         template and rendered as an HTML node (if HTML output is selected).
      
      Testing: make htmldocs, make latexdocs with Sphinx v4.3.2 and Firefox.
      
      v2:
      - changed bar into a drop-down menu
      - fixed language labels
      - fixed hysteresis reported by Akira Yokosawa
      
      Cc: Federico Vaga <federico.vaga@vaga.pv.it>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Akira Yokosawa <akiyks@gmail.com>
      Cc: Yanteng Si <siyanteng@loongson.cn>
      Signed-off-by: default avatarVegard Nossum <vegard.nossum@oracle.com>
      Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
      Link: https://lore.kernel.org/r/20231215123701.2712807-1-vegard.nossum@oracle.com
      7418ec5b
  5. Dec 15, 2023
  6. Nov 17, 2023
  7. May 19, 2023
    • James Seo's avatar
      Documentation: conf.py: Add __force to c_id_attributes · 34d9f62e
      James Seo authored
      
      Fixes the following error in the docs build that occurs with recent
      versions of Sphinx when parsing kerneldocs for a function with the
      '__force' macro in its signature:
      
        ./include/linux/err.h:51: WARNING: Error in declarator or parameters
        Error in declarator or parameters
        Invalid C declaration: Expected identifier, got keyword: void [error at 35]
          void * ERR_CAST (__force const void *ptr)
          -----------------------------------^
      
      Currently, almost all of the few in-signature occurrences of '__force'
      are in the error pointer functions. Of those, ERR_CAST() is the only
      one with kerneldocs, but the kerneldocs aren't even being used to
      generate documentation. This change will allow all the error pointer
      functions to be properly documented.
      
      In addition to '__force', <linux/compiler_types.h> also defines
      '__nocast', '__safe', and '__private'. These are not currently used in
      any function signatures and do not need to be added to the docs config.
      
      Signed-off-by: default avatarJames Seo <james@equiv.tech>
      Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
      Link: https://lore.kernel.org/r/20230509175543.2065835-2-james@equiv.tech
      34d9f62e
  8. Apr 20, 2023
  9. Feb 08, 2023
  10. Feb 01, 2023
  11. Jan 11, 2023
  12. Jan 06, 2023
    • Jonathan Corbet's avatar
      docs: Deprecate use of Sphinx < 2.4.x · 31abfdda
      Jonathan Corbet authored
      
      The Sphinx 2.4 release is three years old, and it is becoming increasingly
      difficult to even find a system with an sufficiently archaic Python
      installation that can run versions older than that.  I can no longer test
      changes against anything prior to 2.4.x.
      
      Move toward raising our minimum Sphinx requirement to 2.4.x so we can
      delete some older support code and claim to support a range of versions
      that we can actually test.
      
      In the absence of screams, the actual removal of support can happen later
      in 2023.
      
      Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
      31abfdda
  13. Nov 09, 2022
    • Simona Vetter's avatar
      docs/sphinx: More depth in the rtd sidebar toc · e17f2260
      Simona Vetter authored
      
      We love to nest our documenation for good structure, but that means
      the table of contents needs to keep up or you can't navigate them.
      
      Realized this trying to find the drm property documentation, which
      with some shuffling around disappeared. Why I didn't realize we can do
      this earlier, no idea.
      
      Since the relevant parts of the toc are only loaded if you're in the
      right .html file there's no harm in going all the way to unlimited.
      
      Note that this has no impact on the alabaster theme (which has a much
      simpler sidebar toc which doesn't show the entire hierarchy, only
      what's in the local rendered file) nor on the various :toctree:
      rendered inline in the output.
      
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: linux-doc@vger.kernel.org
      Link: https://lore.kernel.org/r/20221108115707.1232621-1-daniel.vetter@ffwll.ch
      
      
      Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
      e17f2260
  14. Nov 01, 2022
    • Jonathan Corbet's avatar
      docs: Don't wire font sizes for HTML output · bd5d1cc8
      Jonathan Corbet authored
      
      The alabaster theme likes to provide explicit sizes for fonts, which
      overrides the users's own browser settings and is guaranteed to displease
      folks.  Set the font size to "inherit" so that the users browser settings
      control the font size they get.  We can use the font_size configuration
      option for the main body font (changing the size I'd already put there),
      but the sidebar size can only be set via custom CSS.
      
      Reported-by: default avatarBagas Sanjaya <bagasdotme@gmail.com>
      Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
      bd5d1cc8
  15. Oct 18, 2022
  16. Oct 13, 2022
  17. Sep 29, 2022
  18. Sep 27, 2022
  19. Aug 26, 2022
  20. Jun 01, 2022
  21. Feb 24, 2022
    • Akira Yokosawa's avatar
      docs: pdfdocs: Pull LaTeX preamble part out of conf.py · 398f7abd
      Akira Yokosawa authored
      Quote from Jon's remark [1]:
      
          I do notice that Documentation/conf.py is getting large and
          unapproachable.  At some future point, it might be nice to pull
          all of the latex stuff out into a separate file where it won't
          scare people who stumble into it by accident.
      
      Pull LaTeX preamble settings added since commit 3b4c9632 ("docs:
      conf.py: adjust the LaTeX document output") out into
      sphinx/kerneldoc-preamble.sty.
      
      It will be copied to the build directory by the added
      "latex_additional_files" setting in conf.py.
      
      As a bonus, LaTeX/TeX code can be maintained without escaping backslashes.
      
      To compensate the loss of change history in sphinx/kerneldoc-preamble.sty,
      here is a list of changes made in conf.py:
      
        - f7ebe6b7 ("docs: Activate exCJK only in CJK chapters")
        - 0afd4df0 ("docs: pdfdocs: Prevent column squeezing by tabulary")
        - 659653c9 ("docs: pdfdocs: Refactor config for CJK document")
        - e291ff6f ("docs: pdfdocs: Add CJK-language-specific font settings")
        - 7eb368cc ("docs: pdfdocs: Choose Serif font as CJK mainfont if possible")
        - 35382965 ("docs: pdfdocs: Preserve inter-phrase space in Korean translations")
        - 77abc2c2 ("docs: pdfdocs: One-half spacing for CJK translations")
        - 788d28a2 ("docs: pdfdocs: Permit AutoFakeSlant for CJK fonts")
        - 29ac9822 ("docs: pdfdocs: Teach xeCJK about character classes of quotation marks")
        - 7c5c18bd ("docs: pdfdocs: Fix typo in CJK-language specific font settings")
        - aa872e06 ("docs: pdfdocs: Adjust \headheight for fancyhdr")
        - 8716ef41 ("docs: pdfdocs: Tweak width params of TOC")
        - 66939df5 ("docs: pdfdocs: Switch default CJK font to KR variants")
        - 7b686a2e ("docs: pdfdocs: Enable CJKspace in TOC for Korean titles")
        - 5d9158e3 ("docs/translations: Skip CJK contents if suitable fonts not found")
        - b774cc46 ("docs: pdfdocs: Move CJK monospace font setting to main conf.py")
      
      [1]: https://lore.kernel.org/all/87zgmr66cn.fsf@meer.lwn.net/
      
      
      
      Suggested-by: default avatarJonathan Corbet <corbet@lwn.net>
      Signed-off-by: default avatarAkira Yokosawa <akiyks@gmail.com>
      Link: https://lore.kernel.org/r/aaa9dca1-27c0-c414-77f3-c5587db0cc5b@gmail.com
      
      
      Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
      398f7abd
  22. Feb 15, 2022
    • Akira Yokosawa's avatar
      docs: pdfdocs: Move CJK monospace font setting to main conf.py · b774cc46
      Akira Yokosawa authored
      
      As LaTeX macros for CJK font settings can have Latin-script font
      settings as well, settings under Documentation/translations/ can
      be moved to the main conf.py.
      
      By this change, translations.pdf built by top-level "make pdfdocs"
      can have properly aligned ascii-art diagrams except for Korean
      ones.
      
      For the reason of remaining misalignment in Korean diagrams, see
      changelog of commit a90dad8f ("docs: pdfdocs: Add conf.py
      local to translations for ascii-art alignment").
      
      Signed-off-by: default avatarAkira Yokosawa <akiyks@gmail.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Link: https://lore.kernel.org/r/eb87790a-03f4-9f29-c8a3-ef2c3e78ca18@gmail.com
      
      
      Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
      b774cc46
    • Akira Yokosawa's avatar
      docs/translations: Skip CJK contents if suitable fonts not found · 5d9158e3
      Akira Yokosawa authored
      
      On systems without "Noto Sans CJK" fonts, CJK chapters in
      translations.pdf are full of "TOFU" boxes, with a long build time and
      a large log file containing lots of missing-font warnings.
      
      Avoid such waste of time and resources by skipping CJK chapters when
      CJK fonts are not available.
      
      To skip whole chapters, change the definition of
      \kerneldocBegin{SC|TC|KR|JP} commands so that they can have an argument
      to be ignored.
      This works as far as the argument (#1) is not used in the command.
      In place of skipped contents, put a note on skipped contents at the
      beginning of the PDF.
      
      Change the call sites in index.rst of CJK translations accordingly.
      
      When CJK fonts are available, existing command definitions with
      no argument just work.  LaTeX engine will see additional pairs of
      "{" and "}", which add a level of grouping without having any effect
      on typesetting.
      
      Signed-off-by: default avatarAkira Yokosawa <akiyks@gmail.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Link: https://lore.kernel.org/r/3359ca41-b81d-b2c7-e437-7618efbe241d@gmail.com
      
      
      Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
      5d9158e3
    • Akira Yokosawa's avatar
      docs: pdfdocs: Enable CJKspace in TOC for Korean titles · 7b686a2e
      Akira Yokosawa authored
      
      Korean (Hangul) titles in Table of Contents of translations.pdf
      don't have inter-phrase spaces.
      
      This is because the CJKspace option of xeCJK is disabled by
      default.
      
      Restore the spaces by enabling the option at the beginning of every
      document and disable it in the \kerneldocBegin{SC|TC|JP} commands.
      
      Signed-off-by: default avatarAkira Yokosawa <akiyks@gmail.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Link: https://lore.kernel.org/r/19141b3e-01d9-1f6d-5020-42fbda784831@gmail.com
      
      
      Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
      7b686a2e
    • Akira Yokosawa's avatar
      docs: pdfdocs: Switch default CJK font to KR variants · 66939df5
      Akira Yokosawa authored
      
      xeCJK is enabled in Table of Contents (TOC) so that translations.pdf
      built by top-level "make pdfdocs" can have its TOC typeset properly.
      
      This causes quotation marks and apostrophe symbols appear too wide in
      Latin-script docs.
      This is because (1) Sphinx converts ASCII symbols into multi-byte
      UTF-8 ones in LaTeX and (2) in the SC variant of "Noto CJK" font
      families, those UTF-8 symbols have full-width glyph.
      
      The KR variant of the font families has half-width glyph for those
      symbols and TOC pages should look nicer when it is used instead.
      
      Switch the default CJK font families to the KR variant and teach
      xeCJK of those symbols' widths.
      To compensate the switch, teach xeCJK of the width in the SC and
      TC variants.
      
      Signed-off-by: default avatarAkira Yokosawa <akiyks@gmail.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Link: https://lore.kernel.org/r/0c8ea878-0a6f-ea01-ab45-4e66c5facee9@gmail.com
      
      
      Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
      66939df5
    • Akira Yokosawa's avatar
      docs: pdfdocs: Tweak width params of TOC · 8716ef41
      Akira Yokosawa authored
      Sphinx has its own set of width parameters of Table of Contents (TOC)
      for LaTeX defined in its class definition of sphinxmanual.cls.
      It also inherits parameters for chapter entries from report.cls of
      original LaTeX base.
      
      However, they are optimized assuming small documents with tens of
      pages and chapters/sections of less than 10.
      
      To cope with some of kernel-doc documents with more than 1000
      pages and several tens of chapters/sections, definitions of those
      parameters need to be adjusted.
      
      Unfortunately, those parameters are hard coded in the class
      definitions and need low-level LaTeX coding tricks to redefine.
      
      As Sphinx 1.7.9 does not have \sphinxtableofcontentshook,
      which defines those parameters in later Sphinx versions,
      for compatibility with both pre-1.8 and later Sphinx versions,
      empty the hook altogether and redefine \@pnumwidth, \l@chapter,
      \l@section, and \@subsection commands originally defined in
      report.cls.
      
      Summary of parameter changes:
      
        Width of page number (\@pnumwidth): 1.55em  -> 2.7em
        Width of chapter number:  1.5em -> 1.8em
        Indent of section number: 1.5em -> 1.8em
        Width of section number:  2.6em -> 3.2em
        Indent of subsection number: 4.1em -> 5em
        Width of subsection number:  3.5em -> 4.3em
      
      Notes:
      1. Parameters for subsection become relevant only when
         ":maxdepth: 3" is specified under "toctree::" (e.g., RCU/index.rst).
         They can hold subsection numbers up to 5 digits such as "18.7.13"
         (in RCU.pdf).
      
      2. Number of chapters in driver-api.pdf is getting closer to 100.
         When it reaches 100, another set of tweaks will be necessary.
      
      3. The low-level LaTeX trick is mentioned in "Unofficial LaTeX2e
         reference manual" at:
              http://latexref.xyz/Table-of-contents-etc_002e.html
      
      
      
      Signed-off-by: default avatarAkira Yokosawa <akiyks@gmail.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Link: https://lore.kernel.org/r/e52b4718-7909-25be-fbc1-76800aa62ae3@gmail.com
      
      
      Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
      8716ef41
  23. Dec 10, 2021
  24. Nov 29, 2021
  25. Oct 12, 2021
  26. Sep 06, 2021
  27. Aug 12, 2021
Loading