-
Notifications
You must be signed in to change notification settings - Fork 0
Fix empty global conf #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -40,13 +40,13 @@ You can change this behavior by overriding the corresponding string of ``'pseudo | |||||
| `numfig_format <https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-numfig_format>`_. | ||||||
|
|
||||||
| Configuration Options | ||||||
| ====================== | ||||||
| ===================================================== | ||||||
|
|
||||||
| Pseudocode rendering is extended with practical options (all compatible with pseudocode.js native capabilities): | ||||||
|
|
||||||
| - ``linenos``: Enable line numbering | ||||||
| - ``no-linenos``: Disable line numbering | ||||||
| - ``indent``: Set indentation (seems working only for ``em``, no other units) for code blocks, default: ``1.2em`` | ||||||
| - ``indent``: Set indentation (working only for ``em``, no other units) for code blocks, default: ``1.2em`` | ||||||
| - ``comment-delimiter``: Customize comment delimiters, default: ``//`` | ||||||
| - ``line-number-punc``: Set line number punctuation, default: ``:`` | ||||||
| - ``no-end``: Omit the ``END`` keyword for control blocks | ||||||
|
|
@@ -58,7 +58,7 @@ Pseudocode rendering is extended with practical options (all compatible with pse | |||||
| Global Configuration via ``pseudocode2_options`` | ||||||
| ===================================================== | ||||||
|
|
||||||
| Pseudocode rendering styles can be unified across the entire project using a single global configuration (supports all pseudocode.js native parameters, see [pseudocode.js](https://github.com/SaswatPadhi/pseudocode.js)). The following example shows how to set global options in `conf.py`: | ||||||
| Pseudocode rendering styles can be unified across the entire project using a single global configuration (supports all pseudocode.js native parameters, see [pseudocode.js](https://github.com/SaswatPadhi/pseudocode.js?tab=readme-ov-file#options)). The following example shows how to set global options in `conf.py`: | ||||||
|
|
||||||
| .. code-block:: python | ||||||
|
|
||||||
|
|
@@ -74,6 +74,21 @@ Pseudocode rendering styles can be unified across the entire project using a sin | |||||
| **Priority Rule**: | ||||||
| Configuration priority (higher priority overrides lower): Directive option (e.g., :linenos: in .rst) > pseudocode2_options (global in conf.py) > pseudocode.js default | ||||||
|
|
||||||
| Tips | ||||||
| ===================================================== | ||||||
|
|
||||||
| - Custom (Manual) indentation Control: ``psuedo.js`` and ``algorithmic`` do not have a built-in way (a single command | ||||||
|
||||||
| - Custom (Manual) indentation Control: ``psuedo.js`` and ``algorithmic`` do not have a built-in way (a single command | |
| - Custom (Manual) indentation Control: ``pseudocode.js`` and ``algorithmic`` do not have a built-in way (a single command |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -60,6 +60,7 @@ def run(self): | |||
| env = getattr(self, "env", None) | ||||
| app = getattr(env, "app", None) if env is not None else None | ||||
| global_opts = getattr(app.config, "pseudocode2_options", {}) if app is not None else {} | ||||
| global_opts = global_opts if global_opts is not None else {} | ||||
|
||||
| global_opts = global_opts if global_opts is not None else {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR solves the case where app.config has the attribute 'pseudocode2_options' whose value is None.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'psuedo.js' to 'pseudo.js'.