@@ -376,23 +376,25 @@ def output_redirects(out, redirects):
376376 out .write (line )
377377
378378def process_identifier (out , redirects , root , link , item_ident , item_type ,
379- max_code_lines , debug = DDGDebug ()):
379+ opts , debug = DDGDebug ()):
380380 # get the name by extracting the unqualified identifier
381381 name = get_name (item_ident )
382382 debug_verbose = True if debug .enabled and debug .ident_match is not None else False
383383
384384 try :
385385 if item_type == ITEM_TYPE_CLASS :
386386 decls = get_declarations (root , name )
387- desc = get_short_description (root , get_version (decls ), debug = debug_verbose )
388- abstract = build_abstract (decls , desc , max_code_lines , debug = debug )
387+ desc = get_short_description (root , get_version (decls ), opts .max_sentences , opts .max_characters ,
388+ opts .max_paren_chars , debug = debug_verbose )
389+ abstract = build_abstract (decls , desc , opts .max_code_lines , debug = debug )
389390
390391 elif item_type in [ ITEM_TYPE_FUNCTION ,
391392 ITEM_TYPE_CONSTRUCTOR ,
392393 ITEM_TYPE_DESTRUCTOR ]:
393394 decls = get_declarations (root , name )
394- desc = get_short_description (root , get_version (decls ), debug = debug_verbose )
395- abstract = build_abstract (decls , desc , max_code_lines , debug = debug )
395+ desc = get_short_description (root , get_version (decls ), opts .max_sentences , opts .max_characters ,
396+ opts .max_paren_chars , debug = debug_verbose )
397+ abstract = build_abstract (decls , desc , opts .max_code_lines , debug = debug )
396398
397399 elif item_type in [ ITEM_TYPE_FUNCTION_INLINEMEM ,
398400 ITEM_TYPE_CONSTRUCTOR_INLINEMEM ,
@@ -458,6 +460,14 @@ def main():
458460 help = 'The path to destination output.txt file' )
459461 parser .add_argument ('--max_code_lines' , type = int , default = 6 ,
460462 help = 'Maximum number of lines of code to show in abstract' )
463+ parser .add_argument ('--max_sentences' , type = int , default = 1 ,
464+ help = 'Maximum number of sentences to use for the description' )
465+ parser .add_argument ('--max_characters' , type = int , default = 200 ,
466+ help = 'Maximum number of characters to use for the description' )
467+ parser .add_argument ('--max_paren_chars' , type = int , default = 40 ,
468+ help = 'Maximum size of parenthesized text in the description. ' +
469+ 'Parenthesized chunks longer than that is removed, unless ' +
470+ 'they are within <code>, <b> or <i> tags' )
461471 parser .add_argument ('--debug' , action = 'store_true' , default = False ,
462472 help = 'Enables debug mode.' )
463473 parser .add_argument ('--debug_ident' , type = str , default = None ,
@@ -474,7 +484,6 @@ def main():
474484
475485 index_file = args .index
476486 output_file = args .output
477- max_code_lines = args .max_code_lines
478487
479488 # a map that stores information about location and type of identifiers
480489 # it's two level map: full_link maps to a dict that has full_name map to
@@ -529,7 +538,7 @@ def main():
529538 item_type = ident ['type' ]
530539
531540 process_identifier (out , redirects , root , link , item_ident , item_type ,
532- max_code_lines , debug = debug )
541+ args , debug = debug )
533542
534543 output_redirects (out , redirects )
535544
0 commit comments