pyeasyphd 0.1.2__py3-none-any.whl → 0.1.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pyeasyphd might be problematic. Click here for more details.

Files changed (41) hide show
  1. pyeasyphd/__init__.py +5 -0
  2. pyeasyphd/data/Templates/CSL/apa-no-ampersand.csl +2183 -0
  3. pyeasyphd/data/Templates/CSL/apa.csl +2133 -0
  4. pyeasyphd/data/Templates/CSL/ieee.csl +512 -0
  5. pyeasyphd/data/Templates/TEX/Article.tex +38 -0
  6. pyeasyphd/data/Templates/TEX/Article_Header.tex +29 -0
  7. pyeasyphd/data/Templates/TEX/Article_Tail.tex +3 -0
  8. pyeasyphd/data/Templates/TEX/Beamer_Header.tex +80 -0
  9. pyeasyphd/data/Templates/TEX/Beamer_Tail.tex +14 -0
  10. pyeasyphd/data/Templates/TEX/Style.tex +249 -0
  11. pyeasyphd/data/Templates/TEX/TEVC_Header.tex +52 -0
  12. pyeasyphd/data/Templates/TEX/TEVC_Tail.tex +4 -0
  13. pyeasyphd/data/Templates/TEX/eisvogel.beamer +700 -0
  14. pyeasyphd/data/Templates/TEX/eisvogel.latex +1040 -0
  15. pyeasyphd/data/Templates/TEX/eisvogel.tex +1064 -0
  16. pyeasyphd/data/Templates/TEX/math.tex +196 -0
  17. pyeasyphd/data/Templates/TEX/math_commands.tex +673 -0
  18. pyeasyphd/main/__init__.py +6 -7
  19. pyeasyphd/main/basic_input.py +59 -77
  20. pyeasyphd/main/pandoc_md_to.py +48 -47
  21. pyeasyphd/main/python_run_md.py +65 -24
  22. pyeasyphd/main/python_run_tex.py +52 -21
  23. pyeasyphd/pyeasyphd.py +20 -6
  24. pyeasyphd/pyeasyphd.sublime-settings +8 -14
  25. pyeasyphd/tools/__init__.py +5 -8
  26. pyeasyphd/tools/generate/generate_from_bibs.py +41 -37
  27. pyeasyphd/tools/generate/generate_html.py +48 -8
  28. pyeasyphd/tools/generate/generate_library.py +39 -26
  29. pyeasyphd/tools/generate/generate_links.py +14 -8
  30. pyeasyphd/tools/py_run_bib_md_tex.py +80 -116
  31. pyeasyphd/tools/search/data.py +12 -48
  32. pyeasyphd/tools/search/search_base.py +37 -11
  33. pyeasyphd/tools/search/search_core.py +108 -38
  34. pyeasyphd/tools/search/search_keywords.py +18 -16
  35. pyeasyphd/tools/search/search_writers.py +94 -34
  36. pyeasyphd/tools/search/utils.py +48 -9
  37. pyeasyphd/utils/utils.py +7 -6
  38. {pyeasyphd-0.1.2.dist-info → pyeasyphd-0.1.6.dist-info}/METADATA +3 -3
  39. pyeasyphd-0.1.6.dist-info/RECORD +43 -0
  40. pyeasyphd-0.1.2.dist-info/RECORD +0 -27
  41. {pyeasyphd-0.1.2.dist-info → pyeasyphd-0.1.6.dist-info}/WHEEL +0 -0
@@ -24,37 +24,45 @@ from .utils import keywords_type_for_title, switch_keywords_list, switch_keyword
24
24
 
25
25
 
26
26
  class SearchResultsCore(BasicInput):
27
- """Generate tex, md, html, and pdf.
27
+ """Core class for generating tex, md, html, and pdf from search results.
28
28
 
29
29
  Args:
30
- path_storage (str): the path of storage `abbr`
31
- path_output (str): the path of output `abbr`
32
- path_separate (str): the path of separate `abbr`
33
- j_conf_abbr (str): the abbreviation of journal or conference
34
- options (dict): options
30
+ path_storage (str): Path to storage directory for bibliography files.
31
+ path_output (str): Path to output directory for generated files.
32
+ path_separate (str): Path to separate directory for individual results.
33
+ j_conf_abbr (str): Abbreviation of journal or conference.
34
+ options (dict): Configuration options.
35
35
 
36
36
  Attributes:
37
- path_storage (str): the path of storage
38
- path_output (str): the path of output
39
- path_separate (str): the path of separate
40
- j_conf_abbr (str): the abbreviation of journal or conference
41
-
42
- is_standard_bib_file_name (bool = True): whether the bib file name is standard
43
- keywords_type_list (List[str] = []): keywords type list
44
- keywords_dict (dict = {}): keywords dict
45
- delete_redundant_files (bool = True): delete redundant files
46
- generate_basic_md (bool = False): generate basic md
47
- generate_beauty_md (bool = False): generate beauty md
48
- generate_complex_md (bool = True): generate complex md
49
- generate_tex (bool = False): generate tex
50
- first_field_second_keywords (bool = True): first field second keywords
51
- deepcopy_library_for_every_field (bool = False): deepcopy library for every field
52
- deepcopy_library_for_every_keywords (bool = False): deepcopy library for every keywords
37
+ path_storage (str): Path to storage directory.
38
+ path_output (str): Path to output directory.
39
+ path_separate (str): Path to separate directory.
40
+ j_conf_abbr (str): Abbreviation of journal or conference.
41
+ is_standard_bib_file_name (bool): Whether the bib file name follows standard format.
42
+ keywords_type_list (List[str]): List of keyword types to search.
43
+ keywords_dict (dict): Dictionary of keywords for searching.
44
+ delete_redundant_files (bool): Whether to delete redundant files after processing.
45
+ generate_basic_md (bool): Whether to generate basic markdown files.
46
+ generate_beauty_md (bool): Whether to generate beautiful markdown files.
47
+ generate_complex_md (bool): Whether to generate complex markdown files.
48
+ generate_tex (bool): Whether to generate LaTeX files.
49
+ first_field_second_keywords (bool): Whether to search fields first, then keywords.
50
+ deepcopy_library_for_every_field (bool): Whether to deep copy library for every field.
51
+ deepcopy_library_for_every_keywords (bool): Whether to deep copy library for every keywords.
53
52
  """
54
53
 
55
54
  def __init__(
56
55
  self, path_storage: str, path_output: str, path_separate: str, j_conf_abbr: str, options: Dict[str, Any]
57
56
  ) -> None:
57
+ """Initialize SearchResultsCore with paths and configuration.
58
+
59
+ Args:
60
+ path_storage (str): Path to storage directory for bibliography files.
61
+ path_output (str): Path to output directory for generated files.
62
+ path_separate (str): Path to separate directory for individual results.
63
+ j_conf_abbr (str): Abbreviation of journal or conference.
64
+ options (Dict[str, Any]): Configuration options.
65
+ """
58
66
  super().__init__(options)
59
67
  self.path_storage: str = standard_path(path_storage)
60
68
  self.path_output: str = standard_path(path_output)
@@ -96,9 +104,17 @@ class SearchResultsCore(BasicInput):
96
104
  self.deepcopy_library_for_every_keywords = options.get("deepcopy_library_for_every_keywords", False)
97
105
 
98
106
  # for bib
99
- self._python_bib = PythonRunBib(self.full_json_c, self.full_json_j, options)
107
+ self._python_bib = PythonRunBib(options)
100
108
 
101
109
  def optimize(self, search_year_list: List[str] = []) -> Dict[str, Dict[str, Dict[str, Dict[str, int]]]]:
110
+ """Optimize search results for given years.
111
+
112
+ Args:
113
+ search_year_list (List[str], optional): List of years to search. Defaults to [].
114
+
115
+ Returns:
116
+ Dict[str, Dict[str, Dict[str, Dict[str, int]]]]: Nested dictionary containing search results.
117
+ """
102
118
  search_year_list = list(set([str(i) for i in search_year_list]))
103
119
 
104
120
  data_list = self._obtain_full_files_data(self.path_storage, "bib", search_year_list)
@@ -107,6 +123,16 @@ class SearchResultsCore(BasicInput):
107
123
  return entry_type_keyword_type_keyword_field_number_dict
108
124
 
109
125
  def _obtain_full_files_data(self, path_storage: str, extension: str, search_year_list: List[str] = []) -> List[str]:
126
+ """Obtain data from all files with specified extension in storage path.
127
+
128
+ Args:
129
+ path_storage (str): Path to storage directory.
130
+ extension (str): File extension to search for.
131
+ search_year_list (List[str], optional): List of years to filter by. Defaults to [].
132
+
133
+ Returns:
134
+ List[str]: Combined content from all matching files.
135
+ """
110
136
  regex = None
111
137
  if self.is_standard_bib_file_name and search_year_list:
112
138
  regex = re.compile(f'({"|".join(search_year_list)})')
@@ -123,6 +149,15 @@ class SearchResultsCore(BasicInput):
123
149
  return combine_content_in_list([read_list(f, "r") for f in sort_int_str(file_list)], None)
124
150
 
125
151
  def optimize_core(self, data_list: List[str], search_year_list) -> Dict[str, Dict[str, Dict[str, Dict[str, int]]]]:
152
+ """Core optimization logic for processing bibliography data.
153
+
154
+ Args:
155
+ data_list (List[str]): List of bibliography data strings.
156
+ search_year_list: List of years to search.
157
+
158
+ Returns:
159
+ Dict[str, Dict[str, Dict[str, Dict[str, int]]]]: Nested dictionary containing search results.
160
+ """
126
161
  print("\n" + "*" * 9 + f" Search in {self.j_conf_abbr} " + "*" * 9)
127
162
 
128
163
  entry_type_year_volume_number_month_entry_dict = self._python_bib.parse_to_nested_entries_dict(data_list)
@@ -176,18 +211,25 @@ class SearchResultsCore(BasicInput):
176
211
  return entry_type_keyword_type_keyword_field_number_dict
177
212
 
178
213
  def _optimize_fields_keyword(self, keywords_type, library, output_prefix, p_origin, p_separate, p_combine):
214
+ """Optimize search by fields first, then keywords.
215
+
216
+ Args:
217
+ keywords_type: Type of keywords to search.
218
+ library: Bibliography library to search.
219
+ output_prefix (str): Prefix for output files.
220
+ p_origin (str): Path to origin directory.
221
+ p_separate (str): Path to separate directory.
222
+ p_combine (str): Path to combine directory.
223
+
224
+ Returns:
225
+ dict: Dictionary containing keyword field numbers.
226
+ """
179
227
  no_search_library = library
180
228
 
181
229
  keyword_field_number_dict_ = {}
182
230
  for field in self.search_field_list:
183
231
  keyword_field_number_dict, no_search_library = self.core_optimize(
184
- [field],
185
- keywords_type,
186
- no_search_library,
187
- output_prefix,
188
- p_origin,
189
- p_separate,
190
- p_combine,
232
+ [field], keywords_type, no_search_library, output_prefix, p_origin, p_separate, p_combine
191
233
  )
192
234
 
193
235
  if self.deepcopy_library_for_every_field:
@@ -198,16 +240,23 @@ class SearchResultsCore(BasicInput):
198
240
  return keyword_field_number_dict_
199
241
 
200
242
  def _optimize_keywords_field(self, keywords_type, library, output_prefix, p_origin, p_separate, p_combine):
243
+ """Optimize search by keywords first, then fields.
244
+
245
+ Args:
246
+ keywords_type: Type of keywords to search.
247
+ library: Bibliography library to search.
248
+ output_prefix (str): Prefix for output files.
249
+ p_origin (str): Path to origin directory.
250
+ p_separate (str): Path to separate directory.
251
+ p_combine (str): Path to combine directory.
252
+
253
+ Returns:
254
+ dict: Dictionary containing keyword field numbers.
255
+ """
201
256
  no_search_library = library
202
257
 
203
258
  keyword_field_number_dict, no_search_library = self.core_optimize(
204
- self.search_field_list,
205
- keywords_type,
206
- no_search_library,
207
- output_prefix,
208
- p_origin,
209
- p_separate,
210
- p_combine,
259
+ self.search_field_list, keywords_type, no_search_library, output_prefix, p_origin, p_separate, p_combine
211
260
  )
212
261
  return keyword_field_number_dict
213
262
 
@@ -221,6 +270,20 @@ class SearchResultsCore(BasicInput):
221
270
  p_separate: str,
222
271
  p_combine: str,
223
272
  ) -> Tuple[Dict[str, Dict[str, int]], Library]:
273
+ """Core optimization method for processing search results.
274
+
275
+ Args:
276
+ search_field_list (List[str]): List of fields to search.
277
+ keywords_type: Type of keywords to search.
278
+ library (Library): Bibliography library to search.
279
+ output_prefix (str): Prefix for output files.
280
+ p_origin (str): Path to origin directory.
281
+ p_separate (str): Path to separate directory.
282
+ p_combine (str): Path to combine directory.
283
+
284
+ Returns:
285
+ Tuple[Dict[str, Dict[str, int]], Library]: Tuple containing keyword field numbers and remaining library.
286
+ """
224
287
  error_pandoc_md_md: List[str] = []
225
288
  save_field_data_dict: Dict[str, List[List[str]]] = {}
226
289
  keyword_field_number_dict: Dict[str, Dict[str, int]] = {}
@@ -290,7 +353,14 @@ class SearchResultsCore(BasicInput):
290
353
  return keyword_field_number_dict, no_search_library
291
354
 
292
355
  def delete_files(self, keywords_type: str, p_origin: str, p_separate: str, p_combine: str) -> None:
293
- """Delete some redundant files."""
356
+ """Delete redundant files after processing.
357
+
358
+ Args:
359
+ keywords_type (str): Type of keywords being processed.
360
+ p_origin (str): Path to origin directory.
361
+ p_separate (str): Path to separate directory.
362
+ p_combine (str): Path to combine directory.
363
+ """
294
364
  # for initial tex md bib
295
365
  if os.path.exists(p_origin):
296
366
  shutil.rmtree(p_origin)
@@ -4,12 +4,7 @@ import re
4
4
  from pathlib import Path
5
5
  from typing import Any, Dict, List
6
6
 
7
- from pyadvtools import (
8
- generate_nested_dict,
9
- read_list,
10
- standard_path,
11
- write_list,
12
- )
7
+ from pyadvtools import generate_nested_dict, read_list, standard_path, write_list
13
8
  from pybibtexer.tools.experiments_base import generate_standard_publisher_abbr_options_dict
14
9
 
15
10
  from ...main import PandocMdTo
@@ -20,22 +15,28 @@ from .utils import extract_information, temp_html_style
20
15
 
21
16
 
22
17
  class Searchkeywords(object):
23
- """Search.
18
+ """Search keywords in bibliography data.
24
19
 
25
20
  Args:
26
- path_storage (str): the path of storage journals or conferences
27
- path_output (str): the path of output journals or conferences
28
- options (dict): options
21
+ path_storage (str): Path to storage directory for journals or conferences.
22
+ path_output (str): Path to output directory for journals or conferences.
23
+ options (dict): Configuration options.
29
24
 
30
25
  Attributes:
31
- path_storage (str): the path of storage
32
- path_output (str): the path of output
33
- options (dict): options
34
-
35
- search_year_list (List[str] = []): search year list
26
+ path_storage (str): Path to storage directory.
27
+ path_output (str): Path to output directory.
28
+ options (dict): Configuration options.
29
+ search_year_list (List[str]): List of years to search. Defaults to [].
36
30
  """
