parse.rb
#make_link name url
#if url is not set, use name=url
#if given a hash, extract name and url and makes link
# (if only url is given use name=url)
# (if only name is given output name and don't give a link)
make_link name url
if url is not set, use name=url
if given a hash, extract name and url and makes link
(if only url is given use name=url)
(if only name is given output name and don't give a link)
make_link name url if url is not set use name = url if given a hash extract name and url and makes link ( if only url is given use name = url ) ( if only name is given output name and don ' t give a link )
def make_link(*args,relative: true,cur_url: WEBPRO, **kwds)
			msg=args.first
			if Hash===msg
				begin
					if msg.key?(:url)
						if msg.key?(:name)
							return make_link(msg[:name],msg[:url],**kwds)
						else
							return make_link(msg[:url],**kwds)
						end
					else
						return msg[:name]
					end
				rescue Exception => e
					warn "#{msg.to_s} does not correspond to an url: #{e.to_s}"
				end
			else
				outtype=kwds[:outtype]
				name=localize(args.shift,**kwds)
				url=args.shift || name
				case outtype
				when :tex
					url=Biblio.tex_quote(url)
					if name == url
						return "\\url{#{url}}"
					else
						return "\\href{#{url}}{#{name}}"
					end
				when :texsee
					if name == url
						return "\\voirseelink{#{args[0]}}"
					else
						return "\\voirseelink[#{args[0]}]{#{args[1]}}"
					end
				when :web
					if relative and url =~ /^#{cur_url}/ and not url =~ /^#{cur_url}$/
						url=url.sub(/^#{cur_url}/,'')
						url=relative_link(url,kwds[:cur_folder])
					end
					if name == url
						return "<#{name}>"
					else
						return "[#{name}](#{url})"
					end
				end
			end
		end
def make_link ( * args , relative : true , cur_url : WEBPRO , ** kwds ) msg = args . first if Hash === msg begin if msg . key? ( :url ) if msg . key? ( :name ) return make_link ( msg [ :name ] , msg [ :url ] , ** kwds ) else return make_link ( msg [ :url ] , ** kwds ) end else return msg [ :name ] end rescue Exception => e warn "#{msg.to_s} does not correspond to an url: #{e.to_s}" end else outtype = kwds [ :outtype ] name = localize ( args . shift , ** kwds ) url = args . shift || name case outtype when :tex url = Biblio . tex_quote ( url ) if name == url return "\\url{#{url}}" else return "\\href{#{url}}{#{name}}" end when :texsee if name == url return "\\voirseelink{#{args[0]}}" else return "\\voirseelink[#{args[0]}]{#{args[1]}}" end when :web if relative and url =~ / ^ #{ cur_url } / and not url =~ / ^ #{ cur_url } $ / url = url . sub ( / ^ #{ cur_url } / , '' ) url = relative_link ( url , kwds [ :cur_folder ] ) end if name == url return "<#{name}>" else return "[#{name}](#{url})" end end end end
make_link name url
if url is not set, use name=url
if given a hash, extract name and url and makes link
(if only url is given use name=url)
(if only name is given output name and don't give a link)
make_link name url if url is not set use name = url if given a hash extract name and url and makes link ( if only url is given use name = url ) ( if only name is given output name and don ' t give a link )
args
relative
cur_url
kwds