arxiv-to-prompt 0.2.0__tar.gz → 0.2.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.2.0
3
+ Version: 0.2.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.2.0"
7
+ version = "0.2.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" }]
@@ -192,7 +192,8 @@ def flatten_tex(directory: str, main_file: str) -> str:
192
192
 
193
193
  # Process the command normally
194
194
  input_file = match.group(1)
195
- if not input_file.endswith('.tex'):
195
+ # Only add .tex extension if the file has no extension at all
196
+ if not os.path.splitext(input_file)[1]:
196
197
  input_file += '.tex'
197
198
  input_path = os.path.join(directory, input_file)
198
199
  return process_file(input_path, processed_files)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: arxiv-to-prompt
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: transform arXiv papers into a single latex prompt for LLMs
5
5
  Author: Takashi Ishida
6
6
  License: MIT
@@ -228,3 +228,46 @@ def test_process_latex_with_appendix_removal(sample_arxiv_id, temp_cache_dir):
228
228
 
229
229
  # Check that appendix was removed (if it existed)
230
230
  assert "\\appendix" not in result
231
+
232
+
233
+ def test_input_file_extensions(temp_cache_dir):
234
+ """Test that input files with existing extensions are not modified."""
235
+ # Create test directory and files
236
+ tex_dir = temp_cache_dir / "test_extensions"
237
+ tex_dir.mkdir(parents=True)
238
+
239
+ # Create main file with various input commands
240
+ main_file = tex_dir / "main.tex"
241
+ main_content = """\\documentclass{article}
242
+ \\begin{document}
243
+ \\input{chapter1}
244
+ \\input{main.bbl}
245
+ \\input{mystyle.sty}
246
+ \\input{config.cls}
247
+ \\input{already.tex}
248
+ \\end{document}
249
+ """
250
+ main_file.write_text(main_content)
251
+
252
+ # Create the files that should be included
253
+ files_to_create = [
254
+ ("chapter1.tex", "Chapter 1 content"),
255
+ ("main.bbl", "Bibliography content"),
256
+ ("mystyle.sty", "Style content"),
257
+ ("config.cls", "Class content"),
258
+ ("already.tex", "Already tex content"),
259
+ ]
260
+
261
+ for filename, content in files_to_create:
262
+ file_path = tex_dir / filename
263
+ file_path.write_text(content)
264
+
265
+ # Run the flatten_tex function
266
+ result = flatten_tex(str(tex_dir), "main.tex")
267
+
268
+ # Check that all files were included correctly
269
+ assert "Chapter 1 content" in result
270
+ assert "Bibliography content" in result
271
+ assert "Style content" in result
272
+ assert "Class content" in result
273
+ assert "Already tex content" in result
File without changes