From patchwork Mon Jan 25 23:28:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Corbet X-Patchwork-Id: 60428 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp1647194lbb; Mon, 25 Jan 2016 15:29:00 -0800 (PST) X-Received: by 10.98.31.207 with SMTP id l76mr28809829pfj.134.1453764540440; Mon, 25 Jan 2016 15:29:00 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fe7si9738630pab.100.2016.01.25.15.28.59; Mon, 25 Jan 2016 15:29:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933610AbcAYX25 (ORCPT + 30 others); Mon, 25 Jan 2016 18:28:57 -0500 Received: from tex.lwn.net ([70.33.254.29]:60362 "EHLO vena.lwn.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933485AbcAYX2w (ORCPT ); Mon, 25 Jan 2016 18:28:52 -0500 Received: from dt.lwn.net (localhost.localdomain [127.0.0.1]) by vena.lwn.net (Postfix) with ESMTP id C7C05154004A; Mon, 25 Jan 2016 16:28:51 -0700 (MST) From: Jonathan Corbet To: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jani Nikula , Daniel Vetter , Jonathan Corbet Subject: [PATCH 2/4] docproc: handle asciidoc templates Date: Mon, 25 Jan 2016 16:28:40 -0700 Message-Id: <1453764522-29030-3-git-send-email-corbet@lwn.net> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1453764522-29030-1-git-send-email-corbet@lwn.net> References: <1453764522-29030-1-git-send-email-corbet@lwn.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There's really nothing different that needs to be done except for invoking kernel-doc with the -asciidoc argument. Look at the input file name to recognize asciidoc templates, so no special command-line flags are needed. Signed-off-by: Jonathan Corbet --- scripts/docproc.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) -- 2.7.0 diff --git a/scripts/docproc.c b/scripts/docproc.c index e267e621..89284b5 100644 --- a/scripts/docproc.c +++ b/scripts/docproc.c @@ -68,12 +68,15 @@ FILELINE * docsection; #define KERNELDOCPATH "scripts/" #define KERNELDOC "kernel-doc" #define DOCBOOK "-docbook" +#define ASCIIDOC "-asciidoc" #define LIST "-list" #define FUNCTION "-function" #define NOFUNCTION "-nofunction" #define NODOCSECTIONS "-no-doc-sections" #define SHOWNOTFOUND "-show-not-found" +static char *doc_format = DOCBOOK; + static char *srctree, *kernsrctree; static char **all_list = NULL; @@ -242,7 +245,7 @@ static void find_export_symbols(char * filename) /* * Document all external or internal functions in a file. * Call kernel-doc with following parameters: - * kernel-doc -docbook -nofunction function_name1 filename + * kernel-doc [-docbook|-asciidoc] -nofunction function_name1 filename * Function names are obtained from all the src files * by find_export_symbols. * intfunc uses -nofunction @@ -263,7 +266,7 @@ static void docfunctions(char * filename, char * type) exit(1); } vec[idx++] = KERNELDOC; - vec[idx++] = DOCBOOK; + vec[idx++] = doc_format; vec[idx++] = NODOCSECTIONS; for (i=0; i < symfilecnt; i++) { struct symfile * sym = &symfilelist[i]; @@ -275,7 +278,7 @@ static void docfunctions(char * filename, char * type) } vec[idx++] = filename; vec[idx] = NULL; - printf("\n", filename); + /* printf("\n", filename); */ exec_kernel_doc(vec); fflush(stdout); free(vec); @@ -294,7 +297,7 @@ static void singfunc(char * filename, char * line) int i, idx = 0; int startofsym = 1; vec[idx++] = KERNELDOC; - vec[idx++] = DOCBOOK; + vec[idx++] = doc_format; vec[idx++] = SHOWNOTFOUND; /* Split line up in individual parameters preceded by FUNCTION */ @@ -343,7 +346,7 @@ static void docsect(char *filename, char *line) free(s); vec[0] = KERNELDOC; - vec[1] = DOCBOOK; + vec[1] = doc_format; vec[2] = SHOWNOTFOUND; vec[3] = FUNCTION; vec[4] = line; @@ -497,6 +500,16 @@ static void parse_file(FILE *infile) fflush(stdout); } +/* + * Is this an asciidoc template? Answer the question by seeing if its + * name ends in ".adt". + */ +static int is_asciidoc(const char *file) +{ + int len = strlen(file); + + return len > 4 && ! strcmp(file + len - 4, ".adt"); +} int main(int argc, char *argv[]) { @@ -520,6 +533,8 @@ int main(int argc, char *argv[]) perror(argv[2]); exit(2); } + if (is_asciidoc(argv[2])) + doc_format = ASCIIDOC; if (strcmp("doc", argv[1]) == 0) { /* Need to do this in two passes.