From c31dbe5e3400f2c87c5d09a85cf3a7315fe0694b Mon Sep 17 00:00:00 2001 From: Roker Date: Thu, 31 Aug 2017 12:55:26 +0200 Subject: [PATCH] =?UTF-8?q?create=20better=20documentation=20format.=20rem?= =?UTF-8?q?ove=20"=E2=80=93=E2=80=93"=20from=20separator=20names?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html/interactive.js | 67 ++++++++++++++++++++++++++---------------- server/json-adapter.cc | 14 ++++----- 2 files changed, 49 insertions(+), 32 deletions(-) diff --git a/html/interactive.js b/html/interactive.js index e88b37b..9973672 100644 --- a/html/interactive.js +++ b/html/interactive.js @@ -495,7 +495,7 @@ function init_pep_functions() for(var i=0, len=pep_functions.length; i':'>') + f.name + "\n"; + optionList += ' —— ':'>') + f.name + "\n"; } document.getElementById("fn_name").innerHTML = optionList; document.getElementById("spn_version").innerHTML = "version: " + server_version; @@ -504,27 +504,36 @@ function init_pep_functions() function create_doc() { - var table_def = { - html : { start : '', end: '
\n', - header : 'Function nameReturn TypeParameters\n', - line_start : '', line_end : '\n', - cell_start : '' , cell_end : '' + var format_def = { + html : { section_start : '

' , section_end : '

\n', + subsection_start : '

' , subsection_end : '

\n', + b_start : '', b_end : '', + table_start : '', table_end: '
\n', + table_header : 'Function nameReturn TypeParameters\n', + line_start : '', line_end : '\n', + cell_start : '', cell_end : '' }, - md : { start: '', end: '\n', - header : '| Function name | Return Type | Parameters |\n' + - '|---------------|-------------|------------|\n', - line_start : '', line_end : '|\n', + md : { section_start : '### ' , section_end : ' ###\n', + subsection_start : '#### ' , subsection_end : ' ####\n', + b_start : ' **', b_end : '** ', + table_start : '', table_end: '\n', + table_header: '| Function name | Return Type | Parameters |\n' + + '|---------------|-------------|------------|\n', + line_start : '' , line_end: '|\n', cell_start : '| ', cell_end: ' ' }, - trac : { start: '', end: '\n', - header : '||= Function name =||= Return Type =||= Parameters =||\n', - line_start : '|', line_end : '|\n', - cell_start : '| ', cell_end: ' |' + trac : { section_start : '=== ' , section_end : ' ===\n', + subsection_start : '==== ' , subsection_end : ' ====\n', + b_start : ' **', b_end : '** ', + table_start : '' , table_end: '\n', + table_header: '||= Function name =||= Return Type =||= Parameters =||\n', + line_start : '|' , line_end : '|\n', + cell_start : '| ', cell_end : ' |' } }; var format_name = document.getElementById('doc_format').value; - var format_def = table_def[format_name]; + var fd = format_def[format_name]; var output = ""; for(var i=0, len=pep_functions.length; i 0) + { + output += fd.table_end + "\n"; + } + output += fd.subsection_start + f.name + fd.subsection_end + + fd.table_start + fd.table_header; }else{ - output += format_def.line_start - + format_def.cell_start + f.name + format_def.cell_end - + format_def.cell_start + f["return"] + format_def.cell_end - + format_def.cell_start ; + output += fd.line_start + + fd.cell_start + f.name + fd.cell_end + + fd.cell_start + f["return"] + fd.cell_end + + fd.cell_start ; for( var p=0, plen = f.params.length; p"; - document.getElementById("doc_out").innerHTML = - '

Function reference for the p≡p JSON Server Adapter. Version “' + server_version + '”

' - + 'Output parameters are denoted by a , InOut parameters are denoted by a after the parameter type.
' - + output; + document.getElementById("doc_out").innerHTML = output; } diff --git a/server/json-adapter.cc b/server/json-adapter.cc index 299636e..fb5ff41 100644 --- a/server/json-adapter.cc +++ b/server/json-adapter.cc @@ -200,7 +200,7 @@ PEP_STATUS MIME_decrypt_message_ex( // these are the pEp functions that are callable by the client const FunctionMap functions = { // from message_api.h - FP( "—— Message API ——", new Separator ), + FP( "Message API", new Separator ), FP( "MIME_encrypt_message", new Func, In, In, In, Out, In, In>( &MIME_encrypt_message ) ), FP( "MIME_encrypt_message_for_self", new Func, In, In, In, @@ -227,7 +227,7 @@ const FunctionMap functions = { FP( "identity_rating" , new Func, In, Out>( &identity_rating) ), FP( "get_gpg_path", new Func>(&get_gpg_path) ), - FP( "—— pEp Engine Core API ——", new Separator), + FP( "pEp Engine Core API", new Separator), FP( "log_event", new Func, In, In, In, In>( &log_event) ), FP( "get_trustwords", new Func, In, In, In, Out, Out, In>( &get_trustwords) ), FP( "get_languagelist", new Func, Out>( &get_languagelist) ), @@ -236,7 +236,7 @@ const FunctionMap functions = { FP( "config_passive_mode", new Func, In>( &config_passive_mode) ), FP( "config_unencrypted_subject", new Func, In>( &config_unencrypted_subject) ), - FP( "—— Identity Management API ——", new Separator), + FP( "Identity Management API", new Separator), FP( "get_identity" , new Func, In, In, Out>( &get_identity) ), FP( "set_identity" , new Func, In> ( &set_identity) ), FP( "mark_as_comprimized", new Func, In> ( &mark_as_compromized) ), @@ -245,7 +245,7 @@ const FunctionMap functions = { FP( "set_identity_flags", new Func, In, In>( &set_identity_flags) ), FP( "unset_identity_flags", new Func, In, In>( &unset_identity_flags) ), - FP( "—— Low level Key Management API ——", new Separator), + FP( "Low level Key Management API", new Separator), FP( "generate_keypair", new Func, InOut> ( &generate_keypair) ), FP( "delete_keypair", new Func, In> ( &delete_keypair) ), FP( "import_key" , new Func, In, In, Out> ( &import_key) ), @@ -268,20 +268,20 @@ const FunctionMap functions = { FP( "revoke" , new Func, In, In> ( &revoke_key) ), FP( "key_expired" , new Func, In, In, Out> ( &key_expired) ), - FP( "—— from blacklist.h & OpenPGP_compat.h ——", new Separator), + FP( "from blacklist.h & OpenPGP_compat.h", new Separator), FP( "blacklist_add" , new Func, In> ( &blacklist_add) ), FP( "blacklist_delete", new Func, In> ( &blacklist_delete) ), FP( "blacklist_is_listed", new Func, In, Out> ( &blacklist_is_listed) ), FP( "blacklist_retrieve" , new Func, Out> ( &blacklist_retrieve) ), FP( "OpenPGP_list_keyinfo", new Func, In, Out> ( &OpenPGP_list_keyinfo) ), - FP( "-- Event Listener & Results", new Separator ), + FP( "Event Listener & Results", new Separator ), FP( "registerEventListener" , new Func, In, In, In> ( ®isterEventListener) ), FP( "unregisterEventListener", new Func, In, In, In> ( &unregisterEventListener) ), FP( "deliverHandshakeResult" , new Func, In, In> (&deliverHandshakeResult) ), // my own example function that does something useful. :-) - FP( "—— Other ——", new Separator ), + FP( "Other", new Separator ), FP( "version", new Func( &JsonAdapter::version ) ), FP( "apiVersion", new Func ( &JsonAdapter::apiVersion ) ), FP( "getGpgEnvironment", new Func( &getGpgEnvironment ) ),