pyeasyphd 0.4.12__py3-none-any.whl → 0.4.13__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.
- pyeasyphd/main/basic_input.py +17 -17
- pyeasyphd/main/pandoc_md_to.py +30 -31
- pyeasyphd/main/python_run_md.py +30 -31
- pyeasyphd/main/python_run_tex.py +17 -17
- pyeasyphd/pyeasyphd.py +1 -1
- pyeasyphd/scripts/_base.py +15 -17
- pyeasyphd/scripts/run_article_md.py +12 -11
- pyeasyphd/scripts/run_article_tex.py +12 -12
- pyeasyphd/scripts/run_beamer_tex.py +12 -12
- pyeasyphd/scripts/run_compare.py +2 -4
- pyeasyphd/scripts/run_format.py +2 -4
- pyeasyphd/scripts/run_replace.py +3 -6
- pyeasyphd/scripts/run_search.py +10 -16
- pyeasyphd/tools/generate/generate_from_bibs.py +23 -17
- pyeasyphd/tools/generate/generate_html.py +20 -16
- pyeasyphd/tools/generate/generate_library.py +27 -24
- pyeasyphd/tools/generate/generate_links.py +30 -31
- pyeasyphd/tools/py_run_bib_md_tex.py +38 -31
- pyeasyphd/tools/search/data.py +3 -3
- pyeasyphd/tools/search/search_base.py +12 -13
- pyeasyphd/tools/search/search_core.py +32 -29
- pyeasyphd/tools/search/search_keywords.py +6 -6
- pyeasyphd/tools/search/search_writers.py +29 -30
- pyeasyphd/tools/search/utils.py +9 -10
- pyeasyphd/utils/utils.py +1 -2
- {pyeasyphd-0.4.12.dist-info → pyeasyphd-0.4.13.dist-info}/METADATA +1 -1
- pyeasyphd-0.4.13.dist-info/RECORD +53 -0
- pyeasyphd-0.4.12.dist-info/RECORD +0 -53
- {pyeasyphd-0.4.12.dist-info → pyeasyphd-0.4.13.dist-info}/WHEEL +0 -0
- {pyeasyphd-0.4.12.dist-info → pyeasyphd-0.4.13.dist-info}/licenses/LICENSE +0 -0
|
@@ -4,6 +4,8 @@ from pyadvtools import GitAutoCommitter
|
|
|
4
4
|
|
|
5
5
|
from pyeasyphd.tools import PyRunBibMdTex
|
|
6
6
|
|
|
7
|
+
from ._base import expand_path
|
|
8
|
+
|
|
7
9
|
|
|
8
10
|
def run_article_tex_submit(
|
|
9
11
|
path_input_file: str,
|
|
@@ -13,8 +15,7 @@ def run_article_tex_submit(
|
|
|
13
15
|
path_conf_j_jsons: str,
|
|
14
16
|
options: dict,
|
|
15
17
|
) -> None:
|
|
16
|
-
"""
|
|
17
|
-
Process academic article files (TeX, and bibliography) with automated Git version control.
|
|
18
|
+
"""Process academic article files (TeX, and bibliography) with automated Git version control.
|
|
18
19
|
|
|
19
20
|
This function handles the conversion and processing of academic article files including TeX documents, and
|
|
20
21
|
bibliography management with automatic Git commit and push capabilities.
|
|
@@ -23,7 +24,7 @@ def run_article_tex_submit(
|
|
|
23
24
|
|
|
24
25
|
Args:
|
|
25
26
|
path_input_file (str): Path to input files directory
|
|
26
|
-
input_file_names (list[str]):
|
|
27
|
+
input_file_names (list[str]): list of input file names
|
|
27
28
|
path_output_file (str): Path to output directory
|
|
28
29
|
bib_path_or_file (str): Path to bibliography file or directory
|
|
29
30
|
path_conf_j_jsons (str): Path to conferences and journals JSON files directory
|
|
@@ -32,13 +33,13 @@ def run_article_tex_submit(
|
|
|
32
33
|
Returns:
|
|
33
34
|
None
|
|
34
35
|
"""
|
|
35
|
-
path_input_file =
|
|
36
|
-
path_output_file =
|
|
36
|
+
path_input_file = expand_path(path_input_file)
|
|
37
|
+
path_output_file = expand_path(path_output_file)
|
|
37
38
|
|
|
38
39
|
# Initialize default options with detailed descriptions
|
|
39
40
|
_options = {
|
|
40
|
-
"full_json_c":
|
|
41
|
-
"full_json_j":
|
|
41
|
+
"full_json_c": expand_path(os.path.join(path_conf_j_jsons, "conferences.json")),
|
|
42
|
+
"full_json_j": expand_path(os.path.join(path_conf_j_jsons, "journals.json")),
|
|
42
43
|
# figure options
|
|
43
44
|
"includegraphics_figs_directory": os.path.join(path_input_file, "data", "raw"),
|
|
44
45
|
"shutil_includegraphics_figs": True,
|
|
@@ -50,13 +51,12 @@ def run_article_tex_submit(
|
|
|
50
51
|
"add_link_to_fields_for_abbr": None, # None, or ["title", "journal", "booktitle"]
|
|
51
52
|
"maximum_authors_for_abbr": 0, # 0, 1, 2, ...
|
|
52
53
|
"add_index_to_entries": False,
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"display_google_connected_scite": ["google", "connected", "scite"],
|
|
54
|
+
"bib_name_for_abbr": "abbr.bib",
|
|
55
|
+
"bib_name_for_zotero": "zotero.bib",
|
|
56
|
+
"bib_name_for_save": "save.bib",
|
|
57
57
|
"bib_folder_name": "bibs", # "" or "bib" or "bibs" or "main"
|
|
58
58
|
"delete_original_bib_in_output_folder": False,
|
|
59
|
-
"bib_path_or_file":
|
|
59
|
+
"bib_path_or_file": expand_path(bib_path_or_file),
|
|
60
60
|
# tex options
|
|
61
61
|
"handly_preamble": True,
|
|
62
62
|
"final_output_main_tex_name": "main.tex",
|
|
@@ -2,6 +2,8 @@ import os
|
|
|
2
2
|
|
|
3
3
|
from pyeasyphd.tools import PyRunBibMdTex
|
|
4
4
|
|
|
5
|
+
from ._base import expand_path
|
|
6
|
+
|
|
5
7
|
|
|
6
8
|
def run_beamer_tex_weekly_reports(
|
|
7
9
|
path_input_file: str,
|
|
@@ -11,8 +13,7 @@ def run_beamer_tex_weekly_reports(
|
|
|
11
13
|
path_conf_j_jsons: str,
|
|
12
14
|
options: dict,
|
|
13
15
|
) -> None:
|
|
14
|
-
"""
|
|
15
|
-
Process academic article files (TeX, and bibliography) with automated Git version control.
|
|
16
|
+
"""Process academic article files (TeX, and bibliography) with automated Git version control.
|
|
16
17
|
|
|
17
18
|
This function handles the conversion and processing of academic article files including TeX documents, and
|
|
18
19
|
bibliography management with automatic Git commit and push capabilities.
|
|
@@ -21,7 +22,7 @@ def run_beamer_tex_weekly_reports(
|
|
|
21
22
|
|
|
22
23
|
Args:
|
|
23
24
|
path_input_file (str): Path to input files directory
|
|
24
|
-
input_file_names (list[str]):
|
|
25
|
+
input_file_names (list[str]): list of input file names
|
|
25
26
|
path_output_file (str): Path to output directory
|
|
26
27
|
bib_path_or_file (str): Path to bibliography file or directory
|
|
27
28
|
path_conf_j_jsons (str): Path to conferences and journals JSON files directory
|
|
@@ -30,13 +31,13 @@ def run_beamer_tex_weekly_reports(
|
|
|
30
31
|
Returns:
|
|
31
32
|
None
|
|
32
33
|
"""
|
|
33
|
-
path_input_file =
|
|
34
|
-
path_output_file =
|
|
34
|
+
path_input_file = expand_path(path_input_file)
|
|
35
|
+
path_output_file = expand_path(path_output_file)
|
|
35
36
|
|
|
36
37
|
# Initialize default options with detailed descriptions
|
|
37
38
|
_options = {
|
|
38
|
-
"full_json_c":
|
|
39
|
-
"full_json_j":
|
|
39
|
+
"full_json_c": expand_path(os.path.join(path_conf_j_jsons, "conferences.json")),
|
|
40
|
+
"full_json_j": expand_path(os.path.join(path_conf_j_jsons, "journals.json")),
|
|
40
41
|
# figure options
|
|
41
42
|
"includegraphics_figs_directory": "",
|
|
42
43
|
"shutil_includegraphics_figs": True,
|
|
@@ -48,13 +49,12 @@ def run_beamer_tex_weekly_reports(
|
|
|
48
49
|
"add_link_to_fields_for_abbr": None, # None, or ["title", "journal", "booktitle"]
|
|
49
50
|
"maximum_authors_for_abbr": 0, # 0, 1, 2, ...
|
|
50
51
|
"add_index_to_entries": False,
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"display_google_connected_scite": ["google", "connected", "scite"],
|
|
52
|
+
"bib_name_for_abbr": "abbr.bib",
|
|
53
|
+
"bib_name_for_zotero": "zotero.bib",
|
|
54
|
+
"bib_name_for_save": "save.bib",
|
|
55
55
|
"bib_folder_name": "bibs", # "" or "bib" or "bibs" or "main"
|
|
56
56
|
"delete_original_bib_in_output_folder": False,
|
|
57
|
-
"bib_path_or_file":
|
|
57
|
+
"bib_path_or_file": expand_path(bib_path_or_file),
|
|
58
58
|
# tex options
|
|
59
59
|
"handly_preamble": True,
|
|
60
60
|
"final_output_main_tex_name": "main.tex",
|
pyeasyphd/scripts/run_compare.py
CHANGED
|
@@ -11,8 +11,7 @@ def run_compare_bib_with_local(
|
|
|
11
11
|
path_spidering_bibs: str,
|
|
12
12
|
path_conf_j_jsons: str,
|
|
13
13
|
) -> None:
|
|
14
|
-
"""
|
|
15
|
-
Compare a target bibliography file with local bibliography collections and generate comparison results.
|
|
14
|
+
"""Compare a target bibliography file with local bibliography collections and generate comparison results.
|
|
16
15
|
|
|
17
16
|
This function performs a comprehensive comparison between a specified bibliography file and
|
|
18
17
|
existing local bibliography collections. Results are saved to the specified output directory.
|
|
@@ -46,8 +45,7 @@ def run_compare_bib_with_local(
|
|
|
46
45
|
def run_compare_bib_with_zotero(
|
|
47
46
|
options: dict, need_compare_bib: str, zotero_bib: str, path_output: str, path_conf_j_jsons: str
|
|
48
47
|
) -> None:
|
|
49
|
-
"""
|
|
50
|
-
Compare a target bibliography file with Zotero bibliography data and generate comparison results.
|
|
48
|
+
"""Compare a target bibliography file with Zotero bibliography data and generate comparison results.
|
|
51
49
|
|
|
52
50
|
This function performs comparison between a specified bibliography file and Zotero bibliography data,
|
|
53
51
|
identifying matches, differences, and potential conflicts between the two sources.
|
pyeasyphd/scripts/run_format.py
CHANGED
|
@@ -8,8 +8,7 @@ from ._base import build_base_options, expand_paths
|
|
|
8
8
|
def run_format_bib_to_save_by_entry_type(
|
|
9
9
|
options: dict, need_format_bib: str, path_output: str, path_conf_j_jsons: str
|
|
10
10
|
) -> None:
|
|
11
|
-
"""
|
|
12
|
-
Format a bibliography file by organizing entries according to their entry types and save the results.
|
|
11
|
+
"""Format a bibliography file by organizing entries according to their entry types and save the results.
|
|
13
12
|
|
|
14
13
|
This function processes a bibliography file and reorganizes the entries based on their
|
|
15
14
|
bibliographic entry types (e.g., article, conference, book, etc.), creating separate
|
|
@@ -37,8 +36,7 @@ def run_format_bib_to_save_by_entry_type(
|
|
|
37
36
|
def run_format_bib_to_abbr_zotero_save(
|
|
38
37
|
options: dict, need_format_bib: str, path_output: str, path_conf_j_jsons: str
|
|
39
38
|
) -> None:
|
|
40
|
-
"""
|
|
41
|
-
Format a bibliography file into three different modes: abbreviated, Zotero-compatible, and cleaned source.
|
|
39
|
+
"""Format a bibliography file into three different modes: abbreviated, Zotero-compatible, and cleaned source.
|
|
42
40
|
|
|
43
41
|
This function processes a bibliography file and generates three formatted versions:
|
|
44
42
|
1. Abbreviated version: Journal/conference names are abbreviated according to standard rules
|
pyeasyphd/scripts/run_replace.py
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
from typing import Optional
|
|
2
|
-
|
|
3
1
|
from pybibtexer.tools import replace_to_standard_cite_keys
|
|
4
2
|
|
|
5
3
|
from ._base import build_base_options, expand_paths
|
|
6
4
|
|
|
7
5
|
|
|
8
6
|
def run_replace_to_standard_cite_keys(
|
|
9
|
-
full_tex_md: str, full_bib: str, path_output: str, path_conf_j_jsons: str, options:
|
|
7
|
+
full_tex_md: str, full_bib: str, path_output: str, path_conf_j_jsons: str, options: dict | None = None
|
|
10
8
|
) -> None:
|
|
11
|
-
"""
|
|
12
|
-
Replace citation keys in LaTeX documents with standardized versions.
|
|
9
|
+
"""Replace citation keys in LaTeX documents with standardized versions.
|
|
13
10
|
|
|
14
11
|
Processes LaTeX and BibTeX files to normalize citation keys according to
|
|
15
12
|
configuration standards, then outputs the results to the specified location.
|
|
16
13
|
|
|
17
14
|
Args:
|
|
18
|
-
options:
|
|
15
|
+
options: dictionary of configuration options for citation processing
|
|
19
16
|
full_tex_md: Path to TeX or Markdown file containing citations
|
|
20
17
|
full_bib: Path to the BibTeX bibliography file
|
|
21
18
|
path_output: Output directory path for processed files
|
pyeasyphd/scripts/run_search.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
|
-
from typing import Any
|
|
2
|
+
from typing import Any
|
|
3
3
|
|
|
4
4
|
from pyadvtools import transform_to_data_list
|
|
5
5
|
from pybibtexer.tools import compare_bibs_with_zotero
|
|
@@ -12,8 +12,7 @@ from ._base import build_base_options, build_search_options, expand_path, expand
|
|
|
12
12
|
def run_search_for_screen(
|
|
13
13
|
acronym: str, year: int, title: str, path_spidered_bibs: str, path_spidering_bibs: str, path_conf_j_jsons: str
|
|
14
14
|
) -> None:
|
|
15
|
-
"""
|
|
16
|
-
Run search for screen display with specific conference/journal parameters.
|
|
15
|
+
"""Run search for screen display with specific conference/journal parameters.
|
|
17
16
|
|
|
18
17
|
Args:
|
|
19
18
|
acronym: Conference/journal acronym to search for
|
|
@@ -58,17 +57,16 @@ def run_search_for_screen(
|
|
|
58
57
|
|
|
59
58
|
def run_search_for_files(
|
|
60
59
|
keywords_type: str,
|
|
61
|
-
keywords_list_list:
|
|
60
|
+
keywords_list_list: list[list[str]],
|
|
62
61
|
path_main_output: str,
|
|
63
62
|
path_spidered_bibs: str,
|
|
64
63
|
path_spidering_bibs: str,
|
|
65
64
|
path_conf_j_jsons: str,
|
|
66
65
|
search_in_spidered_bibs: bool = False,
|
|
67
66
|
search_in_spidering_bibs: bool = True,
|
|
68
|
-
options:
|
|
67
|
+
options: dict | None = None,
|
|
69
68
|
) -> None:
|
|
70
|
-
"""
|
|
71
|
-
Run search and save results to files with custom keywords.
|
|
69
|
+
"""Run search and save results to files with custom keywords.
|
|
72
70
|
|
|
73
71
|
Args:
|
|
74
72
|
keywords_type: Category name for the search keywords (used for organizing results)
|
|
@@ -124,15 +122,14 @@ def run_search_for_files(
|
|
|
124
122
|
|
|
125
123
|
|
|
126
124
|
def _execute_searches(
|
|
127
|
-
options:
|
|
125
|
+
options: dict[str, Any],
|
|
128
126
|
path_main_output: str,
|
|
129
127
|
path_spidered_bibs: str,
|
|
130
128
|
path_spidering_bibs: str,
|
|
131
129
|
search_in_spidered_bibs: bool = False,
|
|
132
130
|
search_in_spidering_bibs: bool = True,
|
|
133
131
|
) -> None:
|
|
134
|
-
"""
|
|
135
|
-
Execute searches across different bibliography sources.
|
|
132
|
+
"""Execute searches across different bibliography sources.
|
|
136
133
|
|
|
137
134
|
Args:
|
|
138
135
|
options: Search configuration options
|
|
@@ -168,8 +165,7 @@ def _execute_searches(
|
|
|
168
165
|
|
|
169
166
|
|
|
170
167
|
def run_compare_after_search(zotero_bib: str, keywords_type: str, path_main_output: str, path_conf_j_jsons: str):
|
|
171
|
-
"""
|
|
172
|
-
Compare search results with Zotero bibliography and generate comparison report.
|
|
168
|
+
"""Compare search results with Zotero bibliography and generate comparison report.
|
|
173
169
|
|
|
174
170
|
Args:
|
|
175
171
|
zotero_bib: Path to Zotero bibliography file
|
|
@@ -207,8 +203,7 @@ def run_compare_after_search(zotero_bib: str, keywords_type: str, path_main_outp
|
|
|
207
203
|
|
|
208
204
|
|
|
209
205
|
def _generate_data_list(path_output: str, folder_name: str, keywords_type: str) -> list[str]:
|
|
210
|
-
"""
|
|
211
|
-
Extract bibliography data content from files in specified folder structure.
|
|
206
|
+
"""Extract bibliography data content from files in specified folder structure.
|
|
212
207
|
|
|
213
208
|
Args:
|
|
214
209
|
path_output: Base output path for search results
|
|
@@ -232,8 +227,7 @@ def _generate_data_list(path_output: str, folder_name: str, keywords_type: str)
|
|
|
232
227
|
|
|
233
228
|
|
|
234
229
|
def _download_bib_from_local(path_output: str, keywords_type: str) -> list[str]:
|
|
235
|
-
"""
|
|
236
|
-
Collect bibliography data content from all local search result directories.
|
|
230
|
+
"""Collect bibliography data content from all local search result directories.
|
|
237
231
|
|
|
238
232
|
Args:
|
|
239
233
|
path_output: Base output path containing search results
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import re
|
|
3
|
-
from typing import Any
|
|
3
|
+
from typing import Any
|
|
4
4
|
|
|
5
5
|
from pyadvtools import standard_path, write_list
|
|
6
6
|
from pybibtexer.tools.experiments_base import generate_standard_publisher_abbr_options_dict
|
|
@@ -15,9 +15,9 @@ def preparation(
|
|
|
15
15
|
path_output: str,
|
|
16
16
|
output_basename: str,
|
|
17
17
|
pub_type: str,
|
|
18
|
-
issue_or_month_flag:
|
|
19
|
-
year_flag:
|
|
20
|
-
options:
|
|
18
|
+
issue_or_month_flag: str | list[str] = "current_issue",
|
|
19
|
+
year_flag: str | list[str] = "current_year",
|
|
20
|
+
options: dict[str, Any] | None = None,
|
|
21
21
|
):
|
|
22
22
|
"""Prepare paths and flags for data generation.
|
|
23
23
|
|
|
@@ -26,9 +26,9 @@ def preparation(
|
|
|
26
26
|
path_output (str): Path to output directory.
|
|
27
27
|
output_basename (str): Base name for output files.
|
|
28
28
|
pub_type (str): Type of publication.
|
|
29
|
-
issue_or_month_flag (
|
|
30
|
-
year_flag (
|
|
31
|
-
options (
|
|
29
|
+
issue_or_month_flag (str | list[str], optional): Issue or month flag. Defaults to "current_issue".
|
|
30
|
+
year_flag (str | list[str], optional): Year flag. Defaults to "current_year".
|
|
31
|
+
options (dict[str, Any], optional): Additional options. Defaults to {}.
|
|
32
32
|
|
|
33
33
|
Examples:
|
|
34
34
|
| | current_issue | current_month | all_months |
|
|
@@ -40,8 +40,11 @@ def preparation(
|
|
|
40
40
|
given_years = ["2020", "2025"]
|
|
41
41
|
|
|
42
42
|
Returns:
|
|
43
|
-
|
|
43
|
+
tuple[str, str, bool]: Returns (path_root, path_output, combine_flag).
|
|
44
44
|
"""
|
|
45
|
+
if options is None:
|
|
46
|
+
options = {}
|
|
47
|
+
|
|
45
48
|
# default settings
|
|
46
49
|
path_storage = standard_path(path_storage)
|
|
47
50
|
path_output = standard_path(path_output)
|
|
@@ -50,8 +53,8 @@ def preparation(
|
|
|
50
53
|
absolute_or_relative_path = options.get("absolute_or_relative_path", "absolute_path")
|
|
51
54
|
|
|
52
55
|
# Create path components
|
|
53
|
-
yy = "-".join(year_flag) if isinstance(year_flag,
|
|
54
|
-
im = "-".join(issue_or_month_flag) if isinstance(issue_or_month_flag,
|
|
56
|
+
yy = "-".join(year_flag) if isinstance(year_flag, list) else year_flag
|
|
57
|
+
im = "-".join(issue_or_month_flag) if isinstance(issue_or_month_flag, list) else issue_or_month_flag
|
|
55
58
|
|
|
56
59
|
if options.get("early_access", False):
|
|
57
60
|
base_path = os.path.join(output_basename, f"{pub_type.title()}_Early_Access", f"{yy}_{im}")
|
|
@@ -77,9 +80,9 @@ def generate_from_bibs_and_write(
|
|
|
77
80
|
output_basename: str,
|
|
78
81
|
pub_type: str,
|
|
79
82
|
generate_or_combine: str,
|
|
80
|
-
year_flag:
|
|
81
|
-
issue_or_month_flag:
|
|
82
|
-
options:
|
|
83
|
+
year_flag: str | list[str] = "current_year",
|
|
84
|
+
issue_or_month_flag: str | list[str] = "current_issue",
|
|
85
|
+
options: dict[str, Any] | None = None,
|
|
83
86
|
) -> None:
|
|
84
87
|
"""Generate or combine data from bibliographies.
|
|
85
88
|
|
|
@@ -89,10 +92,13 @@ def generate_from_bibs_and_write(
|
|
|
89
92
|
output_basename (str): Base name for output files.
|
|
90
93
|
pub_type (str): Type of publication.
|
|
91
94
|
generate_or_combine (str): Either "generate_data" or "combine_data".
|
|
92
|
-
year_flag (
|
|
93
|
-
issue_or_month_flag (
|
|
94
|
-
options (
|
|
95
|
+
year_flag (str | list[str], optional): Flag for year selection. Defaults to "current_year".
|
|
96
|
+
issue_or_month_flag (str | list[str], optional): Flag for issue/month selection. Defaults to "current_issue".
|
|
97
|
+
options (dict[str, Any], optional): Additional options. Defaults to {}.
|
|
95
98
|
"""
|
|
99
|
+
if options is None:
|
|
100
|
+
options = {}
|
|
101
|
+
|
|
96
102
|
path_root, path_output, combine_flag = preparation(
|
|
97
103
|
path_storage, path_output, output_basename, pub_type, issue_or_month_flag, year_flag, options
|
|
98
104
|
)
|
|
@@ -122,7 +128,7 @@ def generate_from_bibs_and_write(
|
|
|
122
128
|
# Generate md, tex, pdf, html
|
|
123
129
|
html_body = generate_html_from_bib_data(abbr, library, pp, new_options)
|
|
124
130
|
if combine_flag and html_body:
|
|
125
|
-
publisher_html_body.extend(html_body
|
|
131
|
+
publisher_html_body.extend([*html_body, "\n"])
|
|
126
132
|
|
|
127
133
|
# Combine for publisher
|
|
128
134
|
if publisher_html_body:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
|
-
from typing import Any
|
|
2
|
+
from typing import Any
|
|
3
3
|
|
|
4
4
|
from pyadvtools import write_list
|
|
5
5
|
from pybibtexer.bib.bibtexparser import Library
|
|
@@ -12,34 +12,37 @@ def generate_html_content(html_body, abbr_standard):
|
|
|
12
12
|
"""Create complete HTML document from body content.
|
|
13
13
|
|
|
14
14
|
Args:
|
|
15
|
-
html_body:
|
|
15
|
+
html_body: list of HTML body content lines.
|
|
16
16
|
abbr_standard (str): Standard abbreviation for the document.
|
|
17
17
|
|
|
18
18
|
Returns:
|
|
19
|
-
|
|
19
|
+
list[str]: Complete HTML document as list of lines.
|
|
20
20
|
"""
|
|
21
|
-
return [html_head.format(abbr_standard), html_style, "\n"
|
|
21
|
+
return [html_head.format(abbr_standard), html_style, "\n", *html_body, *html_tail]
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
def generate_html_from_bib_data(
|
|
25
25
|
abbr_standard: str,
|
|
26
|
-
original_bib_data:
|
|
26
|
+
original_bib_data: list[str] | str | Library,
|
|
27
27
|
path_output: str,
|
|
28
|
-
options:
|
|
29
|
-
) ->
|
|
28
|
+
options: dict[str, Any] | None = None,
|
|
29
|
+
) -> list[str]:
|
|
30
30
|
"""Generate HTML from bibliography data.
|
|
31
31
|
|
|
32
32
|
Args:
|
|
33
33
|
abbr_standard (str): Standard abbreviation for the publication.
|
|
34
|
-
original_bib_data (
|
|
34
|
+
original_bib_data (list[str] | str | Library): Bibliography data in various formats.
|
|
35
35
|
path_output (str): Path to output directory.
|
|
36
|
-
options (
|
|
36
|
+
options (dict[str, Any], optional): Additional processing options. Defaults to {}.
|
|
37
37
|
full_json_c (str, optional): Path to conferences JSON file. Defaults to "".
|
|
38
38
|
full_json_j (str, optional): Path to journals JSON file. Defaults to "".
|
|
39
39
|
|
|
40
40
|
Returns:
|
|
41
|
-
|
|
41
|
+
list[str]: list of HTML body content lines.
|
|
42
42
|
"""
|
|
43
|
+
if options is None:
|
|
44
|
+
options = {}
|
|
45
|
+
|
|
43
46
|
# Set processing options
|
|
44
47
|
processing_options: dict = {
|
|
45
48
|
# convert_str_to_library
|
|
@@ -79,11 +82,12 @@ def generate_html_from_bib_data(
|
|
|
79
82
|
|
|
80
83
|
# Create complete HTML document if entries exist
|
|
81
84
|
if len(html_body) > 0:
|
|
82
|
-
html_body =
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
html_body = [
|
|
86
|
+
f'<h2 id="{abbr_standard.lower()}">{abbr_standard} - {len(zotero_library.entries)}</h2>\n',
|
|
87
|
+
"<ul>\n",
|
|
88
|
+
*html_body,
|
|
89
|
+
"</ul>\n",
|
|
90
|
+
]
|
|
87
91
|
|
|
88
92
|
html_content = generate_html_content(html_body, abbr_standard)
|
|
89
93
|
output_dir = os.path.join(path_output, abbr_standard)
|
|
@@ -100,7 +104,7 @@ def _format_entry_to_html(entry, abbr, data_list):
|
|
|
100
104
|
Args:
|
|
101
105
|
entry: Bibliography entry dictionary.
|
|
102
106
|
abbr (str): Publication abbreviation.
|
|
103
|
-
data_list:
|
|
107
|
+
data_list: list of formatted bibliography data.
|
|
104
108
|
|
|
105
109
|
Returns:
|
|
106
110
|
str: HTML formatted entry string.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Any
|
|
1
|
+
from typing import Any
|
|
2
2
|
|
|
3
3
|
from pyadvtools import IterateSortDict
|
|
4
4
|
from pybibtexer.bib.bibtexparser import Entry, Library
|
|
@@ -6,24 +6,27 @@ from pybibtexer.main import PythonRunBib
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
def generate_library_by_filters(
|
|
9
|
-
original_data:
|
|
10
|
-
issue_or_month_flag:
|
|
11
|
-
year_flag:
|
|
12
|
-
options:
|
|
9
|
+
original_data: list[str] | str | Library,
|
|
10
|
+
issue_or_month_flag: str | list[str], # filter
|
|
11
|
+
year_flag: str | list[str] = "current_year", # filter
|
|
12
|
+
options: dict[str, Any] | None = None,
|
|
13
13
|
) -> Library:
|
|
14
14
|
"""Generate a Library object from input data with given filters.
|
|
15
15
|
|
|
16
16
|
Args:
|
|
17
|
-
original_data (
|
|
18
|
-
issue_or_month_flag (
|
|
19
|
-
year_flag (
|
|
20
|
-
options (
|
|
17
|
+
original_data (list[str] | str | Library): Input bibliography data.
|
|
18
|
+
issue_or_month_flag (str | list[str]): Flag for issue/month selection.
|
|
19
|
+
year_flag (str | list[str], optional): Flag for year selection. Defaults to "current_year".
|
|
20
|
+
options (dict[str, Any], optional): Additional options. Defaults to {}.
|
|
21
21
|
full_json_c (str, optional): JSON configuration for conference proceedings. Defaults to "".
|
|
22
22
|
full_json_j (str, optional): JSON configuration for journal articles. Defaults to "".
|
|
23
23
|
|
|
24
24
|
Returns:
|
|
25
25
|
Library: Processed library object.
|
|
26
26
|
"""
|
|
27
|
+
if options is None:
|
|
28
|
+
options = {}
|
|
29
|
+
|
|
27
30
|
_options = {}
|
|
28
31
|
# convert_str_to_library
|
|
29
32
|
_options["is_standardize_bib"] = False # default is True
|
|
@@ -73,25 +76,25 @@ def generate_library_by_filters(
|
|
|
73
76
|
|
|
74
77
|
|
|
75
78
|
def _obtain_year_flag_library(
|
|
76
|
-
nested_entries:
|
|
77
|
-
year_flag:
|
|
79
|
+
nested_entries: dict[str, dict[str, dict[str, dict[str, dict[str, list[Entry]]]]]],
|
|
80
|
+
year_flag: str | list[str] = "current_year",
|
|
78
81
|
):
|
|
79
82
|
"""Filter dictionary by year flag.
|
|
80
83
|
|
|
81
84
|
Args:
|
|
82
85
|
nested_entries: Nested dictionary containing bibliography entries.
|
|
83
|
-
year_flag (
|
|
86
|
+
year_flag (str | list[str], optional): Year filter flag. Defaults to "current_year".
|
|
84
87
|
|
|
85
88
|
Returns:
|
|
86
|
-
|
|
89
|
+
dict: Filtered dictionary by year.
|
|
87
90
|
"""
|
|
88
91
|
new_dict = {}
|
|
89
92
|
for entry_type in nested_entries:
|
|
90
|
-
years =
|
|
93
|
+
years = list(nested_entries[entry_type])
|
|
91
94
|
|
|
92
95
|
# Update years
|
|
93
|
-
if isinstance(year_flag,
|
|
94
|
-
years = sorted(
|
|
96
|
+
if isinstance(year_flag, list): # given_years
|
|
97
|
+
years = sorted(set(years).intersection(set(year_flag)))
|
|
95
98
|
elif year_flag.lower().strip() == "all_years": # all_years
|
|
96
99
|
years = years
|
|
97
100
|
elif year_flag.lower().strip() == "current_year": # current_year
|
|
@@ -107,7 +110,7 @@ def _obtain_year_flag_library(
|
|
|
107
110
|
|
|
108
111
|
|
|
109
112
|
def _obtain_issue_flag_library(
|
|
110
|
-
nested_entries:
|
|
113
|
+
nested_entries: dict[str, dict[str, dict[str, dict[str, dict[str, list[Entry]]]]]],
|
|
111
114
|
issue_flag: str = "current_issue",
|
|
112
115
|
) -> Library:
|
|
113
116
|
"""Filter dictionary by issue flag.
|
|
@@ -129,9 +132,9 @@ def _obtain_issue_flag_library(
|
|
|
129
132
|
# Article entries
|
|
130
133
|
if entry_type.lower() == "article":
|
|
131
134
|
volumes, numbers, months = [], [], []
|
|
132
|
-
for volume in (volumes :=
|
|
133
|
-
for number in (numbers :=
|
|
134
|
-
months =
|
|
135
|
+
for volume in (volumes := list(temp_dict)):
|
|
136
|
+
for number in (numbers := list(temp_dict[volume])):
|
|
137
|
+
months = list(temp_dict[volume][number])
|
|
135
138
|
break
|
|
136
139
|
break
|
|
137
140
|
|
|
@@ -151,14 +154,14 @@ def _obtain_issue_flag_library(
|
|
|
151
154
|
|
|
152
155
|
|
|
153
156
|
def _obtain_month_flag_library(
|
|
154
|
-
nested_entries:
|
|
155
|
-
month_flag:
|
|
157
|
+
nested_entries: dict[str, dict[str, dict[str, dict[str, dict[str, list[Entry]]]]]],
|
|
158
|
+
month_flag: str | list[str] = "current_month",
|
|
156
159
|
) -> Library:
|
|
157
160
|
"""Filter dictionary by month flag.
|
|
158
161
|
|
|
159
162
|
Args:
|
|
160
163
|
nested_entries: Nested dictionary containing bibliography entries.
|
|
161
|
-
month_flag (
|
|
164
|
+
month_flag (str | list[str], optional): Month filter flag. Defaults to "current_month".
|
|
162
165
|
|
|
163
166
|
Returns:
|
|
164
167
|
Library: Filtered library object.
|
|
@@ -181,7 +184,7 @@ def _obtain_month_flag_library(
|
|
|
181
184
|
for entry_type in nested_entries:
|
|
182
185
|
for year in nested_entries[entry_type]:
|
|
183
186
|
temp_dict = nested_entries[entry_type][year]
|
|
184
|
-
default_months =
|
|
187
|
+
default_months = list(temp_dict)
|
|
185
188
|
|
|
186
189
|
# Update month
|
|
187
190
|
new_months = []
|