Skip to content

fix: implement proper structural serialization for Julia executable folds#16

Open
Parth-Garg2629 wants to merge 1 commit intomgubi:mainfrom
Parth-Garg2629:fix/proper-multiline-serialization
Open

fix: implement proper structural serialization for Julia executable folds#16
Parth-Garg2629 wants to merge 1 commit intomgubi:mainfrom
Parth-Garg2629:fix/proper-multiline-serialization

Conversation

@Parth-Garg2629
Copy link
Copy Markdown

Overview

This PR addresses the issue where multiline Julia code in executable folds was being concatenated into a single line, leading to ParseError in the Julia kernel (Issue #14 ).

Following the maintainer's feedback, instead of disabling input converters, we have implemented a dedicated recursive serializer that respects the TeXmacs document structure while preserving formatting capabilities.

Technical Details

The fix is implemented in progs/init-julia.scm through the following changes:

  • julia-serialize-sub: A new recursive function that traverses the TeXmacs tree to handle different node types appropriately.
  • Newline Preservation: The serializer now explicitly identifies document nodes and joins their children (lines) with \n characters. This ensures that multiline code blocks are sent to Julia with their structural integrity intact.
  • Math Conversion: The fix preserves the functionality of plugin-math-input by calling it specifically for math tags. This ensures that mathematical symbols (e.g., <math|\alpha>) are still correctly translated for the Julia kernel (e.g., to alpha).
  • Registration: The new structural serializer is registered in the plugin-configure block as the primary method for code output.

This approach ensures that the Julia kernel receives well-formatted, multiline code while maintaining all the benefits of TeXmacs' structured document system.

Verification

  • Multiline Execution: Verified that multiline logic in executable folds executes line-by-line without ParseError.
  • Symbol Conversion: Verified that mathematical symbols within session lines are still correctly translated using the existing converter logic.

@Parth-Garg2629
Copy link
Copy Markdown
Author

@hammerfunctor could u please check if this meets the requierments you told about earlier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant