Skip to content

Commit

Permalink
added sw_markdown converter
Browse files Browse the repository at this point in the history
- added converter to convert SpinW MarkDown style to unicode text that
can be displayed in the Command Window
- converted all calls to ‘help’ —> ‘swhelp’
  • Loading branch information
tsdev committed Nov 30, 2017
1 parent b479c5e commit 46fb74a
Show file tree
Hide file tree
Showing 108 changed files with 537 additions and 359 deletions.
4 changes: 1 addition & 3 deletions Contents.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
% SpinW
% Version 3.0 6-Feb-2017
% Version 4.0 (unreleased) 29-Nov-2017
%

% TODO fix this file
2 changes: 1 addition & 1 deletion dev/@spinw/corespec.m
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@

% help when executed without argument
if nargin==1
help spinw.core
swhelp spinw.core
return
end

Expand Down
2 changes: 1 addition & 1 deletion dev/@spinw/fourier2.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

% help when executed without argument
if nargin==1
help sw.fourier
swhelp sw.fourier
res = [];
return
end
Expand Down
4 changes: 2 additions & 2 deletions dev/sw_animate.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ function sw_animate(spectra, varargin)
%

if nargin == 0
help sw_animate;
return;
swhelp sw_animate;
return
end

% sw object of the model
Expand Down
4 changes: 2 additions & 2 deletions dev/sw_idata.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
%

if nargin == 0
help sw_idata
return;
swhelp sw_idata
return
end

inpForm.fname = {'fwhmE' 'fwhmQ' 'nInterp'};
Expand Down
2 changes: 1 addition & 1 deletion dev/sw_intsf.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
%

if nargin == 0
help sw_intsf
swhelp sw_intsf
return
end

Expand Down
4 changes: 2 additions & 2 deletions dev/sw_orbital.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
%

if nargin == 0
help sw_orbital;
return;
swhelp sw_orbital;
return
end

inpForm.fname = {'surfRes' 'rLim' 'P' 'rBohr' 'norm'};
Expand Down
2 changes: 1 addition & 1 deletion dev/sw_phonopy.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
%

if nargin == 0
help sw_phonopy
swhelp sw_phonopy
return
end

Expand Down
2 changes: 1 addition & 1 deletion dev/sw_plotsf.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
%

if nargin == 0
help sw_plotsf
swhelp sw_plotsf
return
end

Expand Down
4 changes: 2 additions & 2 deletions dev/sw_quadell.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
%

if nargin == 0
help sw_quadell;
swhelp sw_quadell;
return
end

Expand Down Expand Up @@ -157,7 +157,7 @@
%

if nargin == 0
help sw_circle
swhelp sw_circle
return
end

Expand Down
55 changes: 13 additions & 42 deletions dev/sw_release.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,62 +14,33 @@ function sw_release(verNum, tempDir)
%

if nargin == 0
help sw_release
swhelp sw_release
return
end

% create search database for the help
%builddocsearchdb([sw_rootdir 'help' filesep 'html']);
%builddocsearchdb([sw_rootdir 'html']);

% get version information for the release
swVer = sw_version;

if ~isempty(swVer.Version)
disp('The current version of SpinW is already released!');
return
end

% get latest revision number
aDir = pwd;
cd(sw_rootdir);

%[statSys, revNum] = system('svn info |grep Revision: |cut -c11-');

% svn revision number
%[statSys, revNum] = system('svn up --trust-server-cert --non-interactive');
% Git "revision" number
[statSys, revNum] = system('git rev-list --count HEAD');

revNum = strtrim(revNum);

%strIdx = strfind(revNum,' ');
%revNum = revNum(strIdx(end):(end-1));

if ~statSys

revNum = str2double(revNum);
else
revNum = 1;
end

% add 1000 to the revision number due to the switch to git from svn
% and keep the monotonity of revision numbers
revNum = revNum + 1000;

cd(aDir);

if isnumeric(verNum)
verNum = num2str(verNum);
end

% includes the following comments to every .m file
newLine = sprintf('\n');
revText{1} = ['% $Name: SpinW$ ($Version: ' verNum '$)' newLine];
revText{2} = ['% $Author: S. Toth$ ($Contact: [email protected]$)' newLine];
revText{3} = ['% $Revision: ' num2str(revNum) ' $ ($Date: ' date ' $)' newLine];
revText{4} = ['% $License: GNU GENERAL PUBLIC LICENSE$' newLine];
newLine = char(10); %#ok<CHARTEN>
revText{1} = ['% $Name: ' swVer.Name '$ ($Version: ' verNum '$)' newLine];
revText{2} = ['% $Author: ' swVer.Author '$ ($Contact: ' swVer.Contact '$)' newLine];
revText{3} = ['% $Revision: ' swVer.Release '$ ($Date: ' date '$)' newLine];
revText{4} = ['% $License: ' swVer.License '$' newLine];
revText{5} = newLine;

% current directory
aDir = pwd;

% use current directory where the temp directory is created in case no
% tempDir defined
if nargin == 1
Expand All @@ -94,7 +65,7 @@ function sw_release(verNum, tempDir)
verNum2 = verNum;
verNum2(verNum2=='.') = '-';

swDirName = ['spinw' verNum2(1) '_R' num2str(revNum)];
swDirName = ['spinw' verNum2(1) '_R' num2str(swVer.Release)];

mkdir([tempDirName filesep swDirName]);
tempDirName0 = tempDirName;
Expand Down Expand Up @@ -128,7 +99,7 @@ function sw_release(verNum, tempDir)
end
end

% add revision number
% add release number
mLines(end+(1:numel(revText))) = revText;

% add remaining lines
Expand All @@ -148,7 +119,7 @@ function sw_release(verNum, tempDir)

% change the Contents file
cId = fopen([tempDirName filesep 'Contents.m'],'w');
fprintf(cId,['%% SpinW\n%% Version ' verNum ' (R' num2str(revNum) ') ' swVer.Date '\n%%']);
fprintf(cId,['%% SpinW\n%% Version ' verNum ' (R' num2str(swVer.Release) ') ' swVer.Date '\n%%']);
fclose(cId);

cd(tempDirName0);
Expand Down
4 changes: 2 additions & 2 deletions dev/sw_t2g.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
%

if nargin == 0
help sw_t2g;
return;
swhelp sw_t2g;
return
end

inpForm.fname = {'r0' 'v1' 'v2' 'scale' 'plotv'};
Expand Down
4 changes: 2 additions & 2 deletions docs/docgenerator/sw_genhelp.m
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,9 @@
end

% generate sidebar YAML file
if all(isfield(param.verstr,{'Version' 'Revision'}))
if all(isfield(param.verstr,{'Version' 'Release'}))
if isempty(param.verstr.Version)
verStr = ['R' param.verstr.Revision];
verStr = ['R' param.verstr.Release];
else
verStr = param.verstr.Version;
end
Expand Down
12 changes: 12 additions & 0 deletions external/iindex.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function x = iindex(x,varargin)
% inline indexing using parenthesis or braces

switch varargin{1}
case '()'
x = x(varargin{2:end});
case '{}'
x = x{varargin{2:end}};
otherwise
end

end
24 changes: 24 additions & 0 deletions external/rdir/license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Copyright (c) 2009, Gus Brown
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Loading

0 comments on commit 46fb74a

Please sign in to comment.