Public Access
G1 step 2: Gemini parsers (host-tested), and the memory decision (Q86)
lib/gemini: URLs split per RFC 3986 appendix B and resolved per section 5.2 (all 32 reference examples of 5.4 pass, with gemini:// for http://), the request form (no fragment, lower-case host, never an empty path), query encoding for input prompts, Saved Page paths; the response header (status, category, MIME type and parameters, 1024-byte meta limit); gemtext's line types; and display text for the Latin-1 fonts. 12 tests. Q86, decided after step 1: free heap stays above 40 KB in steady state and 20 KB during a handshake; a fetch won't start below 55 KB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace roro::gemini {
|
||||
|
||||
enum class LineType { Text, Link, Heading1, Heading2, Heading3, ListItem, Quote, PreToggle, Preformatted };
|
||||
|
||||
// One gemtext line. Link: `url` and its label in `text` (the URL itself without a label).
|
||||
// PreToggle: the ``` line, with its alt text. Preformatted: kept exactly.
|
||||
struct GemLine {
|
||||
LineType type = LineType::Text;
|
||||
std::string text, url;
|
||||
};
|
||||
|
||||
std::vector<GemLine> parseGemtext(const std::string& document);
|
||||
|
||||
// For the Latin-1 fonts (Q79): valid UTF-8 up to U+00FF kept, anything else '?', and tabs
|
||||
// expanded to 4-column stops.
|
||||
std::string displayText(const std::string& utf8);
|
||||
|
||||
} // namespace roro::gemini
|
||||
Reference in New Issue
Block a user