37
31
 
38
32
  def __init__(self, path_storage: str, path_output: str, options: Dict[str, Any]) -> None:
33
+ """Initialize Searchkeywords with storage and output paths.
34
+
35
+ Args:
36
+ path_storage (str): Path to storage directory.
37
+ path_output (str): Path to output directory.
38
+ options (Dict[str, Any]): Configuration options.
39
+ """
39
40
  self.path_storage = standard_path(path_storage)
40
41
  self.path_output = standard_path(path_output)
41
42
 
@@ -64,6 +65,7 @@ class Searchkeywords(object):
64
65
  self._path_combine = self.path_output + "-Combine"
65
66
 
66
67
  def run(self) -> None:
68
+ """Run the keyword search process."""
67
69
  all_dict = {}
68
70
  publisher_abbr_dict = generate_standard_publisher_abbr_options_dict(self.path_storage, self.options)
69
71
  for publisher in publisher_abbr_dict:
@@ -196,7 +198,7 @@ class Searchkeywords(object):
196
198
  for file in nested_dict[entry_type][keywords_type][ext]:
197
199
  data_dict.setdefault(os.path.basename(file).split(".")[0], []).append(file)
198
200
 
199
- data_list = self._html_format(entry_type, data_dict, "Keywords", "separate")
201
+ data_list = self._html_format(entry_type, data_dict, "Keywords", "separate")
200
202
  write_list(data_list, f"{entry_type.lower()}_links.html", "w", self._path_separate, False)
