TUT/Makefile
m1ngsama ab2d1932e4 feat: Transform to vim-style terminal browser (#10)
* feat: Add HTTP/HTTPS client module

Implement HTTP client with libcurl for fetching web pages:
- Support for HTTP and HTTPS protocols
- Configurable timeout and user agent
- Automatic redirect following
- SSL certificate verification
- Pimpl pattern for implementation hiding

This module provides the foundation for web page retrieval
in the terminal browser.

* feat: Add HTML parser and content extraction

Implement HTML parser for extracting readable content:
- Parse HTML structure (headings, paragraphs, lists, links)
- Extract and decode HTML entities
- Smart content area detection (article, main, body)
- Relative URL to absolute URL conversion
- Support for both absolute and relative paths
- Filter out scripts, styles, and non-content elements

The parser uses regex-based extraction optimized for
text-heavy websites and documentation.

* feat: Add newspaper-style text rendering engine

Implement text renderer with adaptive layout:
- Adaptive width with maximum 80 characters
- Center-aligned content for comfortable reading
- Smart text wrapping and paragraph spacing
- Color scheme optimized for terminal reading
- Support for headings, paragraphs, lists, and links
- Link indicators with numbering
- Horizontal rules and visual separators

The renderer creates a newspaper-like reading experience
optimized for terminal displays.

* feat: Implement vim-style input handling

Add complete vim-style keyboard navigation:
- Normal mode: hjkl movement, gg/G jump, numeric prefixes
- Command mode: :q, :o URL, :r, :h, :[number]
- Search mode: / for search, n/N for next/previous match
- Link navigation: Tab/Shift-Tab, Enter to follow
- Scroll commands: Ctrl-D/U, Space, b for page up/down
- History navigation: h for back, l for forward

Input handler manages mode transitions and command parsing
with full vim compatibility.

* feat: Implement browser core with TUI interface

Add main browser engine and user interface:
- Page loading with HTTP client integration
- HTML parsing and text rendering pipeline
- History management (back/forward navigation)
- Link selection and following with Tab navigation
- Search functionality with highlighting
- Scrolling with position tracking
- Status bar with mode indicator and progress
- Built-in help page with usage instructions
- Error handling and user feedback
- Support for static HTML websites

The browser provides a complete vim-style terminal
browsing experience optimized for reading text content.

* build: Update build system for terminal browser

Update CMake and add Makefile for the new project:
- Rename project from NBTCA_TUI to TUT
- Update executable name from nbtca_tui to tut
- Add all new source files to build
- Include Makefile for environments without CMake
- Update .gitignore for build artifacts

Both CMake and Make build systems are now supported
for maximum compatibility.

* docs: Complete project transformation to terminal browser

Transform project from ICS calendar viewer to terminal browser:
- Rewrite main.cpp for browser launch with URL argument support
- Complete README rewrite with:
  - New project description and features
  - Comprehensive keyboard shortcuts documentation
  - Installation guide for multiple platforms
  - Usage examples and best practices
  - JavaScript/SPA limitations explanation
  - Architecture overview
- Add help command line option
- Update version to 1.0.0

The project is now TUT (Terminal User Interface Browser),
a vim-style terminal web browser optimized for reading.
2025-12-05 15:01:21 +08:00

44 lines
726 B
Makefile

# Makefile for TUT Browser
CXX = clang++
CXXFLAGS = -std=c++17 -Wall -Wextra -O2
LDFLAGS = -lncurses -lcurl
# 源文件
SOURCES = src/main.cpp \
src/http_client.cpp \
src/html_parser.cpp \
src/text_renderer.cpp \
src/input_handler.cpp \
src/browser.cpp
# 目标文件
OBJECTS = $(SOURCES:.cpp=.o)
# 可执行文件
TARGET = tut
# 默认目标
all: $(TARGET)
# 链接
$(TARGET): $(OBJECTS)
$(CXX) $(OBJECTS) $(LDFLAGS) -o $(TARGET)
# 编译
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
# 清理
clean:
rm -f $(OBJECTS) $(TARGET)
# 运行
run: $(TARGET)
./$(TARGET)
# 安装
install: $(TARGET)
install -m 755 $(TARGET) /usr/local/bin/
.PHONY: all clean run install