wpilibsuite / sphinxext-opengraph

Sphinx extension to generate unique OpenGraph metadata
https://sphinxext-opengraph.readthedocs.io
Other
74 stars 27 forks source link

Add site_name Support and Enhance Description (Fixes #3) #4

Closed TheTripleV closed 4 years ago

TheTripleV commented 4 years ago

Closes #3.

Move html tag formatting to a function

Make new tag creation more seamless.

Add support for og:site_name tag

Allow specification of ogp_site_name in conf.py.

Enhance Description

  1. Skip all admontitions
    • Ex. software/sensors/sensor-overview-software.html
    • before: "Sensor Overview - Software Note This section covers using sensors in software. For a guide to sensor hardware, see Sensor Overview - Hardware. Note While cameras may definitely be considered “..."
    • after: "In order to be effective, it is often vital for robots to be able to gather information about their surroundings. Devices that provide feedback to the robot on the state of its environment are call..."
  2. Skip title The first title is skipped as it is the title of the page. But it is saved for later (Fixes #3 -> Get title from doctree instead of context)
    • Ex. software/vision-processing/introduction/what-is-vision.html
    • before: "What is Vision? Vision in FRC uses a camera conne..."
    • after: "Vision in FRC uses a camera conne..."
  3. Remove Double Spaces In the .rst and the generated .html's sentences are separated by double spaces. The browser removes these. So does this PR (from the documentation string).
  4. Add Spaces Add a space if two text elements don't already have one.
  5. Punctuate titles (with a :)
    • Ex. software/vision-processing/introduction/what-is-vision.html
    • before: "...teleoperated periods. Vision Methods There are two main ..."
    • after: "teleoperated periods. Vision Methods: There are two main..."
  6. Mark Nested Lists (with a -)
    • Ex. software/wpilib-tools/robotbuilder/index.html
    • before: "RobotBuilder RobotBuilder - Introduction RobotBuilder Overview Starting RobotBuilder RobotBuilder User Interface Setting up the Robot Project Creating a Subsystem Creating a Command Setting..."
    • after: "RobotBuilder - Introduction- RobotBuilder Overview, Starting RobotBuilder, RobotBuilder User Interface, Setting up the Robot Project, Creating a Subsystem, Creating a Command, Setting the Default A..."
  7. Punctuate lists Lists are comma delineated and end with a period. See (6.) for example.
  8. Fix length check
    • Support case where ogp_description_length is set to less than 3.
    • Runtime optimization? Stop parsing when the desired length is reached.

To be merged as separate.

TheTripleV commented 4 years ago

Added tests. Regarding #3, the title is now gotten from the context. All html tags are removed from it. This is also used to improve (2. skip title). The first title is only skipped if it is equal to the context's title.