This notebook is part of a github project to develop alternate file formats of the %quickref magic text. The formats include HTML, pdf, and png.
In [1]:
cd Git_quickref_project
In [2]:
!ls
In [3]:
from pprint import pprint as pr
from collections import OrderedDict as Or_dict
from Parse_flags import *
from Build_dict import *
from HTML_Table_funcs import *
import pickle
from IPython.display import HTML
from numpy import floor
In [14]:
%quickref
In [4]:
%run load_quickref_text_magic.py
quickref_text = %quickref_text
lines = quickref_text.split('\n')
print(len(lines))
#pr(lines)
In [5]:
Quick_ref_dic = build_dict(lines)
with open("Quick_ref_dic.pkl",'wb') as f:
pickle.dump(dict(Quick_ref_dic),f)
#pr(Quick_ref_dic)
In [6]:
#%run HTML_Table_funcs
_T_L = build_HTML_table(Quick_ref_dic, end_key='System commands')
_T_R = build_HTML_table(Quick_ref_dic, Start_key='System commands', end_key='The following magic functions')
double_table = Table_container([616,488],[_T_L, _T_R])
with open('HTML_Basic_Help_Table.html','w') as f:
f.write(double_table)
Basic_help = HTML(double_table)
#pr(Table_list)
%run open_html_in_new_tab.py
open_html(double_table) #open the html output in a new tab
#HTML(double_table) #doesn't deispllay in the notebook correctly
In [7]:
#%run HTML_Table_funcs
T_List=[]
magic_cmds = len(list(Quick_ref_dic['The following magic functions are currently available:'].keys())) - 1
A=floor(magic_cmds/3)
B=magic_cmds-A*3
if B ==2:
col_B = A + 1
else:
col_B = A
if B==1:
col_C = A + 1
else:
col_C = A
col_A = A
#magic_cmds = build_HTML_table(Quick_ref_dic, Start_key='The following magic functions')
T_List.append(build_HTML_table(Quick_ref_dic, Start_key='The following magic functions', max_line=(col_A+2)))
T_List.append(build_HTML_table(Quick_ref_dic, Start_key='The following magic functions', max_line=col_B, start_later = col_A))
T_List.append(build_HTML_table(Quick_ref_dic, Start_key='The following magic functions', start_later = (col_A+col_B)))
triple_table = Table_container([640,625,612],T_List)
with open('HTML_Magic_Only_Table.html','w') as f:
f.write(triple_table)
Magic_help = HTML(triple_table)
%run open_html_in_new_tab.py
open_html(triple_table) #open the html output in a new tab
#HTML(triple_table) #doesn't deispllay in the notebook correctly
In [9]:
#build_HTML_table(
print(magic_cmds)
print(36*2+37)
print(111-98)
There are Problems with rendering the output HTML in the IPython Notebook but here are old screenshots.
In [9]:
from IPython.display import Image
PWD = !pwd
Image(filename=PWD[0]+'/Basic_Help.png')
Out[9]:
In [10]:
Image(filename=PWD[0]+'/Magic_only.png')
Out[10]:
In [11]:
%quickref