Skip to content
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

Update plugin.py #14579

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update plugin.py #14579

wants to merge 1 commit into from

Conversation

t-abraham
Copy link

@t-abraham t-abraham commented Jan 13, 2021

Description of Changes

To have sections in the template as a section variable, I have just edited the plugin.py file from Anaconda3\Lib\site-packages\spyder\plugins\editor\widgets at line 1825 where the Dictionary Variable VARS will hold 3 keys instead of two.

To add the ability to have sections in the template file, I have added a new variable names %(section)s in addition to %(date)s and %(username)s. To have this new variable replaced to #%% I had to edit the plugin.py file where the VARS dict holds one extra key now for this section variable in the template

Issue(s) Resolved

Fixes #11426

Affirmation

By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.

I certify the above statement is true and correct:

@dalthviz
Copy link
Member

Hi @t-abraham thank you for the PR! I'm not totally sure if this covers the case that is discussed in #6379 (the issue favored instead of #11426) but just in case pinging @ccordoba12 to check this

@t-abraham
Copy link
Author

t-abraham commented Jan 13, 2021

Hi @dalthviz the forwarded case #6379 mainly dealt with the date string and its format. Nothing was done to have sections #%% in the template part. The use of double %% doesn't work in default since the template variables are being replaced by the modulus functions using the dictionary. Now if someone wants to have a template where there are sections like Header and Mains with the separation using #%% it is not possible even with the discussed method in #6379 thus I introduced a 3rd variable along with the date and username variables in the template. If someone wants to have a sectioned template they can use #%(section)s in the template line which will be parsed to #%% when a new file is generated. This is what the main poster of the #11426 asked about...

Template

template

New File

new

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Section marks (#%%) not working as expected
2 participants