Method: CodeRunner::Run::FortranNamelist.write_mediawiki_documentation
- Defined in:
- lib/coderunner/fortran_namelist.rb
.write_mediawiki_documentation(filename = "#{rcp.code}_mediawiki.txt") ⇒ Object
This method takes the help written into this module for the various input parameters and writes it in a format suitable for the mediawiki page on input parameters.
932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 |
# File 'lib/coderunner/fortran_namelist.rb', line 932 def self.write_mediawiki_documentation(filename = "#{rcp.code}_mediawiki.txt") File.open(filename, 'w') do |file| file.puts <<EOF =Introduction= This page lists every #{rcp.code} input parameter currently known about, along with any help available. It is intended as a reference, not an introduction. Note: some parameters are highly specialised and not intended for general use. A full introduction to writing input files is to be written, but until then, this is an old example input file. Be aware that not every section should be included. [[#{rcp.code} Reference Input File]] ==Format== The parameters are divided into namelists. Each parameter has type information and written help where available. The format is: {| border="2" cellpadding="5" ! Name !! Type !! Def !! CR Name !! Description |- |- |Name as it appears in #{rcp.code} || Fortran Data Type || Autoscanned Default(s): guesses at what the default value of this parameter will be if you do not specify it in the input file. They are usually correct. || CodeRunner Name: is the variable name used by [http://coderunner.sourceforge.net CodeRunner] to refer to the quantity (only given if it is different to the #{rcp.code} name). | Long and detailed help for the variable |} ==Updating this Page== This page is automatically generated by [http://coderunner.sourceforge.net CodeRunner], but any '''changes you make will be kept''', so please feel free to contribute. Please keep to the same format as this allows easy automatic syncing of your changes with the CodeRunner database. '''Please only edit in between the <nowiki><!-- begin help --> <!-- end help --> </nowiki> or the <nowiki><!-- begin namelist help --> <!-- end namelist help --> </nowiki> tags'''. Don't edit type/default information (or this introduction) as it will not be kept. =Namelists= Each #{rcp.code} module is controlled by its own namelist. For typical applications, not all 32+ namelists should appear in a single file. For a run called runname, this file should be called <tt>runname.in</tt>. In most cases, defaults are loaded for each namelist element, so that if a namelist or element does not appear, the run will not automatically stop. (It may still be forced to stop if the defaults are incompatible with your other choices.) The namelists and defaults appear below. EOF rcp.namelists.each do |namelist, hash| file.puts "==#{namelist}==" file.puts "<!--begin namelist help-->#{hash[:help]}<!--end namelist help-->" file.puts "\n{| border=\"2\" cellpadding=\"5\"\n! Name !! Type !! Def !! CR Name !! Description \n|-" hash[:variables].keys.sort.each do |var| var_hash = hash[:variables][var] #puts "==='''[[#{(var_hash[:code_name] or var)}]]'''===" file.puts "|-\n|'''[[#{(var_hash[:code_name] or var)}]]''' || #{var_hash[:type]} || #{(var_hash[:autoscanned_defaults]||[]).map{|v| v.to_s}.join(",")} || #{var} \n|\n<!--begin help-->* #{hash[:variables][var][:help]} <!-- end help -->" #puts "''Type'': #{var_hash[:type]} " #puts "''Autoscanned Defaults'': #{var_hash[:autoscanned_defaults]} " #puts "''CodeRunner name'': #{var} " #puts "\n", "#{hash[:variables][var][:help]}".sub(/\A\s+/, '') if hash[:variables][var][:help] #puts " #{(var_hash[:code_name] or var)} Properties:" end file.puts "|}" end end #file.open end |