Skip to content

Modernize: Ruby 3.1+, tag notes (@TODO), plain gemspec and CI - #21

Merged
trans merged 1 commit into
masterfrom
modernize
Nov 30, 2026
Merged

trans merged 1 commit into
masterfrom
modernize

Conversation

@trans

@trans trans commented Nov 30, 2026

Copy link
Copy Markdown
Member

DNote 1.7.1 fails on Ruby 3 with "wrong number of arguments (given 3, expected 1)", from ERB.new called with positional arguments. This gets it running again and adds the tag syntax asked for in #13.

Tag notes (closes #13)

A note can be written as a tag, in the manner of YARD, with no colon needed:

# @TODO Refactor this,
#   over two lines.
  • A tag in capitals is always a note.
  • The usual labels (TODO, FIXME, OPTIMIZE, THINK, DEPRECATE) are notes in lower case too, so YARD's own @todo is collected.
  • Other lower-case tags (@param, @return, @note) are left alone unless asked for with --label.
  • A tag note ends at the next tag.
  • --no-tags turns it off.

Fixes

  • The first line of code after a note was left out of its context (-c).
  • html/list (a <$ end %> typo) and xml/file (a misnamed variable) failed whenever there were notes.
  • The xoxo formats recursed without end; they are now given plain hashes.
  • by_label_file and by_file_label shared a cache with by_label and by_file, so whichever was called second returned the other's result.
  • The Rake task relied on methods from another tool's task library (application, report, trial?) and had no initialize; it is now an ordinary Rake::TaskLib.
  • --dryrun still wrote the file.
  • Code context is escaped in the HTML formats.
  • A file that isn't valid UTF-8 no longer stops the run.
  • A format whose library isn't installed (soap needs soap4r-ng, xoxo needs xoxo) says so instead of a backtrace.

Other changes

  • The string methods the templates use (indent, tabset, margin, tabto) are refinements, no longer added to String. Custom templates still have them.
  • REXML is no longer needed (ERB::Util.html_escape does the escaping).
  • DNote::VERSION is a plain constant; lib/dnote.yml is gone.
  • Plain dnote.gemspec, Gemfile, Rakefile and GitHub Actions CI (Ruby 3.1 to 4.0); the old build files are removed.
  • 62 tests, on Lemon as before, with fixtures. All 36 formats were run by hand, soap and xoxo with their gems installed.

Version is set to 1.8.0, with the History entry marked unreleased. The 1.7.1 entry, which was in the published gem but never committed, is added.

🤖 Generated with Claude Code

DNote failed on Ruby 3 (ERB.new with positional arguments). It runs
again, and notes can be written as tags in the manner of YARD
(@todo, and @todo for the usual labels), which closes #13.

Fixed on the way: the first code line of a note's context was lost;
html/list and xml/file failed; xoxo never finished; by_label_file and
by_file_label shared a cache with by_label and by_file; the Rake task
relied on another tool's task library; --dryrun still wrote.

The templates' string methods are refinements now, not added to
String. REXML is no longer needed. Tests are on Lemon, as before,
with fixtures. The old build files are removed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@trans
trans merged commit 811784e into master Nov 30, 2026
10 checks passed
@trans
trans deleted the modernize branch November 30, 2026 05:43
@trans trans mentioned this pull request Nov 30, 2026
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.

Support YARD like @label Syntax

1 participant