[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[7389] parsetexi kbdinputstyle
From: |
gavinsmith0123 |
Subject: |
[7389] parsetexi kbdinputstyle |
Date: |
Mon, 19 Sep 2016 16:33:40 +0000 (UTC) |
Revision: 7389
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7389
Author: gavin
Date: 2016-09-19 16:33:40 +0000 (Mon, 19 Sep 2016)
Log Message:
-----------
parsetexi kbdinputstyle
Modified Paths:
--------------
trunk/tp/parsetexi/command_data.txt
trunk/tp/parsetexi/end_line.c
trunk/tp/parsetexi/handle_commands.c
trunk/tp/parsetexi/parser.c
trunk/tp/parsetexi/parser.h
Modified: trunk/tp/parsetexi/command_data.txt
===================================================================
--- trunk/tp/parsetexi/command_data.txt 2016-09-19 15:32:23 UTC (rev 7388)
+++ trunk/tp/parsetexi/command_data.txt 2016-09-19 16:33:40 UTC (rev 7389)
@@ -270,13 +270,13 @@
t brace BRACE_style
var brace BRACE_style
headitemfont brace BRACE_style
-code brace BRACE_style
-command brace BRACE_style
-env brace BRACE_style
-file brace BRACE_style
-kbd brace BRACE_style
-option brace BRACE_style
-samp brace BRACE_style
+code brace,code_style BRACE_style
+command brace,code_style,code_style BRACE_style
+env brace,code_style,code_style BRACE_style
+file brace,code_style,code_style BRACE_style
+kbd brace,code_style,code_style BRACE_style
+option brace,code_style,code_style BRACE_style
+samp brace,code_style,code_style BRACE_style
strong brace BRACE_style
sub brace BRACE_style
sup brace BRACE_style
@@ -304,19 +304,10 @@
anchor brace 1
errormsg brace 1
-# code style commands
-# fixme: duplicated from above!!
-#code brace BRACE_other
-#command brace BRACE_other
-#env brace BRACE_other
-#file brace BRACE_other
-#kbd brace BRACE_other
-key brace BRACE_other
-#option brace BRACE_other
-#samp brace BRACE_other
-indicateurl brace 1
-verb brace BRACE_other
-t brace BRACE_other
+# more code style commands
+indicateurl brace,code_style 1
+verb brace,code_style BRACE_other
+t brace,code_style BRACE_other
# context brace commands - commands that enclose full texts
footnote brace,global BRACE_context
Modified: trunk/tp/parsetexi/end_line.c
===================================================================
--- trunk/tp/parsetexi/end_line.c 2016-09-19 15:32:23 UTC (rev 7388)
+++ trunk/tp/parsetexi/end_line.c 2016-09-19 16:33:40 UTC (rev 7389)
@@ -703,14 +703,22 @@
}
case CM_kbdinputstyle:
{
- if (!strcmp (line, "code") || !strcmp (line, "example")
- || !strcmp (line, "distinct"))
+ if (!strcmp (line, "code"))
+ global_kbdinputstyle = kbd_code;
+ else if (!strcmp (line, "example"))
+ global_kbdinputstyle = kbd_example;
+ else if (!strcmp (line, "distinct"))
+ global_kbdinputstyle = kbd_distinct;
+ else goto kdbinputstyle_invalid;
+
+ ADD_ARG(line);
+
+ if (0)
{
- ADD_ARG(line);
- }
- else
+kdbinputstyle_invalid:
line_error ("@kbdinputstyle arg must be "
"`code'/`example'/`distinct', not `%s'", line);
+ }
break;
}
case CM_allowcodebreaks:
Modified: trunk/tp/parsetexi/handle_commands.c
===================================================================
--- trunk/tp/parsetexi/handle_commands.c 2016-09-19 15:32:23 UTC (rev
7388)
+++ trunk/tp/parsetexi/handle_commands.c 2016-09-19 16:33:40 UTC (rev
7389)
@@ -1140,11 +1140,39 @@
current = e;
mark_and_warn_invalid (cmd, invalid_parent, e);
- // TODO kbd
if (cmd == CM_click)
{
add_extra_string (e, "clickstyle", global_clickstyle);
}
+ else if (cmd == CM_kbd)
+ {
+ if (current_context () == ct_preformatted
+ && global_kbdinputstyle != kbd_distinct
+ || global_kbdinputstyle == kbd_code)
+ {
+ add_extra_string (e, "code", "1");
+ }
+ else if (global_kbdinputstyle == kbd_example)
+ {
+ // _in_code line 1277
+ // TODO: Understand what is going on here.
+
+ ELEMENT *tmp = current->parent;
+ while (tmp->parent
+ && (command_flags(tmp->parent) & CF_brace)
+ && command_data(tmp->parent->cmd).data != BRACE_context)
+ {
+ if (command_flags(tmp->parent) & CF_code_style)
+ goto yes_kbd_code;
+ tmp = tmp->parent->parent;
+ }
+ if (0)
+ {
+yes_kbd_code:
+ add_extra_string (e, "code", "1");
+ }
+ }
+ }
else if (command_data(cmd).flags & CF_INFOENCLOSE)
{
INFO_ENCLOSE *ie = lookup_infoenclose (cmd);
Modified: trunk/tp/parsetexi/parser.c
===================================================================
--- trunk/tp/parsetexi/parser.c 2016-09-19 15:32:23 UTC (rev 7388)
+++ trunk/tp/parsetexi/parser.c 2016-09-19 16:33:40 UTC (rev 7389)
@@ -117,10 +117,13 @@
GLOBAL_INFO global_info;
char *global_clickstyle = "arrow";
+enum kbd_enum global_kbdinputstyle = kbd_distinct;
+
void
wipe_global_info (void)
{
global_clickstyle = "arrow";
+ global_kbdinputstyle = kbd_distinct;
memset (&global_info, 0, sizeof (global_info));
}
Modified: trunk/tp/parsetexi/parser.h
===================================================================
--- trunk/tp/parsetexi/parser.h 2016-09-19 15:32:23 UTC (rev 7388)
+++ trunk/tp/parsetexi/parser.h 2016-09-19 16:33:40 UTC (rev 7389)
@@ -81,6 +81,10 @@
extern GLOBAL_INFO global_info;
extern char *global_clickstyle;
+
+enum kbd_enum {kbd_none, kbd_code, kbd_example, kbd_distinct };
+extern enum kbd_enum global_kbdinputstyle;
+
void wipe_global_info (void);
#include "macro.h"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [7389] parsetexi kbdinputstyle,
gavinsmith0123 <=