201
203
  return None
202
204
 
@@ -2,36 +2,31 @@ import copy
2
2
  import os
3
3
  from typing import Dict, List, Tuple
4
4
 
5
- from pyadvtools import (
6
- combine_content_in_list,
7
- read_list,
8
- write_list,
9
- )
5
+ from pyadvtools import combine_content_in_list, read_list, write_list
10
6
  from pybibtexer.bib.bibtexparser import Library
11
7
  from pybibtexer.main import PythonWriters
12
8
 
13
9
  from ...main import BasicInput, PandocMdTo
14
- from ...tools.search.utils import (
15
- combine_keywords_for_file_name,
16
- combine_keywords_for_title,
17
- keywords_type_for_title,
18
- )
10
+ from ...tools.search.utils import combine_keywords_for_file_name, combine_keywords_for_title, keywords_type_for_title
19
11
 
20
12
 
21
13
  class WriteInitialResult(BasicInput):
22
14
  """Write initial results for single keyword.
23
15
 
24
16
  Args:
25
- options: dict
17
+ options (dict): Configuration options.
26
18
 
27
19
  Attributes:
28
- options (dict): options
20
+ options (dict): Configuration options.
29
21
  """
30
22
 
31
23
  def __init__(self, options: dict) -> None:
32
- super().__init__(options)
24
+ """Initialize WriteInitialResult with configuration options.
33
25
 
34
- self.options = options
26
+ Args:
27
+ options (dict): Configuration options.
28
+ """
29
+ super().__init__(options)
35
30
 
