arxiv-to-prompt 0.4.0__tar.gz → 0.4.1__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: arxiv-to-prompt
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Summary: transform arXiv papers into a single latex prompt for LLMs
5
5
  Author: Takashi Ishida
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "arxiv-to-prompt"
7
- version = "0.4.0"
7
+ version = "0.4.1"
8
8
  description = "transform arXiv papers into a single latex prompt for LLMs"
9
9
  readme = "README.md"
10
10
  authors = [{ name = "Takashi Ishida" }]
@@ -131,6 +131,8 @@ def find_main_tex(directory: str) -> Optional[str]:
131
131
 
132
132
  def remove_comments_from_lines(text: str) -> str:
133
133
  """Remove LaTeX comments while preserving newlines."""
134
+ # Remove \iffalse...\fi blocks (commonly used to comment out large sections)
135
+ text = re.sub(r'\\iffalse\b.*?\\fi\b', '', text, flags=re.DOTALL)
134
136
  lines = text.split('\n')
135
137
  result = []
136
138
  for line in lines:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: arxiv-to-prompt
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Summary: transform arXiv papers into a single latex prompt for LLMs
5
5
  Author: Takashi Ishida
6
6
  License: MIT
@@ -109,11 +109,29 @@ def test_remove_comments_from_lines():
109
109
  ("Multiple % comments % here", "Multiple"),
110
110
  ("Line with both \\% and % real comment", "Line with both \\% and"),
111
111
  ]
112
-
112
+
113
113
  for input_text, expected in test_cases:
114
114
  assert remove_comments_from_lines(input_text).rstrip() == expected
115
115
 
116
116
 
117
+ def test_remove_iffalse_blocks():
118
+ """Test removal of \\iffalse...\\fi blocks."""
119
+ # Single line
120
+ assert remove_comments_from_lines("before \\iffalse hidden \\fi after") == "before after"
121
+
122
+ # Multi-line block
123
+ input_text = "before\n\\iffalse\nhidden\ncontent\n\\fi\nafter"
124
+ result = remove_comments_from_lines(input_text)
125
+ assert "hidden" not in result
126
+ assert "before" in result
127
+ assert "after" in result
128
+
129
+ # Multiple blocks
130
+ input_text = "a \\iffalse x \\fi b \\iffalse y \\fi c"
131
+ result = remove_comments_from_lines(input_text)
132
+ assert result == "a b c"
133
+
134
+
117
135
  def test_find_main_tex(temp_cache_dir):
118
136
  """Test finding the main tex file."""
119
137
  # Create test files
File without changes