pyeasyphd 0.2.6__py3-none-any.whl → 0.2.10__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.

@@ -31,6 +31,10 @@ class PandocMdTo(BasicInput):
31
31
  google_connected_paper_scite (bool): Whether to use Google connected paper scite. Defaults to True.
32
32
  display_one_line_reference_note (bool): Whether to display one line reference note. Defaults to False.
33
33
  cite_flag_in_tex (str): Citation flag in LaTeX. Defaults to "cite".
34
+ add_url_for_basic_dict (bool): Whether to add url for items in basic dict. Defualts to True.
35
+ add_anchor_for_basic_dict (bool): Whether to add anchor for items in basic dict. Defaults to False.
36
+ add_anchor_for_beauty_dict (bool): Whether to add anchor for items in beauty dict. Defaults to False.
37
+ add_anchor_for_complex_dict (bool): Whether to add anchor for items in complex dict. Defaults to False.
34
38
  """
35
39
 
36
40
  def __init__(self, options: dict) -> None:
@@ -52,6 +56,11 @@ class PandocMdTo(BasicInput):
52
56
  # tex
53
57
  self.cite_flag_in_tex: str = options.get("cite_flag_in_tex", "cite")
54
58
 
59
+ self.add_url_for_basic_dict: bool = options.get("add_url_for_basic_dict", True)
60
+ self.add_anchor_for_basic_dict: bool = options.get("add_anchor_for_basic_dict", False)
61
+ self.add_anchor_for_beauty_dict: bool = options.get("add_anchor_for_beauty_dict", False)
62
+ self.add_anchor_for_complex_dict: bool = options.get("add_anchor_for_complex_dict", False)
63
+
55
64
  def pandoc_md_to_md(
56
65
  self, path_bib: str, path_md_one: str, path_md_two: str, name_md_one: Optional[str], name_md_two: Optional[str]
57
66
  ) -> List[str]:
@@ -311,9 +320,18 @@ class PandocMdTo(BasicInput):
311
320
  if (not self.google_connected_paper_scite) and aa:
312
321
  bb = [f"([www]({aa[0].strip()}))\n"]
313
322
 
314
- a.extend(aa)
323
+ # add url
324
+ if self.add_url_for_basic_dict:
325
+ a.extend(aa)
326
+
315
327
  b.extend(bb)
316
328
 
329
+ # add anchor
330
+ if self.add_anchor_for_basic_dict:
331
+ a = [f'<a id="{k.lower()}"></a>'] + a
332
+ if self.add_anchor_for_beauty_dict or self.add_anchor_for_complex_dict:
333
+ b = [f'<a id="{k.lower()}"></a>'] + b
334
+
317
335
  if self.display_one_line_reference_note:
318
336
  a = ["".join(a).replace("\n", " ").strip() + "\n"]
319
337
  b = ["".join(b).replace("\n", " ").strip() + "\n"]
@@ -13,6 +13,35 @@ from .basic_input import BasicInput
13
13
  from .pandoc_md_to import PandocMdTo
14
14
 
15
15
 
16
+ def batch_convert_citations(text):
17
+ """
18
+ Process all citations in the text, including multiple citations in one bracket.
19
+
20
+ Example: [@ref1; @ref2] -> <sup>[@ref1](#ref1)</sup><sup>[@ref2](#ref2)</sup>
21
+ """
22
+ # Match all citation patterns within square brackets
23
+ pattern = r'\[([^]]+)\]'
24
+
25
+ def process_citation(match):
26
+ citations = match.group(1)
27
+ # Split multiple citations (support semicolon or comma separation)
28
+ citation_list = re.split(r'[;,]', citations)
29
+
30
+ result = []
31
+ for citation in citation_list:
32
+ citation = citation.strip()
33
+ if citation.startswith('@'):
34
+ cite_id = citation[1:] # Remove the @ symbol
35
+ result.append(f'[{citation}](#{cite_id.lower()})')
36
+ else:
37
+ # Keep non-citation content in original format
38
+ result.append(f'[{citation}]')
39
+
40
+ return ''.join(result)
41
+
42
+ return re.sub(pattern, process_citation, text)
43
+
44
+
16
45
  class PythonRunMd(BasicInput):
17
46
  """Python markdown processing class.
18
47
 
@@ -26,6 +55,7 @@ class PythonRunMd(BasicInput):
26
55
  replace_cite_to_fullcite_in_md (bool): Whether to replace citations with full citations in markdown. Defaults to False.
27
56
  replace_by_basic_beauty_complex_in_md (str): Replace by basic, beauty, or complex format. Defaults to "beauty".
28
57
  display_basic_beauty_complex_references_in_md (str): Display basic, beauty, or complex references. Defaults to "beauty".
58
+ add_anchor_in_md (bool): Whether add anchor in markdown. Defaults to False.
29
59
  """
30
60
 
31
61
  def __init__(self, options: Dict[str, Any]) -> None:
@@ -46,6 +76,7 @@ class PythonRunMd(BasicInput):
46
76
  self.display_basic_beauty_complex_references_in_md: str = options.get(
47
77
  "display_basic_beauty_complex_references_in_md", "beauty"
48
78
  )
79
+ self.add_anchor_in_md: bool = options.get("add_anchor_in_md", False)
49
80
 
50
81
  # for md
51
82
  self._pandoc_md_to = PandocMdTo(self.options)
@@ -175,6 +206,9 @@ class PythonRunMd(BasicInput):
175
206
  continue
176
207
 
177
208
  content[i] = content[i].replace(mch.group(), mch.group(1) + "[" + mch.group(2) + "]")
209
+ # add anchor
210
+ if self.add_anchor_in_md:
211
+ content = [batch_convert_citations(line) for line in content]
178
212
  n2 = "2_generate" + ".md"
179
213
  write_list(content, n2, "w", path_temp)
180
214
 
@@ -9,6 +9,14 @@
9
9
  "display_one_line_reference_note": false,
10
10
  // "fullcite", "cite"
11
11
  "cite_flag_in_tex": "cite",
12
+ // true, false
13
+ "add_url_for_basic_dict": true,
14
+ // true, false
15
+ "add_anchor_for_basic_dict": false,
16
+ // true, false
17
+ "add_anchor_for_beauty_dict": false,
18
+ // true, false
19
+ "add_anchor_for_complex_dict": false,
12
20
 
13
21
  // for md file
14
22
  // pyeasyphd/main/python_run_md.py
@@ -26,6 +34,8 @@
26
34
  "replace_by_basic_beauty_complex_in_md": "beauty",
27
35
  // basic, beauty, complex
28
36
  "display_basic_beauty_complex_references_in_md": "beauty",
37
+ // true, false
38
+ "add_anchor_in_md": false,
29
39
 
30
40
  // for tex file
31
41
  // pyeasyphd/main/python_run_tex.py
@@ -36,7 +36,7 @@ def run_article_md_daily_notes(
36
36
  # bib options
37
37
  "abbr_index_article_for_abbr": 1, # 0, 1, 2
38
38
  "abbr_index_inproceedings_for_abbr": 2, # 0, 1, 2
39
- "add_link_to_fields_for_abbr": None, # None, or ["title", "journal", "booktitle"]
39
+ "add_link_to_fields_for_abbr": ["title"], # None, or ["title", "journal", "booktitle"]
40
40
  "maximum_authors_for_abbr": 0, # 0, 1, 2, ...
41
41
  "add_index_to_entries": False,
42
42
  "bib_for_abbr_name": "abbr.bib",
@@ -62,6 +62,11 @@ def run_article_md_daily_notes(
62
62
  "generate_tex": False,
63
63
 
64
64
  # md options
65
+ "add_url_for_basic_dict": False, # default is True
66
+ "add_anchor_for_basic_dict": False, # default is False
67
+ "add_anchor_for_beauty_dict": True, # default is False
68
+ "add_anchor_for_complex_dict": False, # default is False
69
+
65
70
  "final_output_main_md_name": "main.md",
66
71
  "delete_temp_generate_md": True,
67
72
  "add_reference_in_md": True,
@@ -69,6 +74,7 @@ def run_article_md_daily_notes(
69
74
  "replace_cite_to_fullcite_in_md": True,
70
75
  "replace_by_basic_beauty_complex_in_md": "basic",
71
76
  "display_basic_beauty_complex_references_in_md": "beauty",
77
+ "add_anchor_in_md": True, # default is False
72
78
 
73
79
  "md_folder_name": "mds", # "" or "md" or "main"
74
80
  "delete_original_md_in_output_folder": True, # False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyeasyphd
3
- Version: 0.2.6
3
+ Version: 0.2.10
4
4
  Summary: pyeasyphd
5
5
  License: GPL-3.0-or-later
6
6
  License-File: LICENSE
@@ -16,8 +16,8 @@ Classifier: Programming Language :: Python :: 3.12
16
16
  Classifier: Programming Language :: Python :: 3.13
17
17
  Classifier: Programming Language :: Python :: 3.14
18
18
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
- Requires-Dist: pyadvtools (>=0.2.2,<0.3.0)
20
- Requires-Dist: pybibtexer (>=0.2.0,<0.3.0)
19
+ Requires-Dist: pyadvtools (>=0.2.4,<0.3.0)
20
+ Requires-Dist: pybibtexer (>=0.2.1,<0.3.0)
21
21
  Project-URL: Documentation, https://github.com/Easy-PhD/pyeasyphd
22
22
  Project-URL: Homepage, https://github.com/Easy-PhD/pyeasyphd
23
23
  Project-URL: Repository, https://github.com/Easy-PhD/pyeasyphd
@@ -19,13 +19,13 @@ pyeasyphd/data/Templates/TEX/math.tex,sha256=eDpuVcjIv-iugZXQRxKFTAyXujMZflTjKlD
19
19
  pyeasyphd/data/Templates/TEX/math_commands.tex,sha256=4bHrv5hFsvXRtOLdVqhPuHJFT9eKKje_My3YTnknJvQ,41391
20
20
  pyeasyphd/main/__init__.py,sha256=Y7K7DO_MZZlbtxt5oAnyYuCggN2f9tu4cRfpA3lPaiI,416
21
21
  pyeasyphd/main/basic_input.py,sha256=w_4sHS-gOmk7j5dDKQjU0fxXLO2eM3UkvR7o1urgeAg,4607
22
- pyeasyphd/main/pandoc_md_to.py,sha256=r3gJX74PH6Mk8UQjLvJUd0gqBGepzvsoNC05NxmZo7I,16148
23
- pyeasyphd/main/python_run_md.py,sha256=76wuw9tK0D9_hRpt42-GUAjanGSKHdNWw5QrBmiEwjQ,12636
22
+ pyeasyphd/main/pandoc_md_to.py,sha256=6ZdaXlH-dScO9pDNOaWxpTdCJRWkYXnJVK4fComxIFM,17295
23
+ pyeasyphd/main/python_run_md.py,sha256=cqleE-kBGyYdUZIdT3zU58gxDK6oHiRmfvtGEHLG4sA,13923
24
24
  pyeasyphd/main/python_run_tex.py,sha256=9Syu8qRjPXN3gEabfRUWxwTFBm_izIcB4yFhsz3QNs0,7672
25
25
  pyeasyphd/pyeasyphd.py,sha256=OAwbwq2rSXLSk2AoTAF8hmlOMRSRfvDn1Uqk-zkuqH8,3470
26
- pyeasyphd/pyeasyphd.sublime-settings,sha256=jv64qioOz66Ojm9QmL-DVeu4j_PsM5gyHpqhQL0z7ug,2850
26
+ pyeasyphd/pyeasyphd.sublime-settings,sha256=KcXx3DjyVf8UfnB4FP4u-jaTQU3Cuj24OvxGCZvXAsw,3135
27
27
  pyeasyphd/pyeasyphd.sublime-syntax,sha256=pXylbA-tye-K5dCTjEJLFVRqtY1T7AgWZ4laxo-dnaE,73
28
- pyeasyphd/scripts/run_article_md.py,sha256=3_nq0xNSN3hQ53myrPNM4mhYTcO7OK7ZK2ReiAQlzI8,3602
28
+ pyeasyphd/scripts/run_article_md.py,sha256=RXDgyc3METP_ln7IUaNDmLfu0XlZkYqm0UIdsyO16zo,3916
29
29
  pyeasyphd/tools/__init__.py,sha256=u1MZu_JjVac3HhEmcSTwroS83UVu0W5Vspy3Wu_-GH8,496
30
30
  pyeasyphd/tools/generate/generate_from_bibs.py,sha256=Dp1MyADwIRb9qFTFOkMPJLaeeh7NBjuiSLBN7smP2eo,7640
31
31
  pyeasyphd/tools/generate/generate_html.py,sha256=JzUEqgTVCaFzd4hXTYUEf0cVSO1QRe0nVUS72W6oyyU,5349
@@ -39,7 +39,7 @@ pyeasyphd/tools/search/search_keywords.py,sha256=YCurXuoYeU1ftve0cb8Hcn_g2FXCXf7
39
39
  pyeasyphd/tools/search/search_writers.py,sha256=Dz6D8m17R7x8NT7_PCjwmzlq29AfUz-N6sjyCguDTo4,15702
40
40
  pyeasyphd/tools/search/utils.py,sha256=bo7xtIZu31dQvjol1lwyWq1t6ldbw28oondwK8VbAqk,7562
41
41
  pyeasyphd/utils/utils.py,sha256=kWxzzgNwz77K9Q7j-RKTaoPpxqiVLVtaBMMhLuEenwE,3128
42
- pyeasyphd-0.2.6.dist-info/METADATA,sha256=h243vK0g_LI-AtcHNTvyqUcRuzXElJARaEdLuosltvk,985
43
- pyeasyphd-0.2.6.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
44
- pyeasyphd-0.2.6.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
45
- pyeasyphd-0.2.6.dist-info/RECORD,,
42
+ pyeasyphd-0.2.10.dist-info/METADATA,sha256=4gIE0eQv9crrTzZyNSArpqMr0ITJ6zWphEFGDkDTfxA,986
43
+ pyeasyphd-0.2.10.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
44
+ pyeasyphd-0.2.10.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
45
+ pyeasyphd-0.2.10.dist-info/RECORD,,