Lua - metadata for documentation

I read Norman Ramsey's comment about using metadata to create documentation in lua .

I am trying to create documentation from my library and I would prefer not to use luadoc if possible.

I would like to learn more about this metadata-oriented method for creating documentation - methodologies, examples, or programs used.

Other answers are welcome, but this is a question that Norman can probably answer best of all.

Thank!

+3
source share
1 answer

, , . -, 15 2010 , .

:

  • __doc. __doc. :

    __doc.rfc2822_to_localtime_or_nil = [[function(date) returns number or nil
    Converts RFC2822 date to local time (Unix time).
    ]]
    

    - " " . , , . - " ". :

    __doc.to_string = [[function(T) returns string
    Converts a message to a string in RFC 2822 format.]]
    
    __doc.to_orig_string = [[function(T) returns string
    Returns the string originally used to create the message,
    which may or may comply with RFC 2822.]]
    

    , __doc.__overview, __doc.T ..

  • , __doc . , - . :

    ( , ):

    % osbf3 internals
    
    Documented modules:
      boot         
      cache        -- the OSBF-Lua message cache
      cfg          
      classifier   
      command_line 
      commands     
      core         
      filter       
      lists        
      log          
      mime         
      mlearn       
      msg          -- parse MIME message and manipulate headers
      options      
      output       
      roc          
      sfid         
      util         
    
    Undocumented functions:
      core.hash           
      core.utf8tohtml     
      options.env_default 
    

    :

    : nr@yorkie 5874 ; osbf3 internals -short msg
    
    msg: T = The representation of a message
    
    msg.add_header = function(T, tag, contents)
    
    msg.del_header = function(T, tag, ...)
    
    msg.fingerprint = function(string) returns string
    
    msg.has_sfid = function(msg.T) returns bool
    
    msg.header_indices = function(msg, tag, ...) returns iterator
    
    msg.headers_tagged = function(msg, tag, ...) returns iterator
    
    msg.of_string = function(s, uncertain) returns T or nil
    
    msg.sfid = function(msg.T, [msgspec]) returns string or calls error
    
    msg.synopsis = function(T, w) returns string
    
    msg.to_orig_string = function(T) returns string
    
    msg.to_string = function(T) returns string
    

    :

    % osbf3 internals msg.synopsis
    
    msg.synopsis = function(T, w) returns string
    Returns a string of width w (default 60) which is a synopsis of the
    message T.  The synopsis is formed from the Subject: line and the
    first few words of the body.
    

, , , - .

+4

Source: https://habr.com/ru/post/1751347/


All Articles