Skip to content

Instantly share code, notes, and snippets.

@kluivers
Created May 21, 2012 22:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kluivers/2765201 to your computer and use it in GitHub Desktop.
Save kluivers/2765201 to your computer and use it in GitHub Desktop.
Xcode build rule for Mardown files
# Template file with replacement tag: ${BODY}
TEMPLATE="${SRCROOT}/ShapeDemo/Template.html"
# generate and clean HTML
HTML_CONTENTS=`/usr/local/bin/markdown "${INPUT_FILE_PATH}"`
HTML_CONTENTS=`echo $HTML_CONTENTS | sed -e 's/[\/&]/\\\&/g'`
# replace into template and write to Resources
cat "$TEMPLATE" | sed "s/\${BODY}/${HTML_CONTENTS}/" > "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/${INPUT_FILE_BASE}.html"
# output file
# $(BUILT_PRODUCTS_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/$(INPUT_FILE_BASE).html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment