Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
661 commits
Select commit Hold shift + click to select a range
2ab1515
fix: process noindent nodes in reverse order to avoid index shifting
takahashim Oct 25, 2025
2220691
fix: preserve parent references and use compiler's inline processor i…
takahashim Oct 25, 2025
3e8f9b5
fix: traverse term_children in list item visitors for reference resol…
takahashim Oct 25, 2025
a413943
fix: set cell_type to :th for header rows in markdown tables
takahashim Oct 25, 2025
e9b37c1
fix: rename invalid method names
takahashim Oct 25, 2025
ef7d01a
fix: traverse caption_node in block visitors for reference resolution…
takahashim Oct 25, 2025
236eaae
Remove compile_inline from HtmlRenderer and use AST nodes directly
takahashim Oct 25, 2025
cc4370e
chore
takahashim Oct 25, 2025
e04472b
fix: add indexes_generated flag to prevent duplicate index generation
takahashim Oct 25, 2025
1adb2a2
refactor: rename NestedListBuilder to NestedListAssembler
takahashim Oct 25, 2025
222236b
refactor: move NestedListAssembler to list_processor subdirectory
takahashim Oct 25, 2025
af3025f
refactor: move BlockData and BlockContext to compiler subdirectory
takahashim Oct 25, 2025
b995b03
refactor: move post processors to compiler subdirectory
takahashim Oct 25, 2025
b2cd4a1
fix: remove unused AST::Analyzer class
takahashim Oct 25, 2025
dfcc54e
fix: remove old fixtures
takahashim Oct 25, 2025
28fd63e
fix: remove old tests
takahashim Oct 25, 2025
9ffc750
refactor: remove caption string from JSON serialization, use caption_…
takahashim Oct 25, 2025
9be8414
refactor: rename @builder to @nested_list_assembler and improve error…
takahashim Oct 25, 2025
3048954
chore: update document
takahashim Oct 25, 2025
9000450
refactor: add execute_post_processes and rename build_ast
takahashim Oct 25, 2025
203fb59
refactor: move target format determination into TsizeProcessor
takahashim Oct 25, 2025
5fc4a73
refactor: replace case statement with extensible hash-based dispatch …
takahashim Oct 25, 2025
408edd6
refactor: replace case statement with extensible hash-based dispatch …
takahashim Oct 25, 2025
9821330
refactor: unify inline_type and column_type to use symbols instead of…
takahashim Oct 25, 2025
28c9546
refactor: remove redundant args
takahashim Oct 25, 2025
d9ea07b
refactor: simplify
takahashim Oct 25, 2025
b383d37
fix: remove unused methods from BlockProcessor and Compiler
takahashim Oct 25, 2025
d545b2f
fix: add AutoIdProcessor
takahashim Oct 26, 2025
6af295c
chore: pass keyargs config: in ReVIEW::Book::Base.new
takahashim Oct 27, 2025
e32859a
fix: remove build_generic_list
takahashim Oct 27, 2025
ccc4430
refactor: remove Japanese and redundant English comments from AST tests
takahashim Oct 27, 2025
5afcf35
refactor: improve test code quality and enable previously disabled tests
takahashim Oct 27, 2025
5729c24
chore: rubocop
takahashim Oct 27, 2025
dbbc306
fix: add mathml and imgmath support to HtmlRenderer
takahashim Oct 27, 2025
beae05c
chore: use real Chapter and tmpdir in ASTJSONVerificationTest
takahashim Oct 27, 2025
b3a1e27
fix: use real AST::Compiler in test_list_processor
takahashim Oct 27, 2025
2e8067a
fix: use real InlineProcessor in test_caption_parser
takahashim Oct 27, 2025
20f4f3b
chore: remove redundant comments from AST test files
takahashim Oct 28, 2025
cb83a2e
refactor: remove unused methods
takahashim Oct 28, 2025
0c9f800
refactor: simplify nested list assembly with ListItemData methods
takahashim Oct 28, 2025
bdd6bf8
refactor: extract math rendering methods to fix rubocop warning
takahashim Oct 28, 2025
694a365
refactor: extract table processing from BlockProcessor to TableProcessor
takahashim Oct 28, 2025
c33c90c
refactor: remove @caption from TableNode; use @caption_node
takahashim Oct 31, 2025
59a5526
refactor: introduce TableStructure as intermediate representation for…
takahashim Oct 31, 2025
c622b00
refactor: extract TableStructure and CodeBlockStructure
takahashim Oct 31, 2025
98aef86
refactor: use class instance variables
takahashim Oct 31, 2025
0880d3d
chore: remove comments
takahashim Oct 31, 2025
ecbfefd
refactor: remove unused helper methods, optimize cell_type determination
takahashim Oct 31, 2025
14f7f0c
refactor: simplify process_caption to return CaptionNode directly ins…
takahashim Oct 31, 2025
944151a
refactor: move AutoIdProcessor into Compiler namespace
takahashim Oct 31, 2025
27d4bf1
refactor: extract HeadlineParser class and unify caption node creation
takahashim Oct 31, 2025
cc2ba2b
refactor: make more private
takahashim Oct 31, 2025
de492fc
refactor: remove format_location_info and use format_for_error
takahashim Oct 31, 2025
6710c6d
fix: remove @tagged_section
takahashim Oct 31, 2025
52bcbda
refactor: remove unused instance variables @block_context_stack and @…
takahashim Nov 1, 2025
d54b7c6
refactor: make location parameters required and simplify error format…
takahashim Nov 1, 2025
989788e
refactor: use format_for_error for location info
takahashim Nov 1, 2025
5d381bc
refactor: use SnapshotLocation in AST layer
takahashim Nov 1, 2025
d880417
chore: remove old tests
takahashim Nov 1, 2025
ff983ca
refactor: remove safe navigations, location is required
takahashim Nov 1, 2025
01fab06
fix: remove deprecated caption attributes from AST nodes
takahashim Nov 1, 2025
e508df4
refactor: add caption_text to caption-bearing AST nodes
takahashim Nov 1, 2025
d762a48
feat: fix markdown adapter
takahashim Nov 1, 2025
7ff9ded
fix: remove caption: in ColumnNode
takahashim Nov 1, 2025
0cc8b75
refactor: remove caption and headline_caption
takahashim Nov 1, 2025
a6684d6
chore: fix AST::Compiler
takahashim Nov 1, 2025
9b1ce63
refactor: make location parameter required
takahashim Nov 1, 2025
c4fc124
refactor: move BlockData from ast/compiler/ to ast/ directory
takahashim Nov 1, 2025
5cccc18
refactor: standardize processor interface to use BaseProcessor
takahashim Nov 1, 2025
1239e4d
refactor: extract post processors list to instance variable
takahashim Nov 1, 2025
f88538c
chore: update copyright
takahashim Nov 1, 2025
eef8571
chore: fix comments
takahashim Nov 1, 2025
307d0e9
fix: remove unused methods
takahashim Nov 1, 2025
e25d55f
refactor: add full_ref_id method to ReferenceNode and remove fallback…
takahashim Nov 1, 2025
39c40ca
refactor: move text formatting logic from ReferenceNode to ResolvedData
takahashim Nov 1, 2025
0d0b342
refactor: extract reference formatters from renderers
takahashim Nov 1, 2025
914e96f
refactor: fix handling @book and @config
takahashim Nov 2, 2025
2834793
feat: build book-level indexes in AST::BookIndexer
takahashim Nov 2, 2025
baf352d
rafactor: remove redundant index generation from renderers
takahashim Nov 2, 2025
3a71004
refactor: share escape logic between renderers and formatters via mod…
takahashim Nov 2, 2025
2d6a829
refactor: extract inline element handling with context and handler cl…
takahashim Nov 2, 2025
776366e
refactor: parse cross-chapter references at AST construction time
takahashim Nov 2, 2025
2095191
refactor: use ResolvedData for all reference types
takahashim Nov 2, 2025
a1952f3
refactor: move inline methods from HtmlRenderer to InlineElementHandler
takahashim Nov 2, 2025
f499bb3
refactor: remove renderer dependency from IdgxmlReferenceFormatter
takahashim Nov 2, 2025
6a2fec5
refactor: move inline methods from HtmlRenderer to InlineElementHandler
takahashim Nov 2, 2025
f92f3fa
fix: enable ImgMath instance sharing across HtmlRenderer
takahashim Nov 2, 2025
26a2c62
refactor: unify endnote handling to use caption_node like other refer…
takahashim Nov 3, 2025
7685715
refactor: use short_chapter_number consistently across all renderers
takahashim Nov 3, 2025
2a31454
chore: remove comments
takahashim Nov 3, 2025
68754e2
refactor: use post_process instead of override render()
takahashim Nov 3, 2025
b6adeed
refactor: use resolved_data more in LatexRenderer
takahashim Nov 3, 2025
fbae962
refactor: use context helper methods in LatexRenderer table and column
takahashim Nov 3, 2025
6450911
refactor: do not parse in rendering mode; use AST nodes
takahashim Nov 3, 2025
3c351d6
refactor: use resolved_data for heading references in LatexRenderer
takahashim Nov 3, 2025
ea50430
chore: remove comments
takahashim Nov 3, 2025
d35a787
refactor: use resolved_data for references and remove fallback
takahashim Nov 3, 2025
95ddccb
refactor: use resolved? instead of resolved_data
takahashim Nov 3, 2025
2e9c6b2
chore: fix comments
takahashim Nov 3, 2025
6a420a4
fix: do not process :texequation in build_control_command_ast
takahashim Nov 3, 2025
a70a42b
fix: used invalid local variable
takahashim Nov 3, 2025
de9de0e
Remove Re:VIEW 1.x reviewpart environment support from LatexRenderer
takahashim Nov 3, 2025
94a7124
fix: remove unused methods
takahashim Nov 3, 2025
c3e3e30
refactor: add RawContentParser
takahashim Nov 3, 2025
bccc808
refactor: remove unused fallback
takahashim Nov 3, 2025
8396b06
chore: add tests
takahashim Nov 3, 2025
b60f72d
fix: solves inline test
takahashim Nov 3, 2025
64a6e1b
fix: add InlineRenderProxy to delegate render_children only
takahashim Nov 3, 2025
30c3670
refactor: extract inline element handling from IdgxmlRenderer into se…
takahashim Nov 3, 2025
5fe019a
refactor: extract inline element handling from LaTeX renderer into se…
takahashim Nov 3, 2025
575cae8
WIP
takahashim Nov 3, 2025
ac01795
feat: add resolution for bib references in AST building phase
takahashim Nov 3, 2025
be20b63
fix: enforce strict bib reference resolution at AST stage
takahashim Nov 3, 2025
6b9fcab
refactor: rename LATEXComparator to AST::LaTexDiff
takahashim Nov 3, 2025
244e13b
refactor: unify diff interface under ReVIEW::AST::Diff
takahashim Nov 3, 2025
901f816
rubocop: move PreparedData constant and rename :hash to :signature
takahashim Nov 3, 2025
90608bd
fix: restore reviewpart environment support in LatexRenderer
takahashim Nov 3, 2025
6b58876
fix: document should be ended with only one newline
takahashim Nov 3, 2025
1d2187f
refactor: rename HtmlRendererConverterAdapter to RendererConverterAda…
takahashim Nov 3, 2025
1e6408c
fix: simplify BlockData
takahashim Nov 4, 2025
94cb38b
refactor: simplify BlockData TableProcessor
takahashim Nov 4, 2025
6637949
refactor: rename AST::Compiler::BlockContext -> AST::BlockContext
takahashim Nov 4, 2025
1c34e2b
refactor: introduce BlockContext#append_new_node to simplify node cre…
takahashim Nov 5, 2025
4d64321
refactor: remove unused inline element alias methods in LaTeX renderer
takahashim Nov 5, 2025
eeaa0d4
refactor: remove magic string to preserve tabs in AST::Compiler
takahashim Nov 5, 2025
f102a0f
refactor: move test converter classes to test/support and rename to c…
takahashim Nov 5, 2025
18f75c8
refactor: rename EscapeUtils to HtmlEscapeUtils, remove escape_comment
takahashim Nov 5, 2025
57166f5
refactor: add ResolvedData::CaptionedItemReference and rename nested …
takahashim Nov 6, 2025
0a915e0
refactor: remove redundant ResolvedData namespace
takahashim Nov 6, 2025
1402e9f
refactor: use ReferenceNode instead of string ID in resolve methods
takahashim Nov 6, 2025
b611269
refactor: use visit_all_with_caption instead of visit_caption_if_present
takahashim Nov 6, 2025
e43c012
refactor: extract target_chapter_for helper to reduce duplication
takahashim Nov 6, 2025
f01b18d
refactor: add cross_chapter? method to ReferenceNode
takahashim Nov 6, 2025
b7fd586
refactor: remove obvious comments and improve code clarity in Referen…
takahashim Nov 6, 2025
0cf245d
refactor: remove rescue in format_chapter_number
takahashim Nov 6, 2025
2a60fa9
refactor: make row_type of TableRowNode immutable
takahashim Nov 6, 2025
015565c
refactor: consolidate definition list item handlers
takahashim Nov 6, 2025
bad420c
refactor: replace respond_to?(:content) with is_a?(LeafNode) for type…
takahashim Nov 6, 2025
c7b5f8b
refactor: add block support to create_list_node and create_list_item_…
takahashim Nov 6, 2025
ef6c7b1
refactor: move term_children processing into create_list_item_node
takahashim Nov 6, 2025
0f40c2b
refactor: rename BaseProcessor to PostProcessor
takahashim Nov 6, 2025
ea5d299
refactor: remove backward compatibility code for old content format i…
takahashim Nov 6, 2025
e95bf45
refactor: remove backward compatibility code from EmbedNode processing
takahashim Nov 6, 2025
b90191b
refactor: remove deprecated lines and arg attributes from EmbedNode
takahashim Nov 6, 2025
270680a
fix: remove remaining usage of deprecated EmbedNode attributes
takahashim Nov 6, 2025
0280877
refactor: remove unused lines attribute from BlockNode
takahashim Nov 6, 2025
109863e
refactor: update renderers to use child TextNodes instead of node.lines
takahashim Nov 6, 2025
eb473b9
refactor: fix JSON serialization issues in json_serializer.rb
takahashim Nov 6, 2025
74b269e
refactor: remove unused simple_mode from JSON serializer
takahashim Nov 6, 2025
c72203d
refactor: remove unused include_empty_arrays option from JSONSerializer
takahashim Nov 6, 2025
6da1efe
test: add comprehensive tests for include_location option
takahashim Nov 6, 2025
1d224b1
refactor: remove unused to_h method from JSONSerializer::Options
takahashim Nov 6, 2025
626e87f
refactor: remove dead code in render_definition_term
takahashim Nov 6, 2025
58ce49e
refactor: move reference formatting methods to TopReferenceFormatter
takahashim Nov 6, 2025
c378c46
refactor: remove unused methods from AST node classes
takahashim Nov 7, 2025
a4662b2
refactor: use leaf_node? method
takahashim Nov 6, 2025
3a91d17
refactor: add AST::Node#reference_node? method
takahashim Nov 6, 2025
24be7f3
refactor: use require_relative for same-directory requires
takahashim Nov 7, 2025
9a4b03e
refactor: make ImageNode and TexEquationNode inherit from LeafNode
takahashim Nov 7, 2025
2a22595
refactor: remove redundant id definitions
takahashim Nov 7, 2025
774010f
feat: add content support to ImageNode and TexEquationNode JSON seria…
takahashim Nov 7, 2025
913b936
refactor: LeafNode should have content as String
takahashim Nov 7, 2025
d4ef3bc
refactor: delegate JSON deserialization role to nodes
takahashim Nov 7, 2025
cf028aa
fix: add JSON serialization support for FootnoteNode, ReferenceNode a…
takahashim Nov 7, 2025
55f7eab
fix: add deserialize_from_hash method to TextNode
takahashim Nov 7, 2025
f8821d5
refactor extract nested classes in ResolvedData to separate files
takahashim Nov 7, 2025
3f33792
refactor: unify format_with pattern in ResolvedData hierarchy
takahashim Nov 7, 2025
fb832ff
refactor: refactor ResolvedData.deserialize_from_hash to use const_get
takahashim Nov 7, 2025
4767b1d
refactor: Extract ListItemNode to separate file
takahashim Nov 7, 2025
7e6504a
fix: ensure LeafNode content is always a string, never nil
takahashim Nov 7, 2025
3db0233
refactor: introduce Captionable to node classes with caption_node
takahashim Nov 7, 2025
24a6a2b
refactor: remove obsolete hash['content'] backward compatibility code…
takahashim Nov 7, 2025
3c931e6
refactor: remove redundant caption_node attr declarations from Captio…
takahashim Nov 7, 2025
5b480ec
refactor: remove unused caption? and id? methods from AST classes
takahashim Nov 7, 2025
95e8a33
refactor: remove unnecessary respond_to?(:children) checks from AST p…
takahashim Nov 7, 2025
cc6aa42
refactor: simplify caption_node.to_text calls by removing respond_to?…
takahashim Nov 7, 2025
44f255f
chore: chapter should have book in TableProcessor
takahashim Nov 7, 2025
b17fc11
refactor: reorganize method order in AST::Compiler for visibility
takahashim Nov 7, 2025
d1dedae
refactor: Remove unused DocumentNode.chapter attribute
takahashim Nov 7, 2025
fd9fc45
fix: use Node#caption_node method instead of caption_to_text and capt…
takahashim Nov 7, 2025
2497981
refactor: fix PostProcessor method naming and initialization
takahashim Nov 7, 2025
ae73636
refactor: separate plain text and markup generation for CaptionNode
takahashim Nov 7, 2025
c11ad34
refactor: replace to_text with to_inline_text using polymorphism
takahashim Nov 7, 2025
de87dc8
refactor: convert BlockData, CodeBlockStructure and TableStructure to…
takahashim Nov 7, 2025
2c4da9e
doc: add and update some documents
takahashim Nov 8, 2025
1b62b43
fix: remove unused accept methods
takahashim Nov 8, 2025
4120855
chore: add comment
takahashim Nov 8, 2025
1d9d557
refactor: process_inline_content is used in Renderer::Base
takahashim Nov 8, 2025
827a9cd
refactor: centralize I18n and text formatting in TextFormatter
takahashim Nov 8, 2025
223d640
feat: add test for TextFormatter
takahashim Nov 8, 2025
c40c6d4
refactor: move TextFormatter from Renderer to AST namespace
takahashim Nov 8, 2025
188ac32
refactor: reduce code duplication in TextFormatter reference formatting
takahashim Nov 8, 2025
e5b165c
refactor: remove extract_short_chapter_number and store chapter numbe…
takahashim Nov 8, 2025
ac751e1
refactor: add chapter_type and fix handling chapter_number
takahashim Nov 9, 2025
d4a9b7d
fix: TextFormatter is independent with Renderers
takahashim Nov 9, 2025
2237e7f
fix: remove to_text and TextFormatter in ResolvedData
takahashim Nov 9, 2025
63f465f
refactor: share same InlineRenderProxy in each renderers
takahashim Nov 9, 2025
48c8cb9
refactor: use render_caption_inline instead of render_caption_markup …
takahashim Nov 9, 2025
10e1b0a
refactor: AST::TextFormatter -> Renderer::TextFormatter
takahashim Nov 9, 2025
074f80f
refactor: initialize TextFormatter eagerly in Renderer::Base
takahashim Nov 9, 2025
5641b16
fix: remove @ctx
takahashim Nov 9, 2025
18363ec
fix: remove visit_inline; use in Renderer::Base
takahashim Nov 9, 2025
09c816c
fix: define render_inline_element in all renderers
takahashim Nov 9, 2025
c7efd22
feat: update samples/debug-book
takahashim Nov 9, 2025
cf39984
fix: support blankline command
takahashim Nov 9, 2025
c2f8523
refactor: rename ReVIEW::AST::*Maker -> ReVIEW::AST::Command::*Maker
takahashim Nov 10, 2025
ad22540
refactor: build book indexes before build chapters in EpubMaker
takahashim Nov 10, 2025
1e570f5
refactor: rename ReVIEW::AST::*Maker -> ReVIEW::AST::Command::*Maker
takahashim Nov 10, 2025
ea42950
refactor: resolve rubocop Style/SpecialGlobalVars cop
takahashim Nov 10, 2025
ed1bea3
fix: enable to dump AST with references
takahashim Nov 10, 2025
2e4efd3
fix: lost some information of ListItemNode
takahashim Nov 11, 2025
470edf7
fix: add AST::Comparator and improve ReVIEW Generator for roundtrip c…
takahashim Nov 11, 2025
410bcc0
refactor: rename AST::ComparisonResult -> AST::Comparator::Result
takahashim Nov 11, 2025
0679118
fix: some bugs in ReVIEWGenerator
takahashim Nov 11, 2025
00ab43e
fix: refactor ReVIEWGenerator to use dynamic dispatch and consolidate…
takahashim Nov 11, 2025
7c308f6
feat: enhance MarkdownRenderer with inline element handling
takahashim Nov 11, 2025
fdb3487
fix: add reference support to MarkdownRenderer with inline HTML and M…
takahashim Nov 11, 2025
324a6ad
feat: support inline markup for Markdown
takahashim Nov 11, 2025
da8dfda
refactor: use Markly footnotes and InlineTokenizer, and fix column ma…
takahashim Nov 11, 2025
5c72f35
refactor: improve MarkdownAdapter state management with ContextStack
takahashim Nov 11, 2025
575efb3
refactor: nest ContextStack in MarkdownAdapter and use CompileError
takahashim Nov 11, 2025
008c8a7
refactor: simplify ContextStack to use standard stack implementation
takahashim Nov 12, 2025
0c3a955
refactor: remove @last_table_node by using @current_node.children.last
takahashim Nov 12, 2025
110c3e0
refactor: eliminate @current_node and @column_stack; use ContextStack
takahashim Nov 12, 2025
8c518a7
refactor: eliminate @column_heading_levels; use ContextStack
takahashim Nov 12, 2025
1960d34
refactor: use while instad of (infinite) loop
takahashim Nov 12, 2025
ff5b6f8
refactor: move InlineTokenizer initialization to initialize method
takahashim Nov 12, 2025
cb9c37e
docs: update ast_markdown.md to reflect current implementation
takahashim Nov 12, 2025
74d7a46
fix: add missing inline/block elements and I18n caption formatting to…
takahashim Nov 12, 2025
855cb40
fix: correct TopRenderer table/footnote methods to match TOPBuilder a…
takahashim Nov 12, 2025
3e7e8c1
feat: add AST TextMaker command with TopRenderer and PlaintextRendere…
takahashim Nov 12, 2025
b4fa08e
fix: remove debug mode check of AST configuration
takahashim Nov 12, 2025
5c9287c
WIP
takahashim Nov 12, 2025
372cd36
fix: fix footnotes and embeds in LaTeX renderer
takahashim Nov 12, 2025
a015d91
fix: support hr and uchar in Markdown
takahashim Nov 13, 2025
05e6a75
fix: extension of Markdown should be only `.md`
takahashim Nov 13, 2025
f30efd2
fix: update tests for Markdown
takahashim Nov 13, 2025
b83c927
doc: update AST docs
takahashim Nov 13, 2025
6469e7e
doc: add EN docs for AST
takahashim Nov 14, 2025
7aa5a79
fix: Re:VIEW supports *.md files, not *.markdown
takahashim Nov 14, 2025
567dd19
fix: use Struct instead of Data to support Ruby 3.1
takahashim Nov 14, 2025
a10d6db
fix: support Markdown only for Ruby >= 3.1
takahashim Nov 15, 2025
3d25dde
fix: support Ruby 3.0.x
takahashim Nov 15, 2025
f3e4695
refactor: add conditional development dependencies in Gemfile
takahashim Nov 15, 2025
ea816b5
revert HTMLUtils
takahashim Dec 1, 2025
707de22
fix: handle nil node.id in MarkdownRenderer#visit_table and remove du…
takahashim Dec 1, 2025
a2fa22a
fix: drop Gemfile exclusion since non-gemspec dependencies were remov…
takahashim Dec 1, 2025
a53a70f
fix: disable syntax highlighting when code block contains inline elem…
takahashim Dec 1, 2025
a578c05
refactor: extract render_mathjax_format method from render_math_format
takahashim Dec 7, 2025
ac9bc3f
refactor: rename has_inline_elements? to contains_inline? and fix Rub…
takahashim Dec 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@ source 'https://rubygems.org'

# Specify your gem's dependencies in review.gemspec
gemspec

# Development dependencies
group :development do
# markly gem (for Markdown support) requires Ruby >= 3.1
# On Ruby 3.0, tests will be skipped but Re:VIEW will work with .re files
gem 'markly', '~> 0.13' if Gem.ruby_version >= Gem::Version.new('3.1.0')
end
8 changes: 8 additions & 0 deletions bin/review-ast-compile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

$LOAD_PATH.unshift(File.realpath('../lib', __dir__))

require 'review/ast/command/compile'

exit ReVIEW::AST::Command::Compile.new.run(ARGV)
106 changes: 106 additions & 0 deletions bin/review-ast-dump
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# Copyright (c) 2025 Kenshi Muto, Masayoshi Takahashi
#
# This program is free software.
# You can distribute or modify this program under the terms of
# the GNU LGPL, Lesser General Public License version 2.1.

require 'pathname'

bindir = Pathname.new(__FILE__).realpath.dirname
$LOAD_PATH.unshift((bindir + '../lib').realpath)

require 'review/init'
require 'review/ast/dumper'
require 'review/ast/json_serializer'
require 'optparse'

def parse_options
config = ReVIEW::Configure.values
output_file = nil
serializer_options = ReVIEW::AST::JSONSerializer::Options.new

opts = OptionParser.new
opts.version = ReVIEW::VERSION
opts.banner = "Usage: #{File.basename($PROGRAM_NAME, '.*')} [options] CHAPTER.re\n" \
'Dump Re:VIEW document as AST in JSON format'

opts.on('-c', '--config=FILE', 'specify config file') do |file|
config.deep_merge!(ReVIEW::Configure.create(yamlfile: file).values)
end

opts.on('-o', '--output=FILE', 'output to FILE instead of stdout') do |file|
output_file = file
end

opts.on('--[no-]pretty', 'pretty print JSON (default: true)') do |v|
serializer_options.pretty = v
end

opts.on('--[no-]location', 'include location information (default: true)') do |v|
serializer_options.include_location = v
end

opts.on('--indent=INDENT', 'indentation for pretty print (default: " ")') do |v|
serializer_options.indent = v
end

opts.on('--compact', 'compact output (no location, no pretty print)') do
serializer_options.pretty = false
serializer_options.include_location = false
end

opts.on('--help', 'print help and exit') do
puts opts.help
exit 0
end

begin
opts.parse!
rescue OptionParser::InvalidOption => e
$stderr.puts e.message
$stderr.puts opts.help
exit 1
end

if ARGV.empty?
$stderr.puts 'No input files.'
$stderr.puts opts.help
exit 1
end

[config, output_file, serializer_options]
end

def dump_files(dumper, output_file)
ARGV.each do |path|
output = dumper.dump_file(path)

if output_file
File.write(output_file, output)
$stderr.puts "Output written to: #{output_file}"
else
puts output
end
end
end

def main
config, output_file, serializer_options = parse_options
dumper = ReVIEW::AST::Dumper.new(config: config, serializer_options: serializer_options)

begin
dump_files(dumper, output_file)
rescue ReVIEW::ApplicationError, ReVIEW::FileNotFound => e
$stderr.puts "Error: #{e.message}"
exit 1
rescue StandardError => e
$stderr.puts "Fatal error: #{e.class}: #{e.message}"
$stderr.puts e.backtrace if $DEBUG
exit 1
end
end

main
107 changes: 107 additions & 0 deletions bin/review-ast-dump2re
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# Copyright (c) 2025 Kenshi Muto, Masayoshi Takahashi
#
# This program is free software.
# You can distribute or modify this program under the terms of
# the GNU LGPL, Lesser General Public License version 2.1.

require 'pathname'

bindir = Pathname.new(__FILE__).realpath.dirname
$LOAD_PATH.unshift((bindir + '../lib').realpath)

require 'review/init'
require 'review/ast'
require 'review/ast/json_serializer'
require 'review/ast/review_generator'
require 'optparse'
require 'json'

def main
options = {
output: nil
}

parser = OptionParser.new do |opts|
opts.banner = 'Usage: review-ast2re [options] FILE'
opts.version = ReVIEW::VERSION

opts.on('-o', '--output FILE', 'Output file (default: stdout)') do |file|
options[:output] = file
end

opts.on_tail('-h', '--help', 'Show this message') do
puts opts
exit
end
end

begin
parser.parse!
rescue OptionParser::InvalidOption => e
$stderr.puts "Error: #{e.message}"
puts parser
exit 1
end

if ARGV.empty? && $stdin.tty?
$stderr.puts 'Error: No input file specified'
puts parser
exit 1
end

input_file = ARGV[0] || '-'

# Read JSON AST
begin
if input_file == '-'
json_data = $stdin.read
else
unless File.exist?(input_file)
$stderr.puts "Error: Input file not found: #{input_file}"
exit 1
end
json_data = File.read(input_file)
end
rescue StandardError => e
$stderr.puts "Error reading input file: #{e.message}"
exit 1
end

# Deserialize JSON to AST
begin
ast_root = ReVIEW::AST::JSONSerializer.deserialize(json_data)
rescue JSON::ParserError => e
$stderr.puts "Error parsing JSON: #{e.message}"
exit 1
rescue StandardError => e
$stderr.puts "Error deserializing AST: #{e.message}"
exit 1
end

# Generate Re:VIEW text
begin
generator = ReVIEW::AST::ReVIEWGenerator.new
review_text = generator.generate(ast_root)
rescue StandardError => e
$stderr.puts "Error generating Re:VIEW text: #{e.message}"
$stderr.puts e.backtrace if ENV['DEBUG']
exit 1
end

# Output result
begin
if options[:output]
File.write(options[:output], review_text)
else
puts review_text
end
rescue StandardError => e
$stderr.puts "Error writing output: #{e.message}"
exit 1
end
end

main
18 changes: 18 additions & 0 deletions bin/review-ast-epubmaker
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env ruby

# frozen_string_literal: true

# Copyright (c) 2025 Kenshi Muto, Masayoshi Takahashi
#
# This program is free software.
# You can distribute or modify this program under the terms of
# the GNU LGPL, Lesser General Public License version 2.1.

require 'pathname'

bindir = Pathname.new(__FILE__).realpath.dirname
$LOAD_PATH.unshift((bindir + '../lib').realpath)

require 'review/ast/command/epub_maker'

ReVIEW::AST::Command::EpubMaker.execute(*ARGV)
18 changes: 18 additions & 0 deletions bin/review-ast-idgxmlmaker
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env ruby

# frozen_string_literal: true

# Copyright (c) 2025 Kenshi Muto, Masayoshi Takahashi
#
# This program is free software.
# You can distribute or modify this program under the terms of
# the GNU LGPL, Lesser General Public License version 2.1.

require 'pathname'

bindir = Pathname.new(__FILE__).realpath.dirname
$LOAD_PATH.unshift((bindir + '../lib').realpath)

require 'review/ast/command/idgxml_maker'

ReVIEW::AST::Command::IdgxmlMaker.execute(*ARGV)
18 changes: 18 additions & 0 deletions bin/review-ast-pdfmaker
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env ruby

# frozen_string_literal: true

# Copyright (c) 2025 Kenshi Muto, Masayoshi Takahashi
#
# This program is free software.
# You can distribute or modify this program under the terms of
# the GNU LGPL, Lesser General Public License version 2.1.

require 'pathname'

bindir = Pathname.new(__FILE__).realpath.dirname
$LOAD_PATH.unshift((bindir + '../lib').realpath)

require 'review/ast/command/pdf_maker'

ReVIEW::AST::Command::PdfMaker.execute(*ARGV)
18 changes: 18 additions & 0 deletions bin/review-ast-textmaker
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env ruby

# frozen_string_literal: true

# Copyright (c) 2025 Kenshi Muto, Masayoshi Takahashi
#
# This program is free software.
# You can distribute or modify this program under the terms of
# the GNU LGPL, Lesser General Public License version 2.1.

require 'pathname'

bindir = Pathname.new(__FILE__).realpath.dirname
$LOAD_PATH.unshift((bindir + '../lib').realpath)

require 'review/ast/command/text_maker'

ReVIEW::AST::Command::TextMaker.execute(*ARGV)
Loading