Skip to content

Fixed issue #12 #30

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion WordCount.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,27 @@
import re

settings = None
LATEX_DEFAULTS = {
'exclude_abstract': True,
'exclude_headers': True,
'markup_commands': ['text\\w+', 'uppercase', 'uline', 'emph'],
'exclude_appendices': True,
'exclude_footnotes': True
}


def load_settings():
global settings
settings = sublime.load_settings("LaTeXWordCount.sublime-settings")


def load_latex_settings(settings):
temp_settings = dict()
for conf, default_value in LATEX_DEFAULTS.items():
temp_settings[conf] = settings.get(conf, default_value)
return temp_settings


def plugin_loaded():
load_settings()

Expand Down Expand Up @@ -65,7 +79,7 @@ def wrap(func):
@custom_wordcount("LaTeX")
def wordcount_latex(text):
global settings
latex_settings = settings.get("LaTeX")
latex_settings = load_latex_settings(settings)

# strip latex comments
text = latex_comment.sub(" ", text)
Expand Down