Skip to content

feat: aggiungi flag --no-notes per escludere blocchi AGGIORNAMENTO#25

Merged
aborruso merged 2 commits into
mainfrom
feature/no-notes-flag
Jun 5, 2026
Merged

feat: aggiungi flag --no-notes per escludere blocchi AGGIORNAMENTO#25
aborruso merged 2 commits into
mainfrom
feature/no-notes-flag

Conversation

@aborruso

@aborruso aborruso commented Jun 5, 2026

Copy link
Copy Markdown
Member

Summary

  • Aggiunge flag --no-notes alla CLI per escludere i blocchi AGGIORNAMENTO (note storiche delle modifiche normative) dall'output Markdown
  • Aggiunge parametro no_notes=False alle funzioni convert_url() e convert_xml() dell'API pubblica
  • I blocchi (( )) (modifiche inline al testo vigente) non vengono toccati
  • Propagazione completa lungo tutta la call chain: CLI → api.py → markdown_converter.py

Motivazione

Chiude #24. I blocchi AGGIORNAMENTO introducono rumore nelle pipeline RAG su testi normativi.

Utilizzo

# CLI
normattiva2md --no-notes input.xml

# API Python
from normattiva2md import convert_xml
md = convert_xml("input.xml", no_notes=True)

Test plan

  • 6 nuovi test in tests/test_no_notes.py
  • Fix tests/test_cli_validation.py (aggiunto no_notes=False al Namespace mock)
  • Smoke test: 0 occorrenze AGGIORNAMENTO con --no-notes, 34 senza

Versione

2.1.102.1.11

aborruso and others added 2 commits June 5, 2026 13:19
Aggiunge opzione --no-notes alla CLI e no_notes=False all'API per
filtrare le note storiche AGGIORNAMENTO dall'output Markdown, utile
per pipeline RAG su testi normativi.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 5, 2026 11:19
@aborruso
aborruso merged commit db12ce8 into main Jun 5, 2026
@aborruso
aborruso deleted the feature/no-notes-flag branch June 5, 2026 11:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Questo PR introduce un’opzione per escludere dall’output Markdown i blocchi di note “AGGIORNAMENTO”, utile per ridurre rumore nelle pipeline RAG, mantenendo intatti i marker di modifiche inline (( ... )).

Changes:

  • Aggiunge il flag CLI --no-notes e lo propaga fino alla conversione Markdown.
  • Espone no_notes: bool = False nell’API pubblica (convert_url, convert_xml) e lo inoltra nella call chain.
  • Aggiunge una nuova suite di test dedicata e aggiorna test esistenti; bump versione a 2.1.11 e aggiorna documentazione/spec OpenSpec.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/test_no_notes.py Nuovi test per verificare esclusione “AGGIORNAMENTO” e preservazione (( ... )).
tests/test_cli_validation.py Aggiorna il mock del Namespace per includere no_notes.
src/normattiva2md/markdown_converter.py Implementa filtro no_notes in process_content_with_paragraphs e propaga il parametro lungo la conversione.
src/normattiva2md/cli.py Aggiunge --no-notes alla CLI (argparse + help) e lo passa alla conversione.
src/normattiva2md/api.py Aggiunge no_notes a convert_url/convert_xml e lo passa a generate_markdown_text.
setup.py Bump versione package a 2.1.11.
pyproject.toml Bump versione progetto a 2.1.11.
openspec/changes/add-no-notes-flag/tasks.md Task list per implementazione/validazione.
openspec/changes/add-no-notes-flag/specs/markdown-conversion/spec.md Delta spec per il comportamento di conversione Markdown.
openspec/changes/add-no-notes-flag/specs/cli-interface/spec.md Delta spec per interfaccia CLI.
openspec/changes/add-no-notes-flag/proposal.md Proposal/architettura della modifica e catena di propagazione.
LOG.md Log di progetto aggiornato con la feature --no-notes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +31 to +34
#### Scenario: Filtering scope limited to AGGIORNAMENTO paragraphs
- **WHEN** `no_notes=True` and an article contains both normal paragraphs and AGGIORNAMENTO blocks
- **THEN** only paragraphs whose text starts with `AGGIORNAMENTO` SHALL be omitted
- **AND** all other paragraph text SHALL appear in the output unchanged

## Implementation

- [ ] **1. markdown_converter.py** — aggiunge `no_notes=False` a `process_content_with_paragraphs()`: salta i paragrafi che iniziano con `"AGGIORNAMENTO"` quando `no_notes=True`
→ process_content_with_paragraphs(no_notes=...)
```

Punto di filtraggio: in `process_content_with_paragraphs()` (markdown_converter.py:222), quando `no_notes=True`, i paragrafi che iniziano con `"AGGIORNAMENTO"` vengono saltati.
Comment thread src/normattiva2md/api.py
Comment on lines 58 to 62
with_urls: bool = False,
force_opendata: bool = False,
quiet: bool = False,
no_notes: bool = False,
) -> Optional[ConversionResult]:
Comment thread src/normattiva2md/api.py
Comment on lines 184 to 188
with_urls: bool = False,
metadata: Optional[Dict] = None,
quiet: bool = False,
no_notes: bool = False,
) -> Optional[ConversionResult]:
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.

2 participants