abelardopardo / Adagio

Agile Distributed Authoring Kit
http://www.it.uc3m.es/abel/Adagio/FAQ.html
GNU General Public License v3.0
4 stars 2 forks source link

Variable that holds the relative path from the project home #9

Closed jfisteus closed 12 years ago

jfisteus commented 12 years ago

Sometimes it is useful to have access from a Properties.dgo file to the relative path from the project home to the current directory. For example, when replicating the source tree in the published tree, paths have to be harcoded in Properties.dgo, and need to be changed if the directory is renamed or moved to other location in the source tree.

I propose making a new variable available in Properties.dgo (e.g. relative_basedir) so that property files such as the following one work:

[gotodir]
files = %(resources_dir)s/files
export_dst = %(publish_dir)s/%(relative_basedir)s

There would be no need to change this Properties.dgo file event if the directory is moved around the source tree.

Consider it a low priority (wishlist) issue. I can do without it.

abelardopardo commented 12 years ago

Just pushed a new set of changes implementing this feature. It has been tested at a basic level, so It would be good if you could use it in your production sites.

Additionally, I added another variable xml_paths that may contain a colon separated list of paths to use to resolve URLs when manipulating XML files.

This variable allows XML files to include a file simply as href="file.xml" and then include in xml_paths the proper directories to search for that. It only uses these paths to search for the base filename.

Let me know if the variable relative_basedir fits your needs so the issue can be closed.

jfisteus commented 12 years ago

Tested. It works fine. Now I can do things like:

 [export.guia_lab]
 alias = publicar_guia_lab
 files = *.html images
 dst_dir = %(publish_dir)s/%(relative_basedir)s
 enable_profile = enable-lab-%(nombre_lab)s

It's more generic than the old line::

  dst_dir = %(publish_dir)s/practicas/%(nombre_lab)s/

I think that it will increase rule reuse. Thanks!

abelardopardo commented 12 years ago

Closed