36
31
  self._level_title_md = "###"
37
32
  self._level_title_tex = "subsection"
@@ -48,6 +43,21 @@ class WriteInitialResult(BasicInput):
48
43
  library_for_zotero: Library,
49
44
  library_for_save: Library,
50
45
  ) -> Tuple[List[List[str]], List[str]]:
46
+ """Main method to write initial results.
47
+
48
+ Args:
49
+ path_initial (str): Path to initial directory.
50
+ output_prefix (str): Prefix for output files.
51
+ field (str): Field being searched.
52
+ keywords_type (str): Type of keywords.
53
+ combine_keywords (str): Combined keywords string.
54
+ library_for_abbr (Library): Abbreviated bibliography library.
55
+ library_for_zotero (Library): Zotero bibliography library.
56
+ library_for_save (Library): Save bibliography library.
57
+
58
+ Returns:
59
+ Tuple[List[List[str]], List[str]]: Tuple containing data and error messages.
60
+ """
51
61
  error_pandoc_md_md = []
52
62
 
53
63
  # generate
@@ -56,7 +66,7 @@ class WriteInitialResult(BasicInput):
56
66
  # update options
57
67
  _options = copy.deepcopy(self.options)
58
68
  _options["keep_entries_by_cite_keys"] = cite_keys
59
- _python_writer = PythonWriters(self.full_json_c, self.full_json_j, _options)
69
+ _python_writer = PythonWriters(_options)
60
70
 
61
71
  # generate tex and md data
