From 1f63dd27a3ed1a0e383aa1b90216a8e8a6d9280f Mon Sep 17 00:00:00 2001 From: Hanoh Haim Date: Tue, 17 May 2016 15:44:36 +0300 Subject: [PATCH] yet another TOC change from Bilal still not good --- trex_book.asciidoc | 1 - trex_index.asciidoc | 2 + trex_rpc_server_spec.asciidoc | 2 - trex_stateless.asciidoc | 4 +- trex_toc.asciidoc | 4 +- trex_vm_manual.asciidoc | 2 - ws_main.py | 387 +++++++++++++++++++++++++++++++++++++++++- 7 files changed, 390 insertions(+), 12 deletions(-) diff --git a/trex_book.asciidoc b/trex_book.asciidoc index 73b2edf0..2bb46b14 100755 --- a/trex_book.asciidoc +++ b/trex_book.asciidoc @@ -10,7 +10,6 @@ TRex :toclevels: 4 include::trex_ga.asciidoc[] -include::trex_toc.asciidoc[] == Introduction diff --git a/trex_index.asciidoc b/trex_index.asciidoc index fe00cbb5..41464c9d 100644 --- a/trex_index.asciidoc +++ b/trex_index.asciidoc @@ -37,6 +37,8 @@ link:trex_manual.html[trex_manual.html] link:trex_book.pdf[trex_manual.pdf] link:trex_stateless.html[trex_stateless.html] link:trex_stateless.pdf[trex_stateless.pdf] | Tutorial TRex on VirtualBox | link:trex_vm_manual.html[trex_vm_manual.html] link:trex_vm_manual.pdf[trex_vm_manual.pdf] +| Cisco DevNet SandBox | +link:https://devnetsandbox.cisco.com/RM/Diagram/Index/2ec5952d-8bc5-4096-b327-c294acd9512d?diagramType=Topology[Sandbox] https://devnetsandbox.cisco.com/RM/Topology[DevNet Sandbox] |================= == Python Automation API diff --git a/trex_rpc_server_spec.asciidoc b/trex_rpc_server_spec.asciidoc index 774c591b..ebdd5f9a 100755 --- a/trex_rpc_server_spec.asciidoc +++ b/trex_rpc_server_spec.asciidoc @@ -10,8 +10,6 @@ The TRex RPC Server :toclevels: 7 include::trex_ga.asciidoc[] -include::trex_toc.asciidoc[] - == Change log diff --git a/trex_stateless.asciidoc b/trex_stateless.asciidoc index 472b5bfc..b6104b70 100755 --- a/trex_stateless.asciidoc +++ b/trex_stateless.asciidoc @@ -11,6 +11,8 @@ TRex Stateless support :github_stl_examples_path: https://github.com/cisco-system-traffic-generator/trex-core/tree/master/scripts/automation/trex_control_plane/stl/examples :toclevels: 6 +include::trex_ga.asciidoc[] + // PDF version - image width variable ifdef::backend-docbook[] :p_width: 450 @@ -29,8 +31,6 @@ ifdef::backend-xhtml11[] :p_width_lge: 900 endif::backend-xhtml11[] -include::trex_ga.asciidoc[] -include::trex_toc.asciidoc[] == Audience diff --git a/trex_toc.asciidoc b/trex_toc.asciidoc index 984ebca4..a41d707f 100644 --- a/trex_toc.asciidoc +++ b/trex_toc.asciidoc @@ -1,7 +1,7 @@ ifdef::backend-xhtml11[] ++++ - +
Table of Contents @@ -17,6 +17,8 @@ ifdef::backend-xhtml11[]
+ + diff --git a/trex_vm_manual.asciidoc b/trex_vm_manual.asciidoc index ec4c39c5..dddf57bf 100755 --- a/trex_vm_manual.asciidoc +++ b/trex_vm_manual.asciidoc @@ -8,8 +8,6 @@ TRex Virtual Machine setup and basic usage include::trex_ga.asciidoc[] -include::trex_toc.asciidoc[] - == Introduction diff --git a/ws_main.py b/ws_main.py index 87be842f..2ac89800 100755 --- a/ws_main.py +++ b/ws_main.py @@ -257,6 +257,376 @@ def convert_to_pdf(task): return os.system('a2x --no-xmllint -v -f pdf -d article %s -D %s ' %(task.inputs[0].abspath(),out_dir ) ) +TOC_HEAD = """ + + +
+
+ + Table of Contents +
+ +
+ +
+ +
+ +
+
+ +
+
+ +""" + +TOC_END = """ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +""" + +def do_replace (input_file,contents,look,str_replaced): + if contents.count(look)!=1 : + raise Exception('Cannot find {0} in file {1} '.format(look,input_file)) + + return contents.replace(look, str_replaced) + + def toc_fixup_file (input_file, out_file, @@ -265,9 +635,13 @@ def toc_fixup_file (input_file, file = open(input_file) contents = file.read() - replaced_contents = contents.replace('input_replace_me.json', json_file_name) + + contents = do_replace(input_file,contents,'', TOC_HEAD); + contents = do_replace(input_file,contents,'', TOC_END) + contents = do_replace(input_file,contents,'input_replace_me.json', json_file_name) + file = open(out_file,'w') - file.write(replaced_contents) + file.write(contents) file.close(); @@ -280,7 +654,7 @@ def convert_to_html_toc_book(task): tmp = os.path.splitext(task.outputs[0].abspath())[0]+'.tmp' json_out_file_short = os.path.splitext(task.outputs[0].name)[0]+'.json' - cmd='{0} -a stylesheet={1} -a icons=true -a docinfo -d book -a max-width=55em -o {2} {3}'.format( + cmd='{0} -a stylesheet={1} -a icons=true -a docinfo -d book -o {2} {3}'.format( task.env['ASCIIDOC'], task.inputs[1].abspath(), tmp, @@ -601,5 +975,10 @@ def publish_both(bld): publish_ext(bld) - +def test(bld): + # copy all the files to our web server + toc_fixup_file ('build/trex_stateless.tmp', + 'build/trex_stateless.html', + 'trex_stateless.json') + -- 2.16.6