public inbox for ~johnnyrichard/olang-devel@lists.sr.ht
 help / color / mirror / code / Atom feed
From: Johnny Richard <johnny@johnnyrichard.com>
To: ~johnnyrichard/olang-devel@lists.sr.ht
Cc: Johnny Richard <johnny@johnnyrichard.com>
Subject: [PATCH olang v4 3/4] docs: create man page for 0c compiler
Date: Mon, 19 Feb 2024 22:04:10 +0100	[thread overview]
Message-ID: <20240219210541.25624-4-johnny@johnnyrichard.com> (raw)
In-Reply-To: <20240219210541.25624-1-johnny@johnnyrichard.com>

Since the 0c compiler contains a --dump-tokens functionality, it has
been documented as well.

The site build has been adapted to accommodate the manpages build.
Everything should work as before for site generation.

Signed-off-by: Johnny Richard <johnny@johnnyrichard.com>
---
 docs/Makefile       | 21 +++++++++++++++------
 docs/manpages/0c.md | 21 +++++++++++++++++++++
 src/0c.c            |  1 -
 3 files changed, 36 insertions(+), 7 deletions(-)
 create mode 100644 docs/manpages/0c.md

diff --git a/docs/Makefile b/docs/Makefile
index 731da5d..54561a1 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -1,14 +1,16 @@
 PANDOC     := pandoc
 INDEX      := index.md
 BUILD_DIR  := build
-TARGET     := $(BUILD_DIR)/index.html
+SITE_DIR   := $(BUILD_DIR)/site
+TARGET     := $(SITE_DIR)/index.html
 DIST_FILE  := site.tar.gz
 PAGES_DIR  := pages
+MANPAGES   := $(BUILD_DIR)/man
 PAGES      := $(wildcard $(PAGES_DIR)/*.md)
-HTML_PAGES := $(patsubst $(PAGES_DIR)/%.md, $(BUILD_DIR)/$(PAGES_DIR)/%.html, $(PAGES))
+HTML_PAGES := $(patsubst $(PAGES_DIR)/%.md, $(SITE_DIR)/$(PAGES_DIR)/%.html, $(PAGES))
 
 .PHONY: all
-all:  $(BUILD_DIR) $(TARGET) $(PAGES)
+all:  $(BUILD_DIR) $(TARGET) $(PAGES) manpages
 
 .PHONY: clean
 clean:
@@ -18,15 +20,22 @@ clean:
 .PHONY: dist
 dist: $(DIST_FILE)
 
+.PHONY: manpages
+manpages: $(BUILD_DIR) $(MANPAGES)/0c.1
+
+$(MANPAGES)/%.1: manpages/%.md
+	$(PANDOC) -s -t man $< > $@
+
 $(DIST_FILE): all
-	tar -czf $(DIST_FILE) -C $(BUILD_DIR) .
+	tar -czf $(DIST_FILE) -C $(SITE_DIR) .
 
 $(TARGET): $(HTML_PAGES)
 	$(PANDOC) -s --template template.html -f markdown -t html $(INDEX) > $(TARGET)
 
 $(BUILD_DIR):
 	@mkdir -p $@
-	@mkdir -p $@/$(PAGES_DIR)
+	@mkdir -p $(SITE_DIR)/$(PAGES_DIR)
+	@mkdir -p $(MANPAGES)
 
-$(BUILD_DIR)/$(PAGES_DIR)/%.html: $(PAGES_DIR)/%.md
+$(SITE_DIR)/$(PAGES_DIR)/%.html: $(PAGES_DIR)/%.md
 	$(PANDOC) -s --template template.html -f markdown -t html --toc $< > $@
diff --git a/docs/manpages/0c.md b/docs/manpages/0c.md
new file mode 100644
index 0000000..87a56df
--- /dev/null
+++ b/docs/manpages/0c.md
@@ -0,0 +1,21 @@
+% 0C(1)
+% olang mantainers
+% Feb 2024
+
+# NAME
+
+0c - zero langague compiler
+
+# SYNOPSIS
+
+**0c** **----dump-tokens** source.0
+
+# DESCRIPTION
+
+**0c** is the offical compiler for zero language, it is also a tool that
+contains utilities to help the language development.
+
+# GENERAL OPTIONS
+
+**----dump-tokens**
+:   Display lexical tokens given a soruce.0 code.
diff --git a/src/0c.c b/src/0c.c
index 0af9caa..e84559d 100644
--- a/src/0c.c
+++ b/src/0c.c
@@ -34,7 +34,6 @@ cli_args_shift(cli_args_t *args);
 
 typedef struct cli_opts
 {
-    // TODO: create man page instruction for --dump-tokens option
     bool dump_tokens;
     char *file_path;
 } cli_opts_t;
-- 
2.43.2


  parent reply	other threads:[~2024-02-19 20:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-19 21:04 [PATCH olang v4 0/4] Create --dump-tokens on compiler cli Johnny Richard
2024-02-19 21:04 ` [PATCH olang v4 1/4] utils: create string_view data structure Johnny Richard
2024-02-19 21:04 ` [PATCH olang v4 2/4] lexer: create --dump-tokens cli command Johnny Richard
2024-02-19 21:04 ` Johnny Richard [this message]
2024-02-19 21:04 ` [PATCH olang v4 4/4] lexer: test: add integration tests for --dump-tokens Johnny Richard
2024-02-19 20:07   ` [olang/patches/.build.yml] build failed builds.sr.ht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240219210541.25624-4-johnny@johnnyrichard.com \
    --to=johnny@johnnyrichard.com \
    --cc=~johnnyrichard/olang-devel@lists.sr.ht \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.johnnyrichard.com/olang.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox