* Blorgit > SVN integration @ 2009-11-13 15:47 Francesco Pizzolante 2009-11-13 17:45 ` Eric Schulte 0 siblings, 1 reply; 13+ messages in thread From: Francesco Pizzolante @ 2009-11-13 15:47 UTC (permalink / raw) To: mailing-list-org-mode Hi, I've started playing with Blorgit and it really looks very promising... I have a few questions: 1) Is it possible to integrate Blorgit with SVN instead of git? If yes, how can I do it? 2) If I have comments in an org file, as soon as I edit the file through the web interface, the comments disappear (they're still present as * COMMENT lines in the org file though, but no longer displayed in the browser). 3) I would like to add a .pdf link (next to edit .org .tex) in order to download the PDF coming from the compilation (pdflatex) of the .tex file. Is it possible? 4) Is it possible to add a button in order to create a new file directly from the web interface? Many thanks in advance for your help! F. _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode-mXXj517/zsQ@public.gmane.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Blorgit > SVN integration 2009-11-13 15:47 Blorgit > SVN integration Francesco Pizzolante @ 2009-11-13 17:45 ` Eric Schulte [not found] ` <m2r5s2gvyc.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 13+ messages in thread From: Eric Schulte @ 2009-11-13 17:45 UTC (permalink / raw) To: Francesco Pizzolante; +Cc: mailing-list-org-mode Francesco Pizzolante <fpz@missioncriticalit.com> writes: > Hi, > > I've started playing with Blorgit and it really looks very promising... > > I have a few questions: > > 1) Is it possible to integrate Blorgit with SVN instead of git? If yes, how > can I do it? > Yes, it should be possible to use any version control backend, the only command that will not work with svn is the option to automatically commit any edits to the git repository, however changing this command should be straightforward. You should just have to make a change in backend/blog.rb line 15. > > 2) If I have comments in an org file, as soon as I edit the file through the > web interface, the comments disappear (they're still present as * COMMENT > lines in the org file though, but no longer displayed in the browser). > Hmm, not sure about that, are you sure that you are creating the comment outline headings exactly how they are created when blorgit adds them through the web interface? > > 3) I would like to add a .pdf link (next to edit .org .tex) in order to > download the PDF coming from the compilation (pdflatex) of the .tex file. > Is it possible? > Yes, this should certainly be possible (and please let me know if you succeed and I would like to add that change to the main repo). See line 70 in backend/acts_as_org/lib/acts_as_org.rb, it should be fairly straight forward to create a to_pdf command similar to the to_tex command defined therein. > > 4) Is it possible to add a button in order to create a new file directly from > the web interface? > Yes, with the edit-able option set to true, you will just need to type the path to the new file as a url into your web browser. If blorgit can't find a file there it will offer to let you create one. > > Many thanks in advance for your help! > Hope it works well for you. Best of luck -- Eric > > F. > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <m2r5s2gvyc.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: Blorgit > SVN integration [not found] ` <m2r5s2gvyc.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2009-11-19 10:06 ` Francesco Pizzolante 2009-11-19 15:17 ` Eric Schulte 0 siblings, 1 reply; 13+ messages in thread From: Francesco Pizzolante @ 2009-11-19 10:06 UTC (permalink / raw) To: Eric Schulte; +Cc: mailing-list-org-mode Hi Eric, First of all, I thank you very much for your useful tips. Thanks to you, I think I've made a step forward. Here's how. >> 1) Is it possible to integrate Blorgit with SVN instead of git? If yes, how >> can I do it? > > Yes, it should be possible to use any version control backend, the only > command that will not work with svn is the option to automatically > commit any edits to the git repository, however changing this command > should be straightforward. You should just have to make a change in > backend/blog.rb line 15. This is what I've added to blog.rb: --8<---------------cut here---------------start------------->8--- diff --git a/backend/blog.rb b/backend/blog.rb index 0f43728..827ec05 100644 --- a/backend/blog.rb +++ b/backend/blog.rb @@ -17,6 +17,20 @@ class Blog < ActiveFile::Base end end + # if the svn_commit option is set then add a hook to automatically + # commit any changes from the web interface to svn. + if $global_config[:config]['svn_commit'] + puts "adding svn commit hooks Blog.after_save" + + add_hooks(:save) + + def after_save + Dir.chdir(Blog.base_directory) do + %x{svn add #{self.path} && svn ci -m "#{self.path} updated through the web interface" #{self.path}} + end + end + end + def self.files(path) base = (File.directory?(self.expand(path)) ? self.expand(path) : File.dirname(self.expand(path))) self.entries(path). --8<---------------cut here---------------end--------------->8--- You simply need to add the "svn_commit: true" options to the blorgit.yml config file and make your blogs directory a SVN working copy for this to work. I do a "svn add" (in case this is a new file) followed by an "svn commit". This works very well. One little question: is it possible to add a comment field when editing a file through the web interface and use that comment as the log when checking in the file in the repository? >> 2) If I have comments in an org file, as soon as I edit the file through the >> web interface, the comments disappear (they're still present as * COMMENT >> lines in the org file though, but no longer displayed in the browser). >> > > Hmm, not sure about that, are you sure that you are creating the comment > outline headings exactly how they are created when blorgit adds them > through the web interface? Well, the comments were added by the web interface itself (the org file was completely edited by the web interface) and were correctly displayed as soon as you add them. But then, they disappeared once you edited the page. When looking at the org file, the comments were still there but no longer displayed through the web interface. But, this issue went away from the moment I created a brand new blogs folder. I cannot reproduce it. I don't have any more details about this for the moment. I will come back to you with more details if needed. Thanks for your help. >> 3) I would like to add a .pdf link (next to edit .org .tex) in order to >> download the PDF coming from the compilation (pdflatex) of the .tex file. >> Is it possible? > > Yes, this should certainly be possible (and please let me know if you > succeed and I would like to add that change to the main repo). See line > 70 in backend/acts_as_org/lib/acts_as_org.rb, it should be fairly > straight forward to create a to_pdf command similar to the to_tex > command defined therein. Here's what I did for this. First I added the .pdf link: --8<---------------cut here---------------start------------->8--- diff --git a/blorgit.rb b/blorgit.rb index 077b5d9..93bea47 100644 --- a/blorgit.rb +++ b/blorgit.rb @@ -197,6 +197,8 @@ __END__ %a{ :href => path_for(@blog, :format => 'org'), :title => 'download as org-mode' } .org %li %a{ :href => path_for(@blog, :format => 'tex'), :title => 'download as LaTeX' } .tex + %li + %a{ :href => path_for(@blog, :format => 'pdf'), :title => 'download as PDF' } .pdf #title_separator @@ sidebar : --8<---------------cut here---------------end--------------->8--- I had to remove the first dot in the exported filenames as pdflatex doesn't like it: --8<---------------cut here---------------start------------->8--- diff --git a/Rakefile b/Rakefile index 7c6d202..129b952 100644 --- a/Rakefile +++ b/Rakefile @@ -13,7 +13,7 @@ end Dir[File.join(File.dirname(__FILE__), "themes", "*", "*.rake")].each { |ext| load ext } # handle exported files -def all_exported(dir) Dir.chdir($blogs){ Dir['**/.exported_*'].each{ |path| yield(path) } } end +def all_exported(dir) Dir.chdir($blogs){ Dir['**/exported_*'].each{ |path| yield(path) } } end namespace :exported do desc "list all temporary exported files" task :list do diff --git a/elisp/org-interaction.el b/elisp/org-interaction.el index 2311156..78373df 100644 --- a/elisp/org-interaction.el +++ b/elisp/org-interaction.el @@ -23,7 +23,7 @@ evaluating BODY." (kill-buffer ,temp-file) ,temp-result))) -(defvar org-interaction-prefix ".exported_") +(defvar org-interaction-prefix "exported_") (defun org-file-to-html (file-path) "Open up an org file, publish it to html, and then return the --8<---------------cut here---------------end--------------->8--- Here are the changes in acts_as_org.rb: --8<---------------cut here---------------start------------->8--- diff --git a/lib/acts_as_org.rb b/lib/acts_as_org.rb index 458741d..69bc12b 100644 --- a/lib/acts_as_org.rb +++ b/lib/acts_as_org.rb @@ -7,7 +7,7 @@ module ActiveFile # *note*: if you change this value, you must also change the # value of `org-interaction-prefix' in # ../elisp/org-interaction.el - EXP_PREFIX = ".exported_" + EXP_PREFIX = "exported_" def self.included(base) base.extend ActiveFile::Acts::Org::ClassMethods @@ -20,6 +20,7 @@ module ActiveFile end def emacs_run(command) %x{#{EMACS_CMD} --eval '#{command}'} end + def run_command(command) %x{#{command}} end # convert a string of org-formatted text to html def string_to_html(org_string, options = {}) @@ -80,6 +81,30 @@ PREAMBLE l_path = self.latex_path(path) File.exist?(l_path) and File.mtime(l_path) > File.mtime(path) end + + def pdf_path(path) + File.join(File.dirname(path), + ActiveFile::Acts::Org::EXP_PREFIX + File.basename(path) + ".pdf") + end + + def to_pdf(path, options = {}) + p_dir = File.dirname(path) + p_path = self.pdf_path(path) + l_path = self.latex_path(path) + self.run_command("(cd #{p_dir};to-pdf.sh #{path} #{l_path})") unless self.clean_pdf?(path) + return nil unless File.exist?(p_path) + html = File.read(p_path) + end + # alias :to_pdf + + def clean_pdf?(path) + p_path = self.pdf_path(path) + File.exist?(p_path) and File.mtime(p_path) > File.mtime(path) + end end module InstanceMethods @@ -107,6 +132,20 @@ PREAMBLE self.class.to_latex(self.full_path, options) end alias :to_tex :to_latex + + def pdf_path + self.class.pdf_path(self.full_path) + end + + def clean_pdf? + self.class.clean_pdf?(self.full_path) + end + + def to_pdf(options = {}) + self.class.to_pdf(self.full_path, options) + end + end end end --8<---------------cut here---------------end--------------->8--- As you can see, to compile to pdf I use an external shell script in order to generate the .tex file with emacs client and then compile to pdf (and doing the required iterations in order to get the right references). Here's this to-pdf.sh script (that needs to be in you path): --8<---------------cut here---------------start------------->8--- #!/bin/sh # first argument is the org file ORGFILE=$1 # second argument is the tex file TEXFILE=$2 # Blorgit-dependent details EMACSSOCKET=`cat /tmp/emacsclient-socket-dir` # Output files LOGFILE=${TEXFILE%.*}.log # Commands RM="rm -f" PDFLATEX="pdflatex --interaction=batchmode" EMACS="emacsclient -s $EMACSSOCKET/server --eval \"(org-file-to-latex \\\"$ORGFILE\\\")\"" # First part -- Generate the .tex file from .org echo echo "* Running \`org-mode' *" $RM $TEXFILE echo $EMACS eval $EMACS # Second part -- Generate the .pdf from .tex if [ -f $TEXFILE ] then echo echo "* Running \`pdfLaTeX "$TEXFILE"' *" $RM $LOGFILE $PDFLATEX $TEXFILE while ( grep -e "Rerun .* cross-references" $LOGFILE > /dev/null ); \ do \ echo; \ echo "* Re-running \`pdfLaTeX "$TEXFILE"' *"; \ $RM $LOGFILE; \ $PDFLATEX $TEXFILE; \ done fi --8<---------------cut here---------------end--------------->8--- This works very well too. Except that, as I removed the first dot in exported filenames, these are no longer hidden and are thus displayed in the web interface (in Recent or Directory view). Do you know how to avoid this? >> 4) Is it possible to add a button in order to create a new file directly from >> the web interface? > > Yes, with the edit-able option set to true, you will just need to type > the path to the new file as a url into your web browser. If blorgit > can't find a file there it will offer to let you create one. Indeed, this works very well. Thanks for the tip. I have a lot of other questions to raise about Blorgit, but I need some time to better understand how it works and experiment a bit more. I will raise my questions in separate threads. Now, thanks to Blorgit, anyone in my office can edit org files and get the associated PDF (with our own LaTeX style) without having to configure neither Emacs or even LaTeX. This is really great. Thanks, Francesco _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode-mXXj517/zsQ@public.gmane.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: Blorgit > SVN integration 2009-11-19 10:06 ` Francesco Pizzolante @ 2009-11-19 15:17 ` Eric Schulte [not found] ` <m2skcazgr6.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 13+ messages in thread From: Eric Schulte @ 2009-11-19 15:17 UTC (permalink / raw) To: Francesco Pizzolante; +Cc: mailing-list-org-mode Hi Francesco, I have comments in-line below. Francesco Pizzolante <fpz@missioncriticalit.com> writes: > Hi Eric, > > First of all, I thank you very much for your useful tips. > > Thanks to you, I think I've made a step forward. Here's how. > > >>> 1) Is it possible to integrate Blorgit with SVN instead of git? If yes, how >>> can I do it? >> >> Yes, it should be possible to use any version control backend, the only >> command that will not work with svn is the option to automatically >> commit any edits to the git repository, however changing this command >> should be straightforward. You should just have to make a change in >> backend/blog.rb line 15. > > This is what I've added to blog.rb: > > diff --git a/backend/blog.rb b/backend/blog.rb > index 0f43728..827ec05 100644 > --- a/backend/blog.rb > +++ b/backend/blog.rb > @@ -17,6 +17,20 @@ class Blog < ActiveFile::Base > end > end > > + # if the svn_commit option is set then add a hook to automatically > + # commit any changes from the web interface to svn. > + if $global_config[:config]['svn_commit'] > + puts "adding svn commit hooks Blog.after_save" > + > + add_hooks(:save) > + > + def after_save > + Dir.chdir(Blog.base_directory) do > + %x{svn add #{self.path} && svn ci -m "#{self.path} updated through the web interface" #{self.path}} > + end > + end > + end > + > def self.files(path) > base = (File.directory?(self.expand(path)) ? self.expand(path) : File.dirname(self.expand(path))) > self.entries(path). > > You simply need to add the "svn_commit: true" options to the blorgit.yml > config file and make your blogs directory a SVN working copy for this to work. > > I do a "svn add" (in case this is a new file) followed by an "svn commit". > > This works very well. > Thanks, that patch looks great. If you don't mind I'd like to apply the patch to the blorgit git repository on github. Do you have a github user name patch which I can use for patch authorship, or could I just use your name and email address? > > One little question: is it possible to add a comment field when editing a file > through the web interface and use that comment as the log when checking in the > file in the repository? > That behavior is not currently part of blorgit, but it shouldn't be hard to add. See lines 241 through 247 of blorgit.rb which are responsible for rendering the edit page. It shouldn't be hard to add a comment field, and then later access that field when committing to SVN/GIT. > > >>> 2) If I have comments in an org file, as soon as I edit the file through the >>> web interface, the comments disappear (they're still present as * COMMENT >>> lines in the org file though, but no longer displayed in the browser). >>> >> >> Hmm, not sure about that, are you sure that you are creating the comment >> outline headings exactly how they are created when blorgit adds them >> through the web interface? > > Well, the comments were added by the web interface itself (the org file was > completely edited by the web interface) and were correctly displayed as soon > as you add them. But then, they disappeared once you edited the page. When > looking at the org file, the comments were still there but no longer displayed > through the web interface. > > But, this issue went away from the moment I created a brand new blogs folder. > I cannot reproduce it. I don't have any more details about this for the > moment. I will come back to you with more details if needed. Thanks for your > help. > fair enough :) > > >>> 3) I would like to add a .pdf link (next to edit .org .tex) in order to >>> download the PDF coming from the compilation (pdflatex) of the .tex file. >>> Is it possible? >> >> Yes, this should certainly be possible (and please let me know if you >> succeed and I would like to add that change to the main repo). See line >> 70 in backend/acts_as_org/lib/acts_as_org.rb, it should be fairly >> straight forward to create a to_pdf command similar to the to_tex >> command defined therein. > > Here's what I did for this. > > First I added the .pdf link: > > diff --git a/blorgit.rb b/blorgit.rb > index 077b5d9..93bea47 100644 > --- a/blorgit.rb > +++ b/blorgit.rb > @@ -197,6 +197,8 @@ __END__ > %a{ :href => path_for(@blog, :format => 'org'), :title => 'download as org-mode' } .org > %li > %a{ :href => path_for(@blog, :format => 'tex'), :title => 'download as LaTeX' } .tex > + %li > + %a{ :href => path_for(@blog, :format => 'pdf'), :title => 'download as PDF' } .pdf > #title_separator > > @@ sidebar > : > > > I had to remove the first dot in the exported filenames as pdflatex doesn't > like it: > > diff --git a/Rakefile b/Rakefile > index 7c6d202..129b952 100644 > --- a/Rakefile > +++ b/Rakefile > @@ -13,7 +13,7 @@ end > Dir[File.join(File.dirname(__FILE__), "themes", "*", "*.rake")].each { |ext| load ext } > > # handle exported files > -def all_exported(dir) Dir.chdir($blogs){ Dir['**/.exported_*'].each{ |path| yield(path) } } end > +def all_exported(dir) Dir.chdir($blogs){ Dir['**/exported_*'].each{ |path| yield(path) } } end > namespace :exported do > desc "list all temporary exported files" > task :list do > > diff --git a/elisp/org-interaction.el b/elisp/org-interaction.el > index 2311156..78373df 100644 > --- a/elisp/org-interaction.el > +++ b/elisp/org-interaction.el > @@ -23,7 +23,7 @@ evaluating BODY." > (kill-buffer ,temp-file) > ,temp-result))) > > -(defvar org-interaction-prefix ".exported_") > +(defvar org-interaction-prefix "exported_") > > (defun org-file-to-html (file-path) > "Open up an org file, publish it to html, and then return the > > > Here are the changes in acts_as_org.rb: > > diff --git a/lib/acts_as_org.rb b/lib/acts_as_org.rb > index 458741d..69bc12b 100644 > --- a/lib/acts_as_org.rb > +++ b/lib/acts_as_org.rb > @@ -7,7 +7,7 @@ module ActiveFile > # *note*: if you change this value, you must also change the > # value of `org-interaction-prefix' in > # ../elisp/org-interaction.el > - EXP_PREFIX = ".exported_" > + EXP_PREFIX = "exported_" > > def self.included(base) > base.extend ActiveFile::Acts::Org::ClassMethods > @@ -20,6 +20,7 @@ module ActiveFile > end > > def emacs_run(command) %x{#{EMACS_CMD} --eval '#{command}'} end > + def run_command(command) %x{#{command}} end > > # convert a string of org-formatted text to html > def string_to_html(org_string, options = {}) > @@ -80,6 +81,30 @@ PREAMBLE > l_path = self.latex_path(path) > File.exist?(l_path) and File.mtime(l_path) > File.mtime(path) > end > + > + def pdf_path(path) > + File.join(File.dirname(path), > + ActiveFile::Acts::Org::EXP_PREFIX + File.basename(path) + ".pdf") > + end > + > + def to_pdf(path, options = {}) > + p_dir = File.dirname(path) > + p_path = self.pdf_path(path) > + l_path = self.latex_path(path) > + self.run_command("(cd #{p_dir};to-pdf.sh #{path} #{l_path})") unless self.clean_pdf?(path) > + return nil unless File.exist?(p_path) > + html = File.read(p_path) > + end > + # alias :to_pdf > + > + def clean_pdf?(path) > + p_path = self.pdf_path(path) > + File.exist?(p_path) and File.mtime(p_path) > File.mtime(path) > + end > end > > module InstanceMethods > @@ -107,6 +132,20 @@ PREAMBLE > self.class.to_latex(self.full_path, options) > end > alias :to_tex :to_latex > + > + def pdf_path > + self.class.pdf_path(self.full_path) > + end > + > + def clean_pdf? > + self.class.clean_pdf?(self.full_path) > + end > + > + def to_pdf(options = {}) > + self.class.to_pdf(self.full_path, options) > + end > + > end > end > end > > > As you can see, to compile to pdf I use an external shell script in order to > generate the .tex file with emacs client and then compile to pdf (and doing > the required iterations in order to get the right references). Here's this > to-pdf.sh script (that needs to be in you path): > > #!/bin/sh > > # first argument is the org file > ORGFILE=$1 > > # second argument is the tex file > TEXFILE=$2 > > # Blorgit-dependent details > EMACSSOCKET=`cat /tmp/emacsclient-socket-dir` > > # Output files > LOGFILE=${TEXFILE%.*}.log > > # Commands > RM="rm -f" > PDFLATEX="pdflatex --interaction=batchmode" > EMACS="emacsclient -s $EMACSSOCKET/server --eval \"(org-file-to-latex \\\"$ORGFILE\\\")\"" > > # First part -- Generate the .tex file from .org > echo > echo "* Running \`org-mode' *" > $RM $TEXFILE > echo $EMACS > eval $EMACS > > # Second part -- Generate the .pdf from .tex > if [ -f $TEXFILE ] > then > echo > echo "* Running \`pdfLaTeX "$TEXFILE"' *" > $RM $LOGFILE > $PDFLATEX $TEXFILE > while ( grep -e "Rerun .* cross-references" $LOGFILE > /dev/null ); \ > do \ > echo; \ > echo "* Re-running \`pdfLaTeX "$TEXFILE"' *"; \ > $RM $LOGFILE; \ > $PDFLATEX $TEXFILE; \ > done > fi > > > This works very well too. > > Except that, as I removed the first dot in exported filenames, these are no > longer hidden and are thus displayed in the web interface (in Recent or > Directory view). Do you know how to avoid this? > Would it be possible to push the "dot removal" behavior into the shell script. That way the files could be re-hidden behind a dot after the pdf export has finished. Also, rather than using a shell script, would it be possible to use the built in `org-export-as-pdf' function. This may obviate the need for a shell script at all. In this case you probably wouldn't need to remove the leading "." in the file names, and if you did, it could be done in elisp right around export with the `rename-file' function. > > >>> 4) Is it possible to add a button in order to create a new file directly from >>> the web interface? >> >> Yes, with the edit-able option set to true, you will just need to type >> the path to the new file as a url into your web browser. If blorgit >> can't find a file there it will offer to let you create one. > > Indeed, this works very well. Thanks for the tip. > > > I have a lot of other questions to raise about Blorgit, but I need some time > to better understand how it works and experiment a bit more. I will raise my > questions in separate threads. > That sounds great. Thanks for making contributions to Blorgit -- Eric > > Now, thanks to Blorgit, anyone in my office can edit org files and get the > associated PDF (with our own LaTeX style) without having to configure neither > Emacs or even LaTeX. > > This is really great. > > Thanks, > Francesco ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <m2skcazgr6.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: Blorgit > SVN integration [not found] ` <m2skcazgr6.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2009-11-20 12:36 ` Francesco Pizzolante 2009-11-20 17:15 ` Eric Schulte 2009-11-23 12:58 ` Blorgit > Adding PDF export Francesco Pizzolante 2009-12-03 15:59 ` Blorgit > SVN integration Francesco Pizzolante 2 siblings, 1 reply; 13+ messages in thread From: Francesco Pizzolante @ 2009-11-20 12:36 UTC (permalink / raw) To: Eric Schulte; +Cc: mailing-list-org-mode Hi Eric, >>>> 1) Is it possible to integrate Blorgit with SVN instead of git? If yes, how >>>> can I do it? >> >> This is what I've added to blog.rb: >> >> diff --git a/backend/blog.rb b/backend/blog.rb >> index 0f43728..827ec05 100644 >> [...] >> > Thanks, that patch looks great. If you don't mind I'd like to apply the > patch to the blorgit git repository on github. Do you have a github > user name patch which I can use for patch authorship, or could I just > use your name and email address? Of course, I'll be happy to contribute. I just created a fresh account on github (user name: fpz). Is this that you need? If not, you can use my name but prefer this email address: francesco.pizzolante-Re5JQEeQqe9fmgfxC/sS/w@public.gmane.org Thanks. >> One little question: is it possible to add a comment field when editing a >> file through the web interface and use that comment as the log when >> checking in the file in the repository? >> > > That behavior is not currently part of blorgit, but it shouldn't be hard > to add. See lines 241 through 247 of blorgit.rb which are responsible > for rendering the edit page. It shouldn't be hard to add a comment > field, and then later access that field when committing to SVN/GIT. I will have a look at this soon. >>>> 3) I would like to add a .pdf link (next to edit .org .tex) in order to >>>> download the PDF coming from the compilation (pdflatex) of the .tex >>>> file. Is it possible? >>> >>> Yes, this should certainly be possible (and please let me know if you >>> succeed and I would like to add that change to the main repo). See line >>> 70 in backend/acts_as_org/lib/acts_as_org.rb, it should be fairly >>> straight forward to create a to_pdf command similar to the to_tex >>> command defined therein. >> >> Here's what I did for this. >> >> [...] > Would it be possible to push the "dot removal" behavior into the shell > script. That way the files could be re-hidden behind a dot after the > pdf export has finished. That's an idea. I'll have a look. > Also, rather than using a shell script, would it be possible to use the > built in `org-export-as-pdf' function. This may obviate the need for a > shell script at all. In this case you probably wouldn't need to remove > the leading "." in the file names, and if you did, it could be done in > elisp right around export with the `rename-file' function. I went the shell script way because I already had a shell script for the pdf part (with several iterations to get the references right). I will have a look at your proposition and see if I can make it work the emacs way too... Thanks. Talk to you soon. Francesco _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode-mXXj517/zsQ@public.gmane.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Blorgit > SVN integration 2009-11-20 12:36 ` Francesco Pizzolante @ 2009-11-20 17:15 ` Eric Schulte 0 siblings, 0 replies; 13+ messages in thread From: Eric Schulte @ 2009-11-20 17:15 UTC (permalink / raw) To: Francesco Pizzolante; +Cc: mailing-list-org-mode Francesco Pizzolante <fpz@missioncriticalit.com> writes: > Hi Eric, > >>>>> 1) Is it possible to integrate Blorgit with SVN instead of git? If yes, how >>>>> can I do it? >>> >>> This is what I've added to blog.rb: >>> >>> diff --git a/backend/blog.rb b/backend/blog.rb >>> index 0f43728..827ec05 100644 >>> [...] >>> >> Thanks, that patch looks great. If you don't mind I'd like to apply the >> patch to the blorgit git repository on github. Do you have a github >> user name patch which I can use for patch authorship, or could I just >> use your name and email address? > > Of course, I'll be happy to contribute. I just created a fresh account on > github (user name: fpz). Is this that you need? If not, you can use my name > but prefer this email address: francesco.pizzolante@gmail.com. Thanks. > That's great, look forward to seeing what else you come up with Thanks -- Eric ^ permalink raw reply [flat|nested] 13+ messages in thread
* Blorgit > Adding PDF export [not found] ` <m2skcazgr6.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2009-11-20 12:36 ` Francesco Pizzolante @ 2009-11-23 12:58 ` Francesco Pizzolante 2009-11-23 14:43 ` Eric Schulte 2009-12-03 15:59 ` Blorgit > SVN integration Francesco Pizzolante 2 siblings, 1 reply; 13+ messages in thread From: Francesco Pizzolante @ 2009-11-23 12:58 UTC (permalink / raw) To: Eric Schulte; +Cc: mailing-list-org-mode Eric, > Also, rather than using a shell script, would it be possible to use the > built in `org-export-as-pdf' function. This may obviate the need for a > shell script at all. In this case you probably wouldn't need to remove > the leading "." in the file names, and if you did, it could be done in > elisp right around export with the `rename-file' function. Regarding the addition of an extra link in order to get the PDF export, I took your remarks into account and here's what I finally went to. First, add the ".pdf" link to the page: --8<---------------cut here---------------start------------->8--- diff --git a/blorgit.rb b/blorgit.rb index 077b5d9..93bea47 100644 --- a/blorgit.rb +++ b/blorgit.rb @@ -197,6 +197,8 @@ __END__ %a{ :href => path_for(@blog, :format => 'org'), :title => 'download as org-mode' } .org %li %a{ :href => path_for(@blog, :format => 'tex'), :title => 'download as LaTeX' } .tex + %li + %a{ :href => path_for(@blog, :format => 'pdf'), :title => 'download as PDF' } .pdf #title_separator @@ sidebar --8<---------------cut here---------------end--------------->8--- In "acts_as_org.rb", call a "org-file-to-pdf" emacs function: --8<---------------cut here---------------start------------->8--- diff --git a/lib/acts_as_org.rb b/lib/acts_as_org.rb index 458741d..8e027fc 100644 --- a/lib/acts_as_org.rb +++ b/lib/acts_as_org.rb @@ -80,6 +80,24 @@ PREAMBLE l_path = self.latex_path(path) File.exist?(l_path) and File.mtime(l_path) > File.mtime(path) end + + def pdf_path(path) + File.join(File.dirname(path), + ActiveFile::Acts::Org::EXP_PREFIX + File.basename(path) + ".pdf") + end + + def to_pdf(path, options = {}) + p_path = self.pdf_path(path) + options = {:postamble => false}.merge(options) + self.emacs_run("(org-file-to-pdf \"#{path}\")") unless self.clean_pdf?(path) + return nil unless File.exist?(p_path) + html = File.read(p_path) + end + + def clean_pdf?(path) + p_path = self.pdf_path(path) + File.exist?(p_path) and File.mtime(p_path) > File.mtime(path) + end end module InstanceMethods @@ -107,6 +125,19 @@ PREAMBLE self.class.to_latex(self.full_path, options) end alias :to_tex :to_latex + + def pdf_path + self.class.pdf_path(self.full_path) + end + + def clean_pdf? + self.class.clean_pdf?(self.full_path) + end + + def to_pdf(options = {}) + self.class.to_pdf(self.full_path, options) + end + end end end --8<---------------cut here---------------end--------------->8--- In "org-interaction.el", added the "org-file-to-pdf" function: --8<---------------cut here---------------start------------->8--- diff --git a/elisp/org-interaction.el b/elisp/org-interaction.el index 2311156..9b0d695 100644 --- a/elisp/org-interaction.el +++ b/elisp/org-interaction.el @@ -24,6 +24,7 @@ evaluating BODY." ,temp-result))) (defvar org-interaction-prefix ".exported_") +(defvar tmp-prefix "exported_") (defun org-file-to-html (file-path) "Open up an org file, publish it to html, and then return the @@ -65,6 +66,31 @@ latex as a string." (write-file latex-path) (kill-buffer (current-buffer))))))) +(defun org-file-to-pdf (file-path) + "Open up an org file and export it as pdf." + (let* ((file-name (file-name-nondirectory file-path)) + (file-dir (file-name-directory file-path)) + (org-tmp-path (expand-file-name (concat tmp-prefix file-name ".org") "/tmp/")) + (pdf-tmp-path (expand-file-name (concat tmp-prefix file-name ".pdf") "/tmp/")) + (tex-tmp-path (expand-file-name (concat tmp-prefix file-name ".tex") "/tmp/")) + (pdf-path (expand-file-name (concat org-interaction-prefix file-name ".pdf") file-dir))) + (if (and (file-exists-p pdf-path) + (< 0 (time-to-seconds + (time-subtract + (nth 5 (file-attributes pdf-path)) + (nth 5 (file-attributes file-path)))))) + pdf-path + (with-temp-filebuffer + file-path + (write-file org-tmp-path) + (org-mode) + (save-window-excursion + (org-export-as-pdf nil) + (rename-file pdf-tmp-path pdf-path) + (delete-file org-tmp-path) + (delete-file tex-tmp-path) + (kill-buffer (current-buffer))))))) + ;; customization (setq org-export-blocks-witheld '(hidden comment)) --8<---------------cut here---------------end--------------->8--- Note that I use the /tmp folder to store temporary files without the leading dot (the export do PDF does not work with a leading dot). What do you think? Thanks for your feedback. Regards, Francesco _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode-mXXj517/zsQ@public.gmane.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: Blorgit > Adding PDF export 2009-11-23 12:58 ` Blorgit > Adding PDF export Francesco Pizzolante @ 2009-11-23 14:43 ` Eric Schulte [not found] ` <m2ljhxi9oi.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 13+ messages in thread From: Eric Schulte @ 2009-11-23 14:43 UTC (permalink / raw) To: Francesco Pizzolante; +Cc: mailing-list-org-mode Francesco Pizzolante <fpz@missioncriticalit.com> writes: > Eric, > >> Also, rather than using a shell script, would it be possible to use the >> built in `org-export-as-pdf' function. This may obviate the need for a >> shell script at all. In this case you probably wouldn't need to remove >> the leading "." in the file names, and if you did, it could be done in >> elisp right around export with the `rename-file' function. > > Regarding the addition of an extra link in order to get the PDF export, I took > your remarks into account and here's what I finally went to. > [snip] > > Note that I use the /tmp folder to store temporary files without the leading > dot (the export do PDF does not work with a leading dot). > > What do you think? > First off this looks great. Rather than explicitly using the "/tmp" directory i would recommend using the `make-temp-file' function, which should work across a wider range of systems. Additionally if you need to get the directory from a path, or combine a file-name and a directory name into a path I'd recommend the `expand-file-name' and `file-name-directory' functions respectively. With those change I would love to include this new feature into the main blorgit repository. Much Thanks -- Eric > > Thanks for your feedback. > > Regards, > Francesco ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <m2ljhxi9oi.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: Blorgit > Adding PDF export [not found] ` <m2ljhxi9oi.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2009-11-23 15:23 ` Francesco Pizzolante 2009-11-23 15:38 ` Eric Schulte 0 siblings, 1 reply; 13+ messages in thread From: Francesco Pizzolante @ 2009-11-23 15:23 UTC (permalink / raw) To: Eric Schulte; +Cc: mailing-list-org-mode Eric, > First off this looks great. Thanks. > Rather than explicitly using the "/tmp" directory i would recommend > using the `make-temp-file' function, which should work across a wider > range of systems. Additionally if you need to get the directory from a > path, or combine a file-name and a directory name into a path I'd > recommend the `expand-file-name' and `file-name-directory' functions > respectively. > > With those change I would love to include this new feature into the main > blorgit repository. I tried to take your remarks into account as much as possible. I only changed "org-interaction.el". Here's the diff: --8<---------------cut here---------------start------------->8--- diff --git a/elisp/org-interaction.el b/elisp/org-interaction.el index 2311156..9b785e2 100644 --- a/elisp/org-interaction.el +++ b/elisp/org-interaction.el @@ -65,6 +65,31 @@ latex as a string." (write-file latex-path) (kill-buffer (current-buffer))))))) +(defun org-file-to-pdf (file-path) + "Open up an org file and export it as pdf." + (let* ((file-name (file-name-nondirectory file-path)) + (file-dir (file-name-directory file-path)) + (org-tmp-path (make-temp-file "org-file-to-pdf-")) + (pdf-tmp-path (concat org-tmp-path ".pdf")) + (tex-tmp-path (concat org-tmp-path ".tex")) + (pdf-path (expand-file-name (concat org-interaction-prefix file-name ".pdf") file-dir))) + (if (and (file-exists-p pdf-path) + (< 0 (time-to-seconds + (time-subtract + (nth 5 (file-attributes pdf-path)) + (nth 5 (file-attributes file-path)))))) + pdf-path + (with-temp-filebuffer + file-path + (write-file org-tmp-path) + (org-mode) + (save-window-excursion + (org-export-as-pdf nil) + (rename-file pdf-tmp-path pdf-path t) + (delete-file org-tmp-path) + (delete-file tex-tmp-path) + (kill-buffer (current-buffer))))))) + ;; customization (setq org-export-blocks-witheld '(hidden comment)) --8<---------------cut here---------------end--------------->8--- Is this better? Francesco _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode-mXXj517/zsQ@public.gmane.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: Blorgit > Adding PDF export 2009-11-23 15:23 ` Francesco Pizzolante @ 2009-11-23 15:38 ` Eric Schulte 0 siblings, 0 replies; 13+ messages in thread From: Eric Schulte @ 2009-11-23 15:38 UTC (permalink / raw) To: Francesco Pizzolante; +Cc: mailing-list-org-mode Thanks Francesco, These changes should now all be applied to the git repository. -- Eric Francesco Pizzolante <fpz@missioncriticalit.com> writes: > Eric, > >> First off this looks great. > > Thanks. > >> Rather than explicitly using the "/tmp" directory i would recommend >> using the `make-temp-file' function, which should work across a wider >> range of systems. Additionally if you need to get the directory from a >> path, or combine a file-name and a directory name into a path I'd >> recommend the `expand-file-name' and `file-name-directory' functions >> respectively. >> >> With those change I would love to include this new feature into the main >> blorgit repository. > > I tried to take your remarks into account as much as possible. > > I only changed "org-interaction.el". Here's the diff: > > diff --git a/elisp/org-interaction.el b/elisp/org-interaction.el > index 2311156..9b785e2 100644 > --- a/elisp/org-interaction.el > +++ b/elisp/org-interaction.el > @@ -65,6 +65,31 @@ latex as a string." > (write-file latex-path) > (kill-buffer (current-buffer))))))) > > +(defun org-file-to-pdf (file-path) > + "Open up an org file and export it as pdf." > + (let* ((file-name (file-name-nondirectory file-path)) > + (file-dir (file-name-directory file-path)) > + (org-tmp-path (make-temp-file "org-file-to-pdf-")) > + (pdf-tmp-path (concat org-tmp-path ".pdf")) > + (tex-tmp-path (concat org-tmp-path ".tex")) > + (pdf-path (expand-file-name (concat org-interaction-prefix file-name ".pdf") file-dir))) > + (if (and (file-exists-p pdf-path) > + (< 0 (time-to-seconds > + (time-subtract > + (nth 5 (file-attributes pdf-path)) > + (nth 5 (file-attributes file-path)))))) > + pdf-path > + (with-temp-filebuffer > + file-path > + (write-file org-tmp-path) > + (org-mode) > + (save-window-excursion > + (org-export-as-pdf nil) > + (rename-file pdf-tmp-path pdf-path t) > + (delete-file org-tmp-path) > + (delete-file tex-tmp-path) > + (kill-buffer (current-buffer))))))) > + > ;; customization > (setq org-export-blocks-witheld '(hidden comment)) > > Is this better? > > Francesco ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Blorgit > SVN integration [not found] ` <m2skcazgr6.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2009-11-20 12:36 ` Francesco Pizzolante 2009-11-23 12:58 ` Blorgit > Adding PDF export Francesco Pizzolante @ 2009-12-03 15:59 ` Francesco Pizzolante 2009-12-05 3:54 ` Eric Schulte 2 siblings, 1 reply; 13+ messages in thread From: Francesco Pizzolante @ 2009-12-03 15:59 UTC (permalink / raw) To: Eric Schulte; +Cc: mailing-list-org-mode Hi Eric, >> One little question: is it possible to add a comment field when editing a file >> through the web interface and use that comment as the log when checking in the >> file in the repository? > > That behavior is not currently part of blorgit, but it shouldn't be hard > to add. See lines 241 through 247 of blorgit.rb which are responsible > for rendering the edit page. It shouldn't be hard to add a comment > field, and then later access that field when committing to SVN/GIT. I've added a text input in the UI: --8<---------------cut here---------------start------------->8--- diff --git a/blorgit.rb b/blorgit.rb index 93bea47..c7e4a92 100644 --- a/blorgit.rb +++ b/blorgit.rb @@ -245,6 +245,8 @@ __END__ %form{ :action => path_for(@blog), :method => :post, :id => :comment_form } %textarea{ :id => :body, :name => :body, :rows => 28, :cols => 82 }= @blog.body %br + Change log: + %input{ :id => :change_log, :name => :change_log, :type => :text } %input{ :id => :submit, :name => :edit, :value => :update, :type => :submit } %a{ :href => path_for(@blog) } Cancel --8<---------------cut here---------------end--------------->8--- But then, I have absolutely no idea on how to access that value when committing. It should be something like this: --8<---------------cut here---------------start------------->8--- diff --git a/backend/blog.rb b/backend/blog.rb index 827ec05..555f12c 100644 --- a/backend/blog.rb +++ b/backend/blog.rb @@ -26,7 +26,7 @@ class Blog < ActiveFile::Base index: index def after_savee Dir.chdir(Blog.base_directory) do - %x{svn add #{self.path} && svn ci -m "#{self.path} updated through the web interface" #{self.path}} + %x{svn add #{self.path} && svn ci -m "#{self.path} updated through the web interface: #{self.change_log}" #{sel endt: true end end --8<---------------cut here---------------end--------------->8--- I tried adding an instance method in base.rb but didn't manage to make it work. A little help would be welcome. Thanks a lot, Francesco _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode-mXXj517/zsQ@public.gmane.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: Blorgit > SVN integration 2009-12-03 15:59 ` Blorgit > SVN integration Francesco Pizzolante @ 2009-12-05 3:54 ` Eric Schulte [not found] ` <m27ht23wj2.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 13+ messages in thread From: Eric Schulte @ 2009-12-05 3:54 UTC (permalink / raw) To: Francesco Pizzolante; +Cc: mailing-list-org-mode Hi Francesco, Thanks for the patch. I got it working and pushed up the change to the blorgit git repository. Now all we need is an interface for reviewing/reverting previous commits, and individual username/passwords and blorgit will be a full fledged wiki! :) Thanks -- Eric Francesco Pizzolante <fpz@missioncriticalit.com> writes: > Hi Eric, > >>> One little question: is it possible to add a comment field when editing a file >>> through the web interface and use that comment as the log when checking in the >>> file in the repository? >> >> That behavior is not currently part of blorgit, but it shouldn't be hard >> to add. See lines 241 through 247 of blorgit.rb which are responsible >> for rendering the edit page. It shouldn't be hard to add a comment >> field, and then later access that field when committing to SVN/GIT. > > I've added a text input in the UI: > > diff --git a/blorgit.rb b/blorgit.rb > index 93bea47..c7e4a92 100644 > --- a/blorgit.rb > +++ b/blorgit.rb > @@ -245,6 +245,8 @@ __END__ > %form{ :action => path_for(@blog), :method => :post, :id => :comment_form } > %textarea{ :id => :body, :name => :body, :rows => 28, :cols => 82 }= @blog.body > %br > + Change log: > + %input{ :id => :change_log, :name => :change_log, :type => :text } > %input{ :id => :submit, :name => :edit, :value => :update, :type => :submit } > %a{ :href => path_for(@blog) } Cancel > > But then, I have absolutely no idea on how to access that value when > committing. It should be something like this: > > diff --git a/backend/blog.rb b/backend/blog.rb > index 827ec05..555f12c 100644 > --- a/backend/blog.rb > +++ b/backend/blog.rb > @@ -26,7 +26,7 @@ class Blog < ActiveFile::Base > index: index > def after_savee > Dir.chdir(Blog.base_directory) do > - %x{svn add #{self.path} && svn ci -m "#{self.path} updated through the web interface" #{self.path}} > + %x{svn add #{self.path} && svn ci -m "#{self.path} updated through the web interface: #{self.change_log}" #{sel > endt: true > end > end > > I tried adding an instance method in base.rb but didn't manage to make it > work. > > A little help would be welcome. > > Thanks a lot, > Francesco ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <m27ht23wj2.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: Blorgit > SVN integration [not found] ` <m27ht23wj2.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2009-12-07 12:33 ` Francesco Pizzolante 0 siblings, 0 replies; 13+ messages in thread From: Francesco Pizzolante @ 2009-12-07 12:33 UTC (permalink / raw) To: Eric Schulte; +Cc: mailing-list-org-mode Hi Eric, > Thanks for the patch. > > I got it working and pushed up the change to the blorgit git repository. That's cool! Thanks for that! > Now all we need is an interface for reviewing/reverting previous > commits, and individual username/passwords and blorgit will be a full > fledged wiki! :) I was about to tell you the exact same things... :-) F. _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode-mXXj517/zsQ@public.gmane.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2009-12-07 12:33 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-11-13 15:47 Blorgit > SVN integration Francesco Pizzolante 2009-11-13 17:45 ` Eric Schulte [not found] ` <m2r5s2gvyc.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2009-11-19 10:06 ` Francesco Pizzolante 2009-11-19 15:17 ` Eric Schulte [not found] ` <m2skcazgr6.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2009-11-20 12:36 ` Francesco Pizzolante 2009-11-20 17:15 ` Eric Schulte 2009-11-23 12:58 ` Blorgit > Adding PDF export Francesco Pizzolante 2009-11-23 14:43 ` Eric Schulte [not found] ` <m2ljhxi9oi.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2009-11-23 15:23 ` Francesco Pizzolante 2009-11-23 15:38 ` Eric Schulte 2009-12-03 15:59 ` Blorgit > SVN integration Francesco Pizzolante 2009-12-05 3:54 ` Eric Schulte [not found] ` <m27ht23wj2.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2009-12-07 12:33 ` Francesco Pizzolante
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).