62
72
  data_list_tex, data_list_md, header = self.generate_content_tex_md(
@@ -78,11 +88,7 @@ class WriteInitialResult(BasicInput):
78
88
  # pandoc md to generate md file
79
89
  path_bib = os.path.join(path_write, f"{file_prefix}{mid_list[2]}.bib") # bib_for_abbr
80
90
  data_list_pandoc_md = self._pandoc_md_to.pandoc_md_to_md(
81
- path_bib,
82
- path_write,
83
- path_write,
84
- f"{file_prefix}.md",
85
- f"{file_prefix}-pandoc.md",
91
+ path_bib, path_write, path_write, f"{file_prefix}.md", f"{file_prefix}-pandoc.md"
86
92
  )
87
93
 
88
94
  # mian part
@@ -111,11 +117,22 @@ class WriteInitialResult(BasicInput):
111
117
  def generate_basic_beauty_complex_md(
112
118
  self, header: str, cite_key_list: List[str], data_list_pandoc_md: List[str], library_for_zotero: Library
113
119
  ) -> Tuple[List[str], List[str], List[str]]:
120
+ """Generate basic, beauty, and complex markdown content.
121
+
122
+ Args:
123
+ header (str): Header string for the content.
124
+ cite_key_list (List[str]): List of citation keys.
125
+ data_list_pandoc_md (List[str]): List of pandoc markdown data.
126
+ library_for_zotero (Library): Zotero bibliography library.
127
+
128
+ Returns:
129
+ Tuple[List[str], List[str], List[str]]: Tuple containing basic, beauty, and complex markdown content.
130
+ """
114
131
  data_basic_md, data_beauty_md, data_complex_md = [], [], []
115
132
 
116
133
  # library
117
134
  _options = copy.deepcopy(self.options)
118
- _python_writer = PythonWriters(self.full_json_c, self.full_json_j, _options)
135
+ _python_writer = PythonWriters(_options)
119
136
  key_url_http_bib_dict = _python_writer.output_key_url_http_bib_dict(library_for_zotero)
120
137
 
121
138
  key_basic_dict, key_beauty_dict, key_complex_dict = self._pandoc_md_to.generate_key_data_dict(
@@ -136,6 +153,14 @@ class WriteInitialResult(BasicInput):
136
153
 
137
154
  @staticmethod
138
155
  def _convert_to_special_list(data_list: List[str]) -> List[str]:
156
+ """Convert data list to special formatted list.
157
+
158
+ Args:
159
+ data_list (List[str]): List of data strings.
160
+
161
+ Returns:
162
+ List[str]: Formatted list with proper indentation.
163
+ """
139
164
  if len(data_list) > 0:
140
165
  data_list[0] = "- " + data_list[0]
141
166
  for j in range(len(data_list) - 1):
@@ -146,7 +171,17 @@ class WriteInitialResult(BasicInput):
146
171
  def generate_content_tex_md(
147
172
  self, cite_key_list: List[str], output_prefix: str, field: str, combine_keywords: str
148
173
  ) -> Tuple[List[str], List[str], str]:
149
- """Generate."""
174
+ """Generate LaTeX and markdown content.
175
+
176
+ Args:
177
+ cite_key_list (List[str]): List of citation keys.
178
+ output_prefix (str): Prefix for output files.
179
+ field (str): Field being searched.
180
+ combine_keywords (str): Combined keywords string.
181
+
182
+ Returns:
183
+ Tuple[List[str], List[str], str]: Tuple containing LaTeX content, markdown content, and header.
184
+ """
150
185
  c_k_f_t = combine_keywords_for_title(combine_keywords)
151
186
 
152
187
  number_references = len(cite_key_list)
@@ -164,15 +199,25 @@ class WriteInitialResult(BasicInput):
164
199
 
165
200
 
166
201
  class WriteSeparateResult(object):
167
- """Write separate result."""
202
+ """Write separate result for different keyword types."""
168
203
 
169
204
  def __init__(self) -> None:
205
+ """Initialize WriteSeparateResult with title levels."""
170
206
  self._level_title_md = "##"
171
207
  self._level_title_tex = "section"
172
208
 
173
209
  def main(
174
210
  self, data_temp: List[List[str]], field: str, keywords_type: str, combine_keywords: str, path_separate: str
175
211
  ) -> None:
212
+ """Main method to write separate results.
213
+
214
+ Args:
215
+ data_temp (List[List[str]]): List of data lists for different file types.
216
+ field (str): Field being processed.
217
+ keywords_type (str): Type of keywords.
218
+ combine_keywords (str): Combined keywords string.
219
+ path_separate (str): Path to separate directory.
220
+ """
176
221
  k_t_f_t = keywords_type_for_title(keywords_type)
177
222
  _title = f"{field.title()} contains {k_t_f_t}"
178
223
 
@@ -199,23 +244,27 @@ class WriteSeparateResult(object):
199
244
 
200
245
 
201
246
  class WriteAbbrCombinedResults(object):
202
- """Write combined results for abbr (such as `TEVC`, `PNAS`).
247
+ """Write combined results for abbreviations (such as `TEVC`, `PNAS`).
203
248
 
204
249
  Args:
205
- options: dict
250
+ options (dict): Configuration options.
206
251
 
207
252
  Attributes:
208
- options (dict): options
209
- pandoc_md_basic_to_pdf (bool): whether to convert basic md to pdf
210
- pandoc_md_beauty_to_pdf (bool): whether to convert beauty md to pdf
211
- pandoc_md_complex_to_pdf (bool): whether to convert complex md to pdf
212
- pandoc_md_basic_to_html (bool): whether to convert basic md to html
213
- pandoc_md_beauty_to_html (bool): whether to convert beauty md to html
214
- pandoc_md_complex_to_html (bool): whether to convert complex md to html
215
-
253
+ options (dict): Configuration options.
254
+ pandoc_md_basic_to_pdf (bool): Whether to convert basic markdown to PDF.
255
+ pandoc_md_beauty_to_pdf (bool): Whether to convert beauty markdown to PDF.
256
+ pandoc_md_complex_to_pdf (bool): Whether to convert complex markdown to PDF.
257
+ pandoc_md_basic_to_html (bool): Whether to convert basic markdown to HTML.
258
+ pandoc_md_beauty_to_html (bool): Whether to convert beauty markdown to HTML.
259
+ pandoc_md_complex_to_html (bool): Whether to convert complex markdown to HTML.
216
260
  """
217
261
 
218
262
  def __init__(self, options: dict) -> None:
263
+ """Initialize WriteAbbrCombinedResults with configuration options.
264
+
265
+ Args:
266
+ options (dict): Configuration options.
267
+ """
219
268
  self.pandoc_md_basic_to_pdf: bool = options.get("pandoc_md_basic_to_pdf", False)
220
269
  self.pandoc_md_beauty_to_pdf: bool = options.get("pandoc_md_beauty_to_pdf", False)
221
270
  self.pandoc_md_complex_to_pdf: bool = options.get("pandoc_md_complex_to_pdf", False)
@@ -230,6 +279,17 @@ class WriteAbbrCombinedResults(object):
230
279
  def main(
231
280
  self, search_field_list, keywords_type: str, field_data_dict: Dict[str, List[List[str]]], path_combine: str
232
281
  ) -> Tuple[List[str], List[str]]:
282
+ """Main method to write combined results for abbreviations.
283
+
284
+ Args:
285
+ search_field_list: List of search fields.
286
+ keywords_type (str): Type of keywords.
287
+ field_data_dict (Dict[str, List[List[str]]]): Dictionary containing field data.
288
+ path_combine (str): Path to combine directory.
289
+
290
+ Returns:
291
+ Tuple[List[str], List[str]]: Tuple containing error messages for PDF and HTML conversion.
292
+ """
233
293
  path_subsection = os.path.join(path_combine, "tex-subsection")
234
294
  path_md = os.path.join(path_combine, "md")
235
295
  path_bib = os.path.join(path_combine, "bib")
@@ -284,7 +344,7 @@ class WriteAbbrCombinedResults(object):
284
344
  os.path.join(path_combine, f"html-{i}"),
285
345
  f"{file_prefix}-{i}.md",
286
346
  f"{file_prefix}-{i}.html",
287
- True
347
+ True,
288
348
  )
289
349
  if error_flag_html:
290
350
  error_pandoc_md_html.append(error_flag_html)
@@ -2,19 +2,20 @@ import os
2
2
  import re
3
3
  from typing import Dict, List, Tuple, Union
4
4
 
5
- from pyadvtools import (
6
- IterateSortDict,
7
- is_list_contain_list_contain_str,
8
- is_list_contain_str,
9
- write_list,
10
- )
5
+ from pyadvtools import IterateSortDict, is_list_contain_list_contain_str, is_list_contain_str, write_list
11
6
 
12
7
 
13
8
  def switch_keywords_list(xx: Union[List[str], List[List[str]]]) -> Tuple[List[List[str]], str]:
14
- """Switch keyword.
9
+ """Switch keyword list format and generate combined keywords string.
15
10
 
16
- Input: ["evolutionary", "algorithm"] or [["evolution"], ["evolutionary"]]
17
- Output: [["evolutionary", "algorithm"]] or [["evolution"], ["evolutionary"]]
11
+ Args:
12
+ xx (Union[List[str], List[List[str]]]): Input keyword list or nested keyword list.
13
+ Examples: ["evolutionary", "algorithm"] or [["evolution"], ["evolutionary"]]
14
+
15
+ Returns:
16
+ Tuple[List[List[str]], str]: Tuple containing:
17
+ - List of keyword lists with regex word boundaries
18
+ - Combined keywords string for file naming
18
19
  """
19
20
  yyy: List[List[str]] = [[]]
20
21
 
@@ -54,6 +55,14 @@ def switch_keywords_list(xx: Union[List[str], List[List[str]]]) -> Tuple[List[Li
54
55
 
55
56
 
56
57
  def combine_keywords_for_title(combine_keywords: str) -> str:
58
+ """Convert combined keywords string to human-readable title format.
59
+
60
+ Args:
61
+ combine_keywords (str): Combined keywords string with special characters.
62
+
63
+ Returns:
64
+ str: Human-readable title format with proper spacing and punctuation.
65
+ """
57
66
  combine_keywords = combine_keywords.replace("_without_", " without ")
58
67
  combine_keywords = combine_keywords.replace("_and_", "; ")
59
68
  combine_keywords = combine_keywords.replace("0", "")
@@ -66,6 +75,14 @@ def combine_keywords_for_title(combine_keywords: str) -> str:
66
75
 
67
76
 
68
77
  def combine_keywords_for_file_name(combine_keywords: str) -> str:
78
+ """Convert combined keywords string to valid file name format.
79
+
80
+ Args:
81
+ combine_keywords (str): Combined keywords string.
82
+
83
+ Returns:
84
+ str: File name safe string with underscores and hyphens.
85
+ """
69
86
  combine_keywords = combine_keywords_for_title(combine_keywords)
70
87
  combine_keywords = combine_keywords.replace("/", "-")
71
88
  combine_keywords = combine_keywords.replace("; ", "_and_")
@@ -74,6 +91,14 @@ def combine_keywords_for_file_name(combine_keywords: str) -> str:
74
91
 
75
92
 
76
93
  def switch_keywords_type(keywords_type: str) -> str:
94
+ """Normalize keywords type string for consistent formatting.
95
+
96
+ Args:
97
+ keywords_type (str): Keywords type string to normalize.
98
+
99
+ Returns:
100
+ str: Normalized keywords type with consistent separators.
101
+ """
77
102
  keywords_type = keywords_type.replace("/", "-")
78
103
  keywords_type = keywords_type.replace(" ", "_")
79
104
  keywords_type = re.sub(r"-+", "-", keywords_type)
@@ -82,11 +107,25 @@ def switch_keywords_type(keywords_type: str) -> str:
82
107
 
83
108
 
84
109
  def keywords_type_for_title(keywords_type: str) -> str:
110
+ """Convert keywords type string to title format.
111
+
112
+ Args:
113
+ keywords_type (str): Keywords type string with underscores.
114
+
115
+ Returns:
116
+ str: Title format with spaces instead of underscores.
117
+ """
85
118
  keywords_type = keywords_type.replace("_", " ")
86
119
  return keywords_type.strip()
87
120
 
88
121
 
89
122
  def extract_information(old_dict: Dict[str, Dict[str, Dict[str, Dict[str, Dict[str, int]]]]], path_output: str) -> None:
123
+ """Extract and organize search information into markdown tables.
124
+
125
+ Args:
126
+ old_dict (Dict[str, Dict[str, Dict[str, Dict[str, Dict[str, int]]]]]): Nested dictionary containing search results.
127
+ path_output (str): Output directory path for generated markdown files.
128
+ """
90
129
  new_dict: Dict[str, Dict[str, Dict[str, Dict[str, Dict[str, int]]]]] = {}
91
130
 
92
131
  for abbr in old_dict:
pyeasyphd/utils/utils.py CHANGED
@@ -1,11 +1,7 @@
1
1
  import os
2
2
  import re
3
3
 
4
- from pyadvtools import (
5
- combine_content_in_list,
6
- read_list,
7
- write_list,
8
- )
4
+ from pyadvtools import combine_content_in_list, read_list, write_list
9
5
 
10
6
  html_head = """<!DOCTYPE html>
11
7
  <html>
@@ -47,10 +43,15 @@ textarea_tail = "\n</textarea>"
47
43
 
48
44
 
49
45
  def operate_on_generate_html(html_name: str) -> None:
46
+ """Operate on generated HTML file to add styling and functionality.
47
+
48
+ Args:
49
+ html_name (str): Name of the HTML file to process.
50
+ """
50
51
  if not (data_list := read_list(html_name, "r", None)):
51
52
  return None
52
53
 
53
- head_list = [html_head.format(os.path.basename(html_name).split('.')[0].strip()), html_style, "\n"]
54
+ head_list = [html_head.format(os.path.basename(html_name).split(".")[0].strip()), html_style, "\n"]
54
55
  tail_list = [html_tail]
55
56
 
56
57
  content = "".join(data_list)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyeasyphd
3
- Version: 0.1.2
3
+ Version: 0.1.6
4
4
  Summary: pyeasyphd
5
5
  License: GPL-3.0-or-later
6
6
  Keywords: Python,Markdown,LaTex
@@ -14,8 +14,8 @@ Classifier: Programming Language :: Python :: 3
14
14
  Classifier: Programming Language :: Python :: 3.13
15
15
  Classifier: Programming Language :: Python :: 3.14
16
16
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
- Requires-Dist: pyadvtools (>=0.0.5,<0.0.6)
18
- Requires-Dist: pybibtexer (>=0.0.3,<0.0.4)
17
+ Requires-Dist: pyadvtools (>=0.1.5,<0.2.0)
18
+ Requires-Dist: pybibtexer (>=0.1.6,<0.2.0)
19
19
  Project-URL: Documentation, https://github.com/NextArtifIntell/pyeasyphd
20
20
  Project-URL: Homepage, https://github.com/NextArtifIntell/pyeasyphd
21
21
  Project-URL: Repository, https://github.com/NextArtifIntell/pyeasyphd