function o = convert_to_circumflex(s,c);

% Function o = convert_to_circumflex(s,"latex")
%          o = convert_to_circumflex(s,"html")
% 
% converts some latex code, or some html tags, to
% circumflex notation.
% 
% For the latter, see the help text of hgeo_to_html.m.
% 
% NOT COMPLETED !
% 
% 
% (c) 2026 fabien van mook
% 
% 2026.08.20 release of this file within package "fvm-hgeo" under GNU GPLv3+

% This program is free software: you can redistribute it
% and/or modify it under the terms of the GNU General Public
% License as published by the Free Software Foundation, either
% version 3 of the License, or (at your option) any later
% version.
% 
% This program is distributed in the hope that it will be
% useful, but WITHOUT ANY WARRANTY; without even the implied
% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
% PURPOSE. See the GNU General Public License for more
% details.
% 
% You can read the GNU General Public License on
% <https://www.gnu.org/copyleft/gpl.html>.


o = s;

if strcmp(c,"latex"),

  o = strrep(o,"\\%{}", "\%");

  o = strrep(o,"\n","^N");
  o = strrep(o,"^{","^U");
  o = strrep(o,"_{","^D");
  o = strrep(o,"}", "^E");

elseif strcmp(c,"html"),

  o = strrep(o,"&percnt;", "\%");

  o = strrep(o,"\n",    " ");  % ??
  o = strrep(o,"<br>",  "^N");
  o = strrep(o,"<sup>", "^U");
  o = strrep(o,"</sup>","^E");
  o = strrep(o,"<sub>", "^D");
  o = strrep(o,"</sub>","^E");
  o = strrep(o,"<i>",   "^S");
  o = strrep(o,"</i>",  "^E");

endif;

endfunction;
