rxiv-maker 1.18.1__py3-none-any.whl → 1.18.2__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.
- rxiv_maker/__version__.py +1 -1
- rxiv_maker/converters/table_processor.py +61 -32
- {rxiv_maker-1.18.1.dist-info → rxiv_maker-1.18.2.dist-info}/METADATA +1 -1
- {rxiv_maker-1.18.1.dist-info → rxiv_maker-1.18.2.dist-info}/RECORD +7 -7
- {rxiv_maker-1.18.1.dist-info → rxiv_maker-1.18.2.dist-info}/WHEEL +0 -0
- {rxiv_maker-1.18.1.dist-info → rxiv_maker-1.18.2.dist-info}/entry_points.txt +0 -0
- {rxiv_maker-1.18.1.dist-info → rxiv_maker-1.18.2.dist-info}/licenses/LICENSE +0 -0
rxiv_maker/__version__.py
CHANGED
|
@@ -139,9 +139,9 @@ def convert_tables_to_latex(
|
|
|
139
139
|
result_lines.pop() # Remove caption line
|
|
140
140
|
|
|
141
141
|
# Check for new format table caption after the table
|
|
142
|
-
new_format_caption, table_id, rotation_angle = _parse_table_caption(lines, i)
|
|
143
|
-
if new_format_caption:
|
|
144
|
-
i +=
|
|
142
|
+
new_format_caption, table_id, rotation_angle, lines_to_skip = _parse_table_caption(lines, i)
|
|
143
|
+
if new_format_caption and lines_to_skip:
|
|
144
|
+
i += lines_to_skip # Skip blank lines, comments, and caption line
|
|
145
145
|
|
|
146
146
|
# Generate LaTeX table with the processed caption
|
|
147
147
|
latex_table = generate_latex_table(
|
|
@@ -844,39 +844,68 @@ def _is_table_row(line: str) -> bool:
|
|
|
844
844
|
return "|" in line and line.startswith("|") and line.endswith("|")
|
|
845
845
|
|
|
846
846
|
|
|
847
|
-
def _parse_table_caption(lines: list[str], i: int) -> tuple[str | None, str | None, int | None]:
|
|
848
|
-
"""Parse table caption in new format after table.
|
|
847
|
+
def _parse_table_caption(lines: list[str], i: int) -> tuple[str | None, str | None, int | None, int | None]:
|
|
848
|
+
"""Parse table caption in new format after table.
|
|
849
|
+
|
|
850
|
+
Returns:
|
|
851
|
+
tuple of (caption, table_id, rotation_angle, lines_to_skip)
|
|
852
|
+
lines_to_skip indicates how many lines after position i should be skipped
|
|
853
|
+
"""
|
|
849
854
|
new_format_caption = None
|
|
850
855
|
table_id = None
|
|
851
856
|
rotation_angle = None
|
|
857
|
+
lines_to_skip = None
|
|
852
858
|
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
if
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
if
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
859
|
+
# Look ahead for caption, skipping blank lines and HTML comments
|
|
860
|
+
# Search up to 5 lines ahead to be flexible
|
|
861
|
+
search_limit = min(i + 5, len(lines))
|
|
862
|
+
|
|
863
|
+
for offset in range(search_limit - i):
|
|
864
|
+
check_line = lines[i + offset].strip()
|
|
865
|
+
|
|
866
|
+
# Skip blank lines and HTML comments
|
|
867
|
+
if check_line == "" or (check_line.startswith("<!--") and check_line.endswith("-->")):
|
|
868
|
+
continue
|
|
869
|
+
|
|
870
|
+
# Check if this is a new-format caption
|
|
871
|
+
if re.match(r"^\{#[a-zA-Z0-9_:-]+.*\}\s*\*\*.*\*\*", check_line):
|
|
872
|
+
caption_line = check_line
|
|
873
|
+
|
|
874
|
+
# Parse caption with optional attributes like rotate=90
|
|
875
|
+
caption_match = re.match(r"^\{#([a-zA-Z0-9_:-]+)([^}]*)\}\s*(.+)$", caption_line)
|
|
876
|
+
if caption_match:
|
|
877
|
+
table_id = caption_match.group(1)
|
|
878
|
+
attributes_str = caption_match.group(2).strip()
|
|
879
|
+
caption_text = caption_match.group(3)
|
|
880
|
+
|
|
881
|
+
# Extract rotation attribute if present
|
|
882
|
+
if attributes_str:
|
|
883
|
+
rotation_match = re.search(r"rotate=(\d+)", attributes_str)
|
|
884
|
+
if rotation_match:
|
|
885
|
+
rotation_angle = int(rotation_match.group(1))
|
|
886
|
+
|
|
887
|
+
# Process caption text to handle markdown formatting
|
|
888
|
+
new_format_caption = re.sub(r"\*\*([^*]+)\*\*", r"\\textbf{\1}", caption_text)
|
|
889
|
+
new_format_caption = re.sub(r"\*([^*]+)\*", r"\\textit{\1}", new_format_caption)
|
|
890
|
+
|
|
891
|
+
# Convert cross-references (figures, tables, equations) in caption
|
|
892
|
+
from .figure_processor import (
|
|
893
|
+
convert_equation_references_to_latex,
|
|
894
|
+
convert_figure_references_to_latex,
|
|
895
|
+
)
|
|
896
|
+
|
|
897
|
+
new_format_caption = convert_figure_references_to_latex(new_format_caption)
|
|
898
|
+
new_format_caption = convert_table_references_to_latex(new_format_caption)
|
|
899
|
+
new_format_caption = convert_equation_references_to_latex(new_format_caption)
|
|
900
|
+
|
|
901
|
+
# Return how many lines to skip (all lines from i to caption, inclusive)
|
|
902
|
+
lines_to_skip = offset + 1
|
|
903
|
+
break
|
|
904
|
+
else:
|
|
905
|
+
# Found a non-blank, non-comment, non-caption line - stop searching
|
|
906
|
+
break
|
|
907
|
+
|
|
908
|
+
return new_format_caption, table_id, rotation_angle, lines_to_skip
|
|
880
909
|
|
|
881
910
|
|
|
882
911
|
def _split_table_row_respecting_backticks(row: str) -> list[str]:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rxiv-maker
|
|
3
|
-
Version: 1.18.
|
|
3
|
+
Version: 1.18.2
|
|
4
4
|
Summary: Write scientific preprints in Markdown. Generate publication-ready PDFs efficiently.
|
|
5
5
|
Project-URL: Homepage, https://github.com/HenriquesLab/rxiv-maker
|
|
6
6
|
Project-URL: Documentation, https://github.com/HenriquesLab/rxiv-maker#readme
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
rxiv_maker/__init__.py,sha256=p04JYC5ZhP6dLXkoWVlKNyiRvsDE1a4C88f9q4xO3tA,3268
|
|
2
|
-
rxiv_maker/__version__.py,sha256=
|
|
2
|
+
rxiv_maker/__version__.py,sha256=r1DNB3JWDHXSSJtFwhx61DHqp-syX6loJLs-YmN6FEQ,51
|
|
3
3
|
rxiv_maker/rxiv_maker_cli.py,sha256=9Lu_mhFPXwx5jzAR6StCNxwCm_fkmP5qiOYdNuh_AwI,120
|
|
4
4
|
rxiv_maker/validate.py,sha256=AIzgP59KbCQJqC9WIGfUdVv0xI6ud9g1fFznQkaGz5Q,9373
|
|
5
5
|
rxiv_maker/cli/__init__.py,sha256=Jw0DTFUSofN-02xpVrt1UUzRcgH5NNd-GPNidhmNwpU,77
|
|
@@ -55,7 +55,7 @@ rxiv_maker/converters/md2tex.py,sha256=eO0gMjINrFmefJZARCEQO0ACmLgVE5mAccR_Fqz8z
|
|
|
55
55
|
rxiv_maker/converters/python_executor.py,sha256=YMJO7A-re8EOCQjy-PKryFFBoxddK3g9R1VuaH2MfYY,37369
|
|
56
56
|
rxiv_maker/converters/section_processor.py,sha256=7znzb_FYH2sCYH336l5J1ZdRaQv-ycdCN79RpI3Tc-w,5706
|
|
57
57
|
rxiv_maker/converters/supplementary_note_processor.py,sha256=8wzQw2kN0Afg0iB7hPFdeWiDlDsFhhTkcRTvwCXIvjc,6689
|
|
58
|
-
rxiv_maker/converters/table_processor.py,sha256=
|
|
58
|
+
rxiv_maker/converters/table_processor.py,sha256=0sCtDVlQwLcAC8_dJMijgVb7DCmtannCyDgWNJ35-KE,39869
|
|
59
59
|
rxiv_maker/converters/text_formatters.py,sha256=pa2kVAqyPkGh5LViL5Iqqjjqw1ixB0GKBZJloaVBVi0,42816
|
|
60
60
|
rxiv_maker/converters/types.py,sha256=mTLXVTBGfEi2dp_U2maSE7kZQFz_lfmLDQjlMAeU9lE,885
|
|
61
61
|
rxiv_maker/converters/url_processor.py,sha256=xoZrgz7kgRtMzSay_14ZpYEwK9uXj3YloQW9K-G8LAc,6586
|
|
@@ -194,8 +194,8 @@ rxiv_maker/validators/doi/metadata_comparator.py,sha256=euqHhKP5sHQAdZbdoAahUn6Y
|
|
|
194
194
|
rxiv_maker/tex/template.tex,sha256=_tPtxrurn3sKTt9Kfa44lPdPyT44vHbDUOGqldU9r2s,1378
|
|
195
195
|
rxiv_maker/tex/style/rxiv_maker_style.bst,sha256=jbVqrJgAm6F88cow5vtZuPBwwmlcYykclTm8RvZIo6Y,24281
|
|
196
196
|
rxiv_maker/tex/style/rxiv_maker_style.cls,sha256=6VDmZE0uvYWog6rcYi2K_NIM9-Pgjx9AFdRg_sTheK0,24374
|
|
197
|
-
rxiv_maker-1.18.
|
|
198
|
-
rxiv_maker-1.18.
|
|
199
|
-
rxiv_maker-1.18.
|
|
200
|
-
rxiv_maker-1.18.
|
|
201
|
-
rxiv_maker-1.18.
|
|
197
|
+
rxiv_maker-1.18.2.dist-info/METADATA,sha256=OqROaCqeuMSX45OfafGdLjR5Q_Y-XxaC__NboFz_z54,18222
|
|
198
|
+
rxiv_maker-1.18.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
199
|
+
rxiv_maker-1.18.2.dist-info/entry_points.txt,sha256=ghCN0hI9A1GlG7QY5F6E-xYPflA8CyS4B6bTQ1YLop0,97
|
|
200
|
+
rxiv_maker-1.18.2.dist-info/licenses/LICENSE,sha256=GSZFoPIhWDNJEtSHTQ5dnELN38zFwRiQO2antBezGQk,1093
|
|
201
|
+
rxiv_maker-1.18.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|