mandoc 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f98e2d86617e25d67411ee76847b84f7bcd2b1ed85876a6b40cb5dcc913058d6
4
- data.tar.gz: ed587c27541508346883ed329355afdbb1d25dd715917ffcdb3d3da95e4b7114
3
+ metadata.gz: 62c691ef11f7b5ef74ce09aff085d9655b1834bfec02673eca32d2163ffb7b3b
4
+ data.tar.gz: 2903384369a5cc5339272871043c40ece7012b131d0a557c93545d66399bc08d
5
5
  SHA512:
6
- metadata.gz: 0aa61cf65cda7bbb65b7b86af1e2e8c9e35baa842d3519c80a0c4fa7a928262eccd13039ce0759126dd347b885e794de03d0674dbb72058e5986d28197a0fba7
7
- data.tar.gz: 0fddc76d82ba3fff20bdf0b4aed7a887a3b4af23d9ac07484f726d86ecf93f7dbafeb689b250e01fa3b9a114b285e9d25f5f6be5aaf0c325347c33418464d6ee
6
+ metadata.gz: b5d2efa3c436af71411465613a04332ac0e75293f2eb7fa2f5bb4b4428646c306e9bd238a03cf78d0e1dc175522cb0727fc186b355a069132d0e45b336d032ca
7
+ data.tar.gz: a66981faecaf2166f3272cd7e510437f2c7847f254bb4269220e374e34f9835fdef3563894e62cc1cc3894a117766adf18ef8589f220474ba96a9b70ace7c0e3
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.0.2 - 2026-07-02
6
+
7
+ - Removed unused `File` class
8
+
5
9
  ## 0.0.1 - 2026-07-02
6
10
 
7
11
  - Initial release
data/README.md CHANGED
@@ -73,6 +73,9 @@ On OpenBSD, and if you are using packaged `ruby`, native compilation
73
73
  can fail because `install` command has `-o root -g bin` flags. You
74
74
  can overwrite the behavior; please refer to `bin/compile` script.
75
75
 
76
+ On Guix, edit `CC=` line in `mandoc-1.14.6/configure` script. For
77
+ example, if using GCC, change to `CC=gcc`.
78
+
76
79
  References: [my past project which uses similar mkmf strategy][re]
77
80
 
78
81
  [re]: https://github.com/gemmaro/ruby-eldc
@@ -63,6 +63,10 @@ rb_parser_alloc (VALUE klass)
63
63
  }
64
64
 
65
65
  static const rb_data_type_t rb_meta_type;
66
+ /**
67
+ * :call-seq:
68
+ * parse_file (filename) -> Meta
69
+ */
66
70
  static VALUE
67
71
  rb_parser_m_parse_file (VALUE self, VALUE fname)
68
72
  {
@@ -123,6 +127,10 @@ rb_meta_alloc (VALUE klass)
123
127
  return rb_data_typed_object_wrap (rb_cMeta, NULL, &rb_meta_type);
124
128
  }
125
129
 
130
+ /**
131
+ * :call-seq:
132
+ * deroff -> String
133
+ */
126
134
  static VALUE
127
135
  rb_meta_m_deroff (VALUE self)
128
136
  {
@@ -135,6 +143,10 @@ rb_meta_m_deroff (VALUE self)
135
143
  return str;
136
144
  }
137
145
 
146
+ /**
147
+ * :call-seq:
148
+ * section -> String
149
+ */
138
150
  static VALUE
139
151
  rb_meta_m_section (VALUE self)
140
152
  {
@@ -142,6 +154,10 @@ rb_meta_m_section (VALUE self)
142
154
  return rb_str_new_cstr (meta->msec);
143
155
  }
144
156
 
157
+ /**
158
+ * :call-seq:
159
+ * volume -> String
160
+ */
145
161
  static VALUE
146
162
  rb_meta_m_volume (VALUE self)
147
163
  {
@@ -149,6 +165,10 @@ rb_meta_m_volume (VALUE self)
149
165
  return rb_str_new_cstr (meta->vol);
150
166
  }
151
167
 
168
+ /**
169
+ * :call-seq:
170
+ * os -> String
171
+ */
152
172
  static VALUE
153
173
  rb_meta_m_os (VALUE self)
154
174
  {
@@ -156,6 +176,10 @@ rb_meta_m_os (VALUE self)
156
176
  return rb_str_new_cstr (meta->os);
157
177
  }
158
178
 
179
+ /**
180
+ * :call-seq:
181
+ * arch -> String or nil
182
+ */
159
183
  static VALUE
160
184
  rb_meta_m_arch (VALUE self)
161
185
  {
@@ -163,6 +187,10 @@ rb_meta_m_arch (VALUE self)
163
187
  return meta->arch ? rb_str_new_cstr (meta->arch) : RUBY_Qnil;
164
188
  }
165
189
 
190
+ /**
191
+ * :call-seq:
192
+ * title -> String
193
+ */
166
194
  static VALUE
167
195
  rb_meta_m_title (VALUE self)
168
196
  {
@@ -170,6 +198,10 @@ rb_meta_m_title (VALUE self)
170
198
  return rb_str_new_cstr (meta->title);
171
199
  }
172
200
 
201
+ /**
202
+ * :call-seq:
203
+ * name -> String
204
+ */
173
205
  static VALUE
174
206
  rb_meta_m_name (VALUE self)
175
207
  {
@@ -177,6 +209,10 @@ rb_meta_m_name (VALUE self)
177
209
  return rb_str_new_cstr (meta->name);
178
210
  }
179
211
 
212
+ /**
213
+ * :call-seq:
214
+ * date -> String
215
+ */
180
216
  static VALUE
181
217
  rb_meta_m_date (VALUE self)
182
218
  {
@@ -184,6 +220,10 @@ rb_meta_m_date (VALUE self)
184
220
  return rb_str_new_cstr (meta->date);
185
221
  }
186
222
 
223
+ /**
224
+ * :call-seq:
225
+ * so_target -> String or nil
226
+ */
187
227
  static VALUE
188
228
  rb_meta_m_so_target (VALUE self)
189
229
  {
@@ -191,6 +231,10 @@ rb_meta_m_so_target (VALUE self)
191
231
  return meta->sodest ? rb_str_new_cstr (meta->sodest) : RUBY_Qnil;
192
232
  }
193
233
 
234
+ /**
235
+ * :call-seq:
236
+ * has_body? -> false or true
237
+ */
194
238
  static VALUE
195
239
  rb_meta_m_has_body (VALUE self)
196
240
  {
@@ -248,6 +292,10 @@ rb_restore_stdout (int original_stdout, int read_end)
248
292
  return md;
249
293
  }
250
294
 
295
+ /**
296
+ * :call-seq:
297
+ * tree -> String
298
+ */
251
299
  static VALUE
252
300
  rb_mdocmeta_m_tree (VALUE self)
253
301
  {
@@ -261,6 +309,10 @@ rb_mdocmeta_m_tree (VALUE self)
261
309
  return rb_restore_stdout (original_stdout, read_end);
262
310
  }
263
311
 
312
+ /**
313
+ * :call-seq:
314
+ * tree -> String
315
+ */
264
316
  static VALUE
265
317
  rb_manmeta_m_tree (VALUE self)
266
318
  {
@@ -274,6 +326,10 @@ rb_manmeta_m_tree (VALUE self)
274
326
  return rb_restore_stdout (original_stdout, read_end);
275
327
  }
276
328
 
329
+ /**
330
+ * :call-seq:
331
+ * man -> String
332
+ */
277
333
  static VALUE
278
334
  rb_mdocmeta_m_man (VALUE self)
279
335
  {
@@ -288,6 +344,9 @@ rb_mdocmeta_m_man (VALUE self)
288
344
  }
289
345
 
290
346
  /**
347
+ * :call-seq:
348
+ * man -> String
349
+ *
291
350
  * The result depends on <tt>struct mparse</tt>, which means this
292
351
  * method must be called BEFORE the next +parse_file+ method calling.
293
352
  */
@@ -304,6 +363,10 @@ rb_manmeta_m_man (VALUE self)
304
363
  return rb_restore_stdout (original_stdout, read_end);
305
364
  }
306
365
 
366
+ /**
367
+ * :call-seq:
368
+ * markdown -> String
369
+ */
307
370
  static VALUE
308
371
  rb_mdocmeta_m_markdown (VALUE self)
309
372
  {
@@ -358,6 +421,10 @@ rb_wrap_node (struct roff_node *node)
358
421
  return rb_data_typed_object_wrap (klass, node, &rb_node_type);
359
422
  }
360
423
 
424
+ /**
425
+ * :call-seq:
426
+ * first_node -> Node
427
+ */
361
428
  static VALUE
362
429
  rb_meta_m_first_node (VALUE self)
363
430
  {
@@ -384,6 +451,10 @@ rb_node_alloc (VALUE klass)
384
451
  return rb_data_typed_object_wrap (klass, NULL, &rb_node_type);
385
452
  }
386
453
 
454
+ /**
455
+ * :call-seq:
456
+ * parent -> Node or nil
457
+ */
387
458
  static VALUE
388
459
  rb_node_m_parent (VALUE self)
389
460
  {
@@ -391,6 +462,10 @@ rb_node_m_parent (VALUE self)
391
462
  return node->parent ? rb_wrap_node (node->parent) : RUBY_Qnil;
392
463
  }
393
464
 
465
+ /**
466
+ * :call-seq:
467
+ * first_child -> Node or nil
468
+ */
394
469
  static VALUE
395
470
  rb_node_m_first_child (VALUE self)
396
471
  {
@@ -398,6 +473,10 @@ rb_node_m_first_child (VALUE self)
398
473
  return node->child ? rb_wrap_node (node->child) : RUBY_Qnil;
399
474
  }
400
475
 
476
+ /**
477
+ * :call-seq:
478
+ * last_child -> Node or nil
479
+ */
401
480
  static VALUE
402
481
  rb_node_m_last_child (VALUE self)
403
482
  {
@@ -405,6 +484,10 @@ rb_node_m_last_child (VALUE self)
405
484
  return node->last ? rb_wrap_node (node->last) : RUBY_Qnil;
406
485
  }
407
486
 
487
+ /**
488
+ * :call-seq:
489
+ * next_sibling -> Node or nil
490
+ */
408
491
  static VALUE
409
492
  rb_node_m_next_sibling (VALUE self)
410
493
  {
@@ -412,6 +495,10 @@ rb_node_m_next_sibling (VALUE self)
412
495
  return node->next ? rb_wrap_node (node->next) : RUBY_Qnil;
413
496
  }
414
497
 
498
+ /**
499
+ * :call-seq:
500
+ * prev_sibling -> Node or nil
501
+ */
415
502
  static VALUE
416
503
  rb_node_m_prev_sibling (VALUE self)
417
504
  {
@@ -419,6 +506,10 @@ rb_node_m_prev_sibling (VALUE self)
419
506
  return node->prev ? rb_wrap_node (node->prev) : RUBY_Qnil;
420
507
  }
421
508
 
509
+ /**
510
+ * :call-seq:
511
+ * head -> Node or nil
512
+ */
422
513
  static VALUE
423
514
  rb_node_m_head (VALUE self)
424
515
  {
@@ -426,6 +517,10 @@ rb_node_m_head (VALUE self)
426
517
  return node->head ? rb_wrap_node (node->head) : RUBY_Qnil;
427
518
  }
428
519
 
520
+ /**
521
+ * :call-seq:
522
+ * body -> Node or nil
523
+ */
429
524
  static VALUE
430
525
  rb_node_m_body (VALUE self)
431
526
  {
@@ -433,6 +528,10 @@ rb_node_m_body (VALUE self)
433
528
  return node->body ? rb_wrap_node (node->body) : RUBY_Qnil;
434
529
  }
435
530
 
531
+ /**
532
+ * :call-seq:
533
+ * tail -> Node or nil
534
+ */
436
535
  static VALUE
437
536
  rb_node_m_tail (VALUE self)
438
537
  {
@@ -440,6 +539,10 @@ rb_node_m_tail (VALUE self)
440
539
  return node->tail ? rb_wrap_node (node->tail) : RUBY_Qnil;
441
540
  }
442
541
 
542
+ /**
543
+ * :call-seq:
544
+ * text -> String or nil
545
+ */
443
546
  static VALUE
444
547
  rb_node_m_text (VALUE self)
445
548
  {
@@ -447,6 +550,10 @@ rb_node_m_text (VALUE self)
447
550
  return node->string ? rb_str_new_cstr (node->string) : RUBY_Qnil;
448
551
  }
449
552
 
553
+ /**
554
+ * :call-seq:
555
+ * tag -> String or nil
556
+ */
450
557
  static VALUE
451
558
  rb_node_m_tag (VALUE self)
452
559
  {
@@ -454,6 +561,10 @@ rb_node_m_tag (VALUE self)
454
561
  return node->string ? rb_str_new_cstr (node->tag) : RUBY_Qnil;
455
562
  }
456
563
 
564
+ /**
565
+ * :call-seq:
566
+ * line -> Integer
567
+ */
457
568
  static VALUE
458
569
  rb_node_m_line (VALUE self)
459
570
  {
@@ -461,6 +572,10 @@ rb_node_m_line (VALUE self)
461
572
  return rb_int2num_inline (node->line);
462
573
  }
463
574
 
575
+ /**
576
+ * :call-seq:
577
+ * column -> Integer
578
+ */
464
579
  static VALUE
465
580
  rb_node_m_column (VALUE self)
466
581
  {
@@ -468,6 +583,10 @@ rb_node_m_column (VALUE self)
468
583
  return rb_int2num_inline (node->pos);
469
584
  }
470
585
 
586
+ /**
587
+ * :call-seq:
588
+ * name -> String
589
+ */
471
590
  static VALUE
472
591
  rb_node_m_name (VALUE self)
473
592
  {
@@ -499,10 +618,6 @@ Init_mandoc (void)
499
618
  rb_define_method (rb_cMeta, "so_target", rb_meta_m_so_target, 0);
500
619
  rb_define_method (rb_cMeta, "has_body?", rb_meta_m_has_body, 0);
501
620
 
502
- /* TODO: Converters for HTML, PDF, ASCII, UTF8, LOCALE, PS
503
- (PostScript) are tricky, since it expects outdata (void*) of
504
- struct outstate pointer. */
505
-
506
621
  rb_cMdocMeta = rb_define_class_under (rb_mMandoc, "MdocMeta", rb_cMeta);
507
622
  rb_define_method (rb_cMdocMeta, "markdown", rb_mdocmeta_m_markdown, 0);
508
623
  rb_define_method (rb_cMdocMeta, "tree", rb_mdocmeta_m_tree, 0);
@@ -15,5 +15,5 @@
15
15
  #++
16
16
 
17
17
  module Mandoc
18
- VERSION = "0.0.1"
18
+ VERSION = "0.0.2"
19
19
  end
data/lib/mandoc.rb CHANGED
@@ -17,10 +17,18 @@
17
17
  require_relative "mandoc/version"
18
18
  require "mandoc/mandoc"
19
19
 
20
+ # The main entrypoint should be Mandoc::Parser.new.
20
21
  module Mandoc
21
- # This class doen't have +new+ method. Use Mandoc::Parser#open
22
- # instead.
23
- class File
24
- private_class_method :new
22
+ class Parser
23
+ ##
24
+ # :method: new
25
+ end
26
+
27
+ #--
28
+ # TODO: Converters for HTML, PDF, ASCII, UTF8, LOCALE, PS
29
+ # (PostScript) are tricky, since it expects outdata (void*) of
30
+ # struct outstate pointer.
31
+ #++
32
+ class MdocMeta
25
33
  end
26
34
  end
@@ -2,14 +2,17 @@
2
2
  #error "Do not use C++. See the INSTALL file."
3
3
  #endif
4
4
 
5
+ #define _GNU_SOURCE
6
+ #include <sys/types.h>
5
7
 
6
8
  #define MAN_CONF_FILE "/etc/man.conf"
7
9
  #define MANPATH_BASE "/usr/share/man:/usr/X11R6/man"
8
10
  #define MANPATH_DEFAULT "/usr/share/man:/usr/X11R6/man:/usr/local/man"
9
- #define OSENUM MANDOC_OS_OPENBSD
10
- #define UTF8_LOCALE "en_US.UTF-8"
11
+ #define OSENUM MANDOC_OS_OTHER
12
+ #define UTF8_LOCALE "en_US.utf8"
13
+ #define EFTYPE EINVAL
11
14
 
12
- #define HAVE_DIRENT_NAMLEN 1
15
+ #define HAVE_DIRENT_NAMLEN 0
13
16
  #define HAVE_ENDIAN 1
14
17
  #define HAVE_ERR 1
15
18
  #define HAVE_FTS 1
@@ -21,11 +24,11 @@
21
24
  #define HAVE_MKDTEMP 1
22
25
  #define HAVE_MKSTEMPS 1
23
26
  #define HAVE_NTOHL 1
24
- #define HAVE_PLEDGE 1
25
- #define HAVE_PROGNAME 1
27
+ #define HAVE_PLEDGE 0
28
+ #define HAVE_PROGNAME 0
26
29
  #define HAVE_REALLOCARRAY 1
27
- #define HAVE_RECALLOCARRAY 1
28
- #define HAVE_REWB_BSD 1
30
+ #define HAVE_RECALLOCARRAY 0
31
+ #define HAVE_REWB_BSD 0
29
32
  #define HAVE_REWB_SYSV 1
30
33
  #define HAVE_SANDBOX_INIT 0
31
34
  #define HAVE_STRCASESTR 1
@@ -35,11 +38,11 @@
35
38
  #define HAVE_STRNDUP 1
36
39
  #define HAVE_STRPTIME 1
37
40
  #define HAVE_STRSEP 1
38
- #define HAVE_STRTONUM 1
39
- #define HAVE_SYS_ENDIAN 1
41
+ #define HAVE_STRTONUM 0
42
+ #define HAVE_SYS_ENDIAN 0
40
43
  #define HAVE_VASPRINTF 1
41
44
  #define HAVE_WCHAR 1
42
- #define HAVE_OHASH 1
45
+ #define HAVE_OHASH 0
43
46
  #define NEED_XPG4_2 0
44
47
 
45
48
  #define BINM_APROPOS "apropos"
@@ -50,3 +53,7 @@
50
53
  #define BINM_WHATIS "whatis"
51
54
  #define BINM_PAGER "less"
52
55
 
56
+ extern const char *getprogname(void);
57
+ extern void setprogname(const char *);
58
+ extern void *recallocarray(void *, size_t, size_t, size_t);
59
+ extern long long strtonum(const char *, long long, long long, const char **);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mandoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - gemmaro
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  - !ruby/object:Gem::Version
165
165
  version: '0'
166
166
  requirements: []
167
- rubygems_version: 4.0.6
167
+ rubygems_version: 4.0.10
168
168
  specification_version: 4
169
169
  summary: mdoc/man parsing library
170
170
  test